openapi-diff
Advanced tools
Comparing version 0.23.4 to 0.23.5
@@ -0,1 +1,17 @@ | ||
## [0.23.5](https://bitbucket.org/atlassian/openapi-diff/compare/0.23.4...0.23.5) (2021-10-11) | ||
### Bug Fixes | ||
* bump dependencies ([94ec02f](https://bitbucket.org/atlassian/openapi-diff/commits/94ec02fa95712cf80ad68a33cb8c09ebab8b25b7)) | ||
* safeLoad function is gone, use load() instead ([4410c20](https://bitbucket.org/atlassian/openapi-diff/commits/4410c20b9959f965302773fbe9da6e35cd4bdf68)) | ||
* upgrade node 13.7.0 -> 13.13.0 to avoid this warning from some unidentified depedency which causes a test to fail: ([68a0ebc](https://bitbucket.org/atlassian/openapi-diff/commits/68a0ebce1ec07f21b8e51a008321208c58eab1d6)) | ||
### BREAKING CHANGES | ||
* Dropped support for node.js v10. Migrate to NodeJS v12 or above. | ||
<a name="0.23.4"></a> | ||
@@ -2,0 +18,0 @@ ## [0.23.4](https://bitbucket.org/atlassian/openapi-diff/compare/0.23.3...0.23.4) (2020-11-13) |
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
rules: { | ||
"header-max-length": [1, "always", 130] | ||
"header-max-length": [1, "always", 130], | ||
"body-max-line-length": [1, "always", 130] | ||
} | ||
}; | ||
}; |
@@ -13,3 +13,3 @@ #! /usr/bin/env node | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const commander = require("commander"); | ||
const commander_1 = require("commander"); | ||
const cli_factory_1 = require("./cli-factory"); | ||
@@ -19,3 +19,3 @@ // tslint:disable:no-var-requires | ||
const openApiDiff = cli_factory_1.CliFactory.createOpenApiDiff(); | ||
commander | ||
commander_1.program | ||
.version(packageJson.version) | ||
@@ -41,5 +41,3 @@ .arguments('<source> <destination>') | ||
})) | ||
.parse(process.argv); | ||
if (!commander.args.length) { | ||
commander.help(); | ||
} | ||
.parse(process.argv) | ||
.showHelpAfterError(); |
@@ -18,4 +18,4 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const topLevelXPropertiesDiffs = find_diffs_in_x_properties_1.findDiffsInXProperties(specs.sourceSpec.xProperties, specs.destinationSpec.xProperties, 'xProperties'); | ||
const pathDiffs = yield find_diffs_in_paths_1.findDiffsInPaths(specs.sourceSpec.paths, specs.destinationSpec.paths); | ||
const topLevelXPropertiesDiffs = (0, find_diffs_in_x_properties_1.findDiffsInXProperties)(specs.sourceSpec.xProperties, specs.destinationSpec.xProperties, 'xProperties'); | ||
const pathDiffs = yield (0, find_diffs_in_paths_1.findDiffsInPaths)(specs.sourceSpec.paths, specs.destinationSpec.paths); | ||
const allDiffs = [...topLevelXPropertiesDiffs, ...pathDiffs]; | ||
@@ -22,0 +22,0 @@ return Promise.resolve(allDiffs); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getAddedKeysFromObjects = void 0; | ||
exports.getAddedKeysFromObjects = (source, destination) => { | ||
const getAddedKeysFromObjects = (source, destination) => { | ||
const sourceKeys = Object.keys(source); | ||
return Object.keys(destination).filter((key) => sourceKeys.indexOf(key) === -1); | ||
}; | ||
exports.getAddedKeysFromObjects = getAddedKeysFromObjects; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getCommonKeysFromObjects = void 0; | ||
exports.getCommonKeysFromObjects = (source, destination) => { | ||
const getCommonKeysFromObjects = (source, destination) => { | ||
const sourceKeys = Object.keys(source); | ||
return Object.keys(destination).filter((key) => sourceKeys.indexOf(key) >= 0); | ||
}; | ||
exports.getCommonKeysFromObjects = getCommonKeysFromObjects; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getRemovedKeysFromObjects = void 0; | ||
exports.getRemovedKeysFromObjects = (source, destination) => { | ||
const getRemovedKeysFromObjects = (source, destination) => { | ||
const destinationKeys = Object.keys(destination); | ||
return Object.keys(source).filter((key) => destinationKeys.indexOf(key) === -1); | ||
}; | ||
exports.getRemovedKeysFromObjects = getRemovedKeysFromObjects; |
@@ -13,3 +13,3 @@ "use strict"; | ||
}); | ||
exports.createDifference = (options) => { | ||
const createDifference = (options) => { | ||
const entity = findEntityForDiff(options.propertyName); | ||
@@ -29,1 +29,2 @@ const difference = { | ||
}; | ||
exports.createDifference = createDifference; |
@@ -20,6 +20,6 @@ "use strict"; | ||
const findAddedMethodDifferences = (sourceOperations, destinationOperations) => { | ||
return get_added_keys_from_objects_1.getAddedKeysFromObjects(sourceOperations, destinationOperations) | ||
return (0, get_added_keys_from_objects_1.getAddedKeysFromObjects)(sourceOperations, destinationOperations) | ||
.map((addedMethod) => { | ||
const addedDestinationOperation = destinationOperations[addedMethod]; | ||
return create_difference_1.createDifference({ | ||
return (0, create_difference_1.createDifference)({ | ||
action: 'add', | ||
@@ -34,6 +34,6 @@ destinationSpecOrigins: [addedDestinationOperation.originalValue], | ||
const findRemovedMethodDifferences = (sourceOperations, destinationOperations) => { | ||
return get_removed_keys_from_objects_1.getRemovedKeysFromObjects(sourceOperations, destinationOperations) | ||
return (0, get_removed_keys_from_objects_1.getRemovedKeysFromObjects)(sourceOperations, destinationOperations) | ||
.map((removedMethod) => { | ||
const removedSourceOperation = sourceOperations[removedMethod]; | ||
return create_difference_1.createDifference({ | ||
return (0, create_difference_1.createDifference)({ | ||
action: 'remove', | ||
@@ -48,8 +48,8 @@ destinationSpecOrigins: [], | ||
const findDifferencesInMatchingMethods = (sourceOperations, destinationOperations) => __awaiter(void 0, void 0, void 0, function* () { | ||
const whenDifferencesForAllMatchingMethods = get_common_keys_from_objects_1.getCommonKeysFromObjects(sourceOperations, destinationOperations) | ||
const whenDifferencesForAllMatchingMethods = (0, get_common_keys_from_objects_1.getCommonKeysFromObjects)(sourceOperations, destinationOperations) | ||
.map((matchingMethod) => __awaiter(void 0, void 0, void 0, function* () { | ||
const matchingSourceOperation = sourceOperations[matchingMethod]; | ||
const matchingDestinationOperation = destinationOperations[matchingMethod]; | ||
const requestBodyDifferences = yield find_diffs_in_request_bodies_1.findDifferencesInRequestBodies(matchingSourceOperation.requestBody, matchingDestinationOperation.requestBody); | ||
const responsesDifferences = yield find_diffs_in_responses_1.findDifferencesInResponses(matchingSourceOperation.responses, matchingDestinationOperation.responses); | ||
const requestBodyDifferences = yield (0, find_diffs_in_request_bodies_1.findDifferencesInRequestBodies)(matchingSourceOperation.requestBody, matchingDestinationOperation.requestBody); | ||
const responsesDifferences = yield (0, find_diffs_in_responses_1.findDifferencesInResponses)(matchingSourceOperation.responses, matchingDestinationOperation.responses); | ||
return [ | ||
@@ -64,3 +64,3 @@ ...requestBodyDifferences, | ||
}); | ||
exports.findDifferencesInOperations = (sourceOperations, destinationOperations) => __awaiter(void 0, void 0, void 0, function* () { | ||
const findDifferencesInOperations = (sourceOperations, destinationOperations) => __awaiter(void 0, void 0, void 0, function* () { | ||
const matchingMethodsDifferences = yield findDifferencesInMatchingMethods(sourceOperations, destinationOperations); | ||
@@ -73,1 +73,2 @@ return [ | ||
}); | ||
exports.findDifferencesInOperations = findDifferencesInOperations; |
@@ -20,6 +20,6 @@ "use strict"; | ||
const findAddedPathDifferences = (sourcePathItems, destinationPathItems) => { | ||
return get_added_keys_from_objects_1.getAddedKeysFromObjects(sourcePathItems, destinationPathItems) | ||
return (0, get_added_keys_from_objects_1.getAddedKeysFromObjects)(sourcePathItems, destinationPathItems) | ||
.map((addedPathName) => { | ||
const addedDestinationPathItem = destinationPathItems[addedPathName]; | ||
return create_difference_1.createDifference({ | ||
return (0, create_difference_1.createDifference)({ | ||
action: 'add', | ||
@@ -34,6 +34,6 @@ destinationSpecOrigins: [addedDestinationPathItem.originalValue], | ||
const findRemovedPathDifferences = (sourcePathItems, destinationPathItems) => { | ||
return get_removed_keys_from_objects_1.getRemovedKeysFromObjects(sourcePathItems, destinationPathItems) | ||
return (0, get_removed_keys_from_objects_1.getRemovedKeysFromObjects)(sourcePathItems, destinationPathItems) | ||
.map((removedPathName) => { | ||
const removedSourcePathItem = sourcePathItems[removedPathName]; | ||
return create_difference_1.createDifference({ | ||
return (0, create_difference_1.createDifference)({ | ||
action: 'remove', | ||
@@ -48,4 +48,4 @@ destinationSpecOrigins: [], | ||
const findDifferencesInMatchingPaths = (sourcePathItems, destinationPathItems) => __awaiter(void 0, void 0, void 0, function* () { | ||
const matchingPaths = get_common_keys_from_objects_1.getCommonKeysFromObjects(sourcePathItems, destinationPathItems); | ||
const whenFindDifferencesInAllOperations = matchingPaths.map((matchingPathItem) => find_diffs_in_operations_1.findDifferencesInOperations(sourcePathItems[matchingPathItem].operations, destinationPathItems[matchingPathItem].operations)); | ||
const matchingPaths = (0, get_common_keys_from_objects_1.getCommonKeysFromObjects)(sourcePathItems, destinationPathItems); | ||
const whenFindDifferencesInAllOperations = matchingPaths.map((matchingPathItem) => (0, find_diffs_in_operations_1.findDifferencesInOperations)(sourcePathItems[matchingPathItem].operations, destinationPathItems[matchingPathItem].operations)); | ||
const differencesByOperation = yield Promise.all(whenFindDifferencesInAllOperations); | ||
@@ -57,7 +57,7 @@ const flattenDifferences = differencesByOperation.reduce((allDifferences, operationDifferences) => [...allDifferences, ...operationDifferences], []); | ||
const parsedPathItem = parsedPathItems[pathName]; | ||
const normalizedPathName = normalize_path_1.normalizePath(pathName); | ||
const normalizedPathName = (0, normalize_path_1.normalizePath)(pathName); | ||
normalizedParsedPathItems[normalizedPathName] = parsedPathItem; | ||
return normalizedParsedPathItems; | ||
}, {}); | ||
exports.findDiffsInPaths = (sourcePathItems, destinationPathItems) => __awaiter(void 0, void 0, void 0, function* () { | ||
const findDiffsInPaths = (sourcePathItems, destinationPathItems) => __awaiter(void 0, void 0, void 0, function* () { | ||
const normalizedSourcePathItems = normalizePathItems(sourcePathItems); | ||
@@ -70,1 +70,2 @@ const normalizedDestinationPathItems = normalizePathItems(destinationPathItems); | ||
}); | ||
exports.findDiffsInPaths = findDiffsInPaths; |
@@ -15,4 +15,4 @@ "use strict"; | ||
const json_schema_diff_1 = require("./json-schema-diff"); | ||
exports.findDifferencesInRequestBodies = (sourceRequestBody, destinationRequestBody) => __awaiter(void 0, void 0, void 0, function* () { | ||
const diffResults = yield json_schema_diff_1.getSchemaDifferences(sourceRequestBody, destinationRequestBody); | ||
const findDifferencesInRequestBodies = (sourceRequestBody, destinationRequestBody) => __awaiter(void 0, void 0, void 0, function* () { | ||
const diffResults = yield (0, json_schema_diff_1.getSchemaDifferences)(sourceRequestBody, destinationRequestBody); | ||
const requestBodyScopeOptions = { | ||
@@ -27,5 +27,6 @@ addedJsonSchema: diffResults.addedJsonSchema, | ||
}; | ||
const addedScopeDifferences = get_scope_differences_1.getScopeAddDifferences(requestBodyScopeOptions); | ||
const removedScopeDifferences = get_scope_differences_1.getScopeRemoveDifferences(requestBodyScopeOptions); | ||
const addedScopeDifferences = (0, get_scope_differences_1.getScopeAddDifferences)(requestBodyScopeOptions); | ||
const removedScopeDifferences = (0, get_scope_differences_1.getScopeRemoveDifferences)(requestBodyScopeOptions); | ||
return [...addedScopeDifferences, ...removedScopeDifferences]; | ||
}); | ||
exports.findDifferencesInRequestBodies = findDifferencesInRequestBodies; |
@@ -15,4 +15,4 @@ "use strict"; | ||
const json_schema_diff_1 = require("./json-schema-diff"); | ||
exports.findDifferencesInResponseBodies = (sourceResponseBody, destinationResponseBody) => __awaiter(void 0, void 0, void 0, function* () { | ||
const diffResults = yield json_schema_diff_1.getSchemaDifferences(sourceResponseBody, destinationResponseBody); | ||
const findDifferencesInResponseBodies = (sourceResponseBody, destinationResponseBody) => __awaiter(void 0, void 0, void 0, function* () { | ||
const diffResults = yield (0, json_schema_diff_1.getSchemaDifferences)(sourceResponseBody, destinationResponseBody); | ||
const responseBodyScopeOptions = { | ||
@@ -27,5 +27,6 @@ addedJsonSchema: diffResults.addedJsonSchema, | ||
}; | ||
const addedScopeDifferences = get_scope_differences_1.getScopeAddDifferences(responseBodyScopeOptions); | ||
const removedScopeDifferences = get_scope_differences_1.getScopeRemoveDifferences(responseBodyScopeOptions); | ||
const addedScopeDifferences = (0, get_scope_differences_1.getScopeAddDifferences)(responseBodyScopeOptions); | ||
const removedScopeDifferences = (0, get_scope_differences_1.getScopeRemoveDifferences)(responseBodyScopeOptions); | ||
return [...addedScopeDifferences, ...removedScopeDifferences]; | ||
}); | ||
exports.findDifferencesInResponseBodies = findDifferencesInResponseBodies; |
@@ -14,3 +14,3 @@ "use strict"; | ||
const createAddHeaderDifference = (header) => { | ||
return create_difference_1.createDifference({ | ||
return (0, create_difference_1.createDifference)({ | ||
action: 'add', | ||
@@ -24,3 +24,3 @@ destinationSpecOrigins: [header.originalValue], | ||
const createRemoveHeaderDifference = (header) => { | ||
return create_difference_1.createDifference({ | ||
return (0, create_difference_1.createDifference)({ | ||
action: 'remove', | ||
@@ -34,3 +34,3 @@ destinationSpecOrigins: [], | ||
const findAddedDifferencesInHeaders = (sourceResponseHeaders, destinationResponseHeaders) => { | ||
const addedHeaders = get_added_keys_from_objects_1.getAddedKeysFromObjects(sourceResponseHeaders, destinationResponseHeaders); | ||
const addedHeaders = (0, get_added_keys_from_objects_1.getAddedKeysFromObjects)(sourceResponseHeaders, destinationResponseHeaders); | ||
return addedHeaders.map((headerName) => { | ||
@@ -49,3 +49,3 @@ const addedHeader = destinationResponseHeaders[headerName]; | ||
const findDifferencesinMatchingHeaders = (sourceResponseHeaders, destinationResponseHeaders) => { | ||
const matchingHeaders = get_common_keys_from_objects_1.getCommonKeysFromObjects(sourceResponseHeaders, destinationResponseHeaders); | ||
const matchingHeaders = (0, get_common_keys_from_objects_1.getCommonKeysFromObjects)(sourceResponseHeaders, destinationResponseHeaders); | ||
return matchingHeaders.reduce((accumulator, headerName) => { | ||
@@ -59,3 +59,3 @@ const sourceMatchingHeader = sourceResponseHeaders[headerName]; | ||
const findRemovedDifferencesInHeaders = (sourceResponseHeaders, destinationResponseHeaders) => { | ||
const removedHeaders = get_removed_keys_from_objects_1.getRemovedKeysFromObjects(sourceResponseHeaders, destinationResponseHeaders); | ||
const removedHeaders = (0, get_removed_keys_from_objects_1.getRemovedKeysFromObjects)(sourceResponseHeaders, destinationResponseHeaders); | ||
return removedHeaders.map((headerName) => { | ||
@@ -73,3 +73,3 @@ const removedHeader = sourceResponseHeaders[headerName]; | ||
}; | ||
exports.findDifferencesInResponseHeaders = (sourceResponseHeaders, destinationResponseHeaders) => { | ||
const findDifferencesInResponseHeaders = (sourceResponseHeaders, destinationResponseHeaders) => { | ||
const normalizedSourceResponseHeaders = normalizeHeaders(sourceResponseHeaders); | ||
@@ -82,1 +82,2 @@ const normalizedDestinationResponseHeaders = normalizeHeaders(destinationResponseHeaders); | ||
}; | ||
exports.findDifferencesInResponseHeaders = findDifferencesInResponseHeaders; |
@@ -20,6 +20,6 @@ "use strict"; | ||
const findAddedDifferencesInResponses = (sourceResponses, destinationResponses) => { | ||
const addedResponses = get_added_keys_from_objects_1.getAddedKeysFromObjects(sourceResponses, destinationResponses); | ||
const addedResponses = (0, get_added_keys_from_objects_1.getAddedKeysFromObjects)(sourceResponses, destinationResponses); | ||
return addedResponses.map((statusCode) => { | ||
const parsedResponse = destinationResponses[statusCode]; | ||
return create_difference_1.createDifference({ | ||
return (0, create_difference_1.createDifference)({ | ||
action: 'add', | ||
@@ -34,6 +34,6 @@ destinationSpecOrigins: [parsedResponse.originalValue], | ||
const findRemovedDifferencesInResponses = (sourceResponses, destinationResponses) => { | ||
const removedResponses = get_removed_keys_from_objects_1.getRemovedKeysFromObjects(sourceResponses, destinationResponses); | ||
const removedResponses = (0, get_removed_keys_from_objects_1.getRemovedKeysFromObjects)(sourceResponses, destinationResponses); | ||
return removedResponses.map((statusCode) => { | ||
const parsedResponse = sourceResponses[statusCode]; | ||
return create_difference_1.createDifference({ | ||
return (0, create_difference_1.createDifference)({ | ||
action: 'remove', | ||
@@ -48,8 +48,8 @@ destinationSpecOrigins: [], | ||
const findDifferencesInMatchingResponses = (sourceResponses, destinationResponses) => __awaiter(void 0, void 0, void 0, function* () { | ||
const whenDifferencesForAllMatchingResponses = get_common_keys_from_objects_1.getCommonKeysFromObjects(sourceResponses, destinationResponses) | ||
const whenDifferencesForAllMatchingResponses = (0, get_common_keys_from_objects_1.getCommonKeysFromObjects)(sourceResponses, destinationResponses) | ||
.map((matchingResponse) => __awaiter(void 0, void 0, void 0, function* () { | ||
const matchingSourceResponse = sourceResponses[matchingResponse]; | ||
const matchingDestinationResponse = destinationResponses[matchingResponse]; | ||
const responseBodiesDifferences = yield find_diffs_in_response_bodies_1.findDifferencesInResponseBodies(matchingSourceResponse, matchingDestinationResponse); | ||
const responseHeadersDifferences = find_diffs_in_response_headers_1.findDifferencesInResponseHeaders(matchingSourceResponse.headers, matchingDestinationResponse.headers); | ||
const responseBodiesDifferences = yield (0, find_diffs_in_response_bodies_1.findDifferencesInResponseBodies)(matchingSourceResponse, matchingDestinationResponse); | ||
const responseHeadersDifferences = (0, find_diffs_in_response_headers_1.findDifferencesInResponseHeaders)(matchingSourceResponse.headers, matchingDestinationResponse.headers); | ||
return [...responseBodiesDifferences, ...responseHeadersDifferences]; | ||
@@ -61,3 +61,3 @@ })); | ||
}); | ||
exports.findDifferencesInResponses = (sourceResponses, destinationResponses) => __awaiter(void 0, void 0, void 0, function* () { | ||
const findDifferencesInResponses = (sourceResponses, destinationResponses) => __awaiter(void 0, void 0, void 0, function* () { | ||
const matchingResponsesDifferences = yield findDifferencesInMatchingResponses(sourceResponses, destinationResponses); | ||
@@ -70,1 +70,2 @@ return [ | ||
}); | ||
exports.findDifferencesInResponses = findDifferencesInResponses; |
@@ -15,3 +15,3 @@ "use strict"; | ||
if (isAddition) { | ||
return [create_difference_1.createDifference({ | ||
return [(0, create_difference_1.createDifference)({ | ||
action: 'add', | ||
@@ -29,3 +29,3 @@ destinationSpecOrigins: [destinationObject], | ||
if (isDeletion) { | ||
return [create_difference_1.createDifference({ | ||
return [(0, create_difference_1.createDifference)({ | ||
action: 'remove', | ||
@@ -45,3 +45,3 @@ destinationSpecOrigins: [], | ||
return [ | ||
create_difference_1.createDifference({ | ||
(0, create_difference_1.createDifference)({ | ||
action: 'add', | ||
@@ -53,3 +53,3 @@ destinationSpecOrigins: [destinationObject], | ||
}), | ||
create_difference_1.createDifference({ | ||
(0, create_difference_1.createDifference)({ | ||
action: 'remove', | ||
@@ -74,3 +74,3 @@ destinationSpecOrigins: [destinationObject], | ||
}; | ||
exports.findDiffsInXProperties = (sourceParsedXProperties, destinationParsedXProperties, xPropertyContainerName) => { | ||
const findDiffsInXProperties = (sourceParsedXProperties, destinationParsedXProperties, xPropertyContainerName) => { | ||
const xPropertyUniqueNames = _(_.keys(sourceParsedXProperties)) | ||
@@ -88,1 +88,2 @@ .concat(_.keys(destinationParsedXProperties)) | ||
}; | ||
exports.findDiffsInXProperties = findDiffsInXProperties; |
@@ -24,3 +24,3 @@ "use strict"; | ||
}; | ||
const createScopeDifference = (options) => create_difference_1.createDifference({ | ||
const createScopeDifference = (options) => (0, create_difference_1.createDifference)({ | ||
action: options.action, | ||
@@ -35,3 +35,3 @@ destinationSpecOrigins: createSpecOrigins(options.destinationParsedScope), | ||
}); | ||
exports.getScopeAddDifferences = (options) => { | ||
const getScopeAddDifferences = (options) => { | ||
if (!options.additionsFound) { | ||
@@ -50,3 +50,4 @@ return []; | ||
}; | ||
exports.getScopeRemoveDifferences = (options) => { | ||
exports.getScopeAddDifferences = getScopeAddDifferences; | ||
const getScopeRemoveDifferences = (options) => { | ||
if (!options.removalsFound) { | ||
@@ -65,1 +66,2 @@ return []; | ||
}; | ||
exports.getScopeRemoveDifferences = getScopeRemoveDifferences; |
@@ -15,3 +15,3 @@ "use strict"; | ||
const open_api_diff_error_impl_1 = require("../../../common/open-api-diff-error-impl"); | ||
exports.getJsonSchemaForDiffing = (parsedScope) => { | ||
const getJsonSchemaForDiffing = (parsedScope) => { | ||
return parsedScope.jsonSchema | ||
@@ -21,7 +21,8 @@ ? parsedScope.jsonSchema.schema | ||
}; | ||
exports.getSchemaDifferences = (sourceParsedScope, destinationParsedScope) => __awaiter(void 0, void 0, void 0, function* () { | ||
exports.getJsonSchemaForDiffing = getJsonSchemaForDiffing; | ||
const getSchemaDifferences = (sourceParsedScope, destinationParsedScope) => __awaiter(void 0, void 0, void 0, function* () { | ||
try { | ||
return yield JsonSchemaDiff.diffSchemas({ | ||
destinationSchema: exports.getJsonSchemaForDiffing(destinationParsedScope), | ||
sourceSchema: exports.getJsonSchemaForDiffing(sourceParsedScope) | ||
destinationSchema: (0, exports.getJsonSchemaForDiffing)(destinationParsedScope), | ||
sourceSchema: (0, exports.getJsonSchemaForDiffing)(sourceParsedScope) | ||
}); | ||
@@ -33,1 +34,2 @@ } | ||
}); | ||
exports.getSchemaDifferences = getSchemaDifferences; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.normalizePath = void 0; | ||
exports.normalizePath = (originalPath) => { | ||
const normalizePath = (originalPath) => { | ||
let normalizedPath = ''; | ||
@@ -21,1 +21,2 @@ const substitutions = {}; | ||
}; | ||
exports.normalizePath = normalizePath; |
@@ -16,3 +16,3 @@ "use strict"; | ||
try { | ||
return yaml.safeLoad(content); | ||
return yaml.load(content); | ||
} | ||
@@ -19,0 +19,0 @@ catch (error) { |
@@ -20,3 +20,3 @@ "use strict"; | ||
static parse(spec) { | ||
const specFormat = resolve_spec_format_1.resolveSpecFormat(spec); | ||
const specFormat = (0, resolve_spec_format_1.resolveSpecFormat)(spec); | ||
return specFormat === 'swagger2' | ||
@@ -28,4 +28,4 @@ ? this.validateAndParseSwagger2(spec.content, spec.location) | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const spec = yield validate_and_dereference_swagger2_spec_1.validateAndDereferenceSwagger2Spec(content, location); | ||
return parse_swagger2_spec_1.parseSwagger2Spec(spec); | ||
const spec = yield (0, validate_and_dereference_swagger2_spec_1.validateAndDereferenceSwagger2Spec)(content, location); | ||
return (0, parse_swagger2_spec_1.parseSwagger2Spec)(spec); | ||
}); | ||
@@ -35,4 +35,4 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const spec = yield validate_and_dereference_openapi3_spec_1.validateAndDereferenceOpenapi3Spec(content, location); | ||
return parse_openapi3_spec_1.parseOpenApi3Spec(spec); | ||
const spec = yield (0, validate_and_dereference_openapi3_spec_1.validateAndDereferenceOpenapi3Spec)(content, location); | ||
return (0, parse_openapi3_spec_1.parseOpenApi3Spec)(spec); | ||
}); | ||
@@ -39,0 +39,0 @@ } |
@@ -33,5 +33,6 @@ "use strict"; | ||
}; | ||
exports.dereferenceObject = (objectOrReference, spec) => { | ||
const dereferenceObject = (objectOrReference, spec) => { | ||
const initialVisitedReferencesArray = []; | ||
return dereference(objectOrReference, spec, initialVisitedReferencesArray); | ||
}; | ||
exports.dereferenceObject = dereferenceObject; |
@@ -7,3 +7,3 @@ "use strict"; | ||
}; | ||
exports.parseXPropertiesInObject = (object, pathBuilder) => { | ||
const parseXPropertiesInObject = (object, pathBuilder) => { | ||
return Object.keys(object) | ||
@@ -19,1 +19,2 @@ .filter(isXProperty) | ||
}; | ||
exports.parseXPropertiesInObject = parseXPropertiesInObject; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toDiffCompatibleJsonSchemaMap = exports.toDiffCompatibleJsonSchema = void 0; | ||
const toDiffCompatibleJsonSchemaArray = (schemaArray) => schemaArray.map((schemaEntry) => exports.toDiffCompatibleJsonSchema(schemaEntry)); | ||
const toDiffCompatibleJsonSchemaArray = (schemaArray) => schemaArray.map((schemaEntry) => (0, exports.toDiffCompatibleJsonSchema)(schemaEntry)); | ||
const toDiffCompatibleJsonSchemaOrArray = (schemaOrArray) => { | ||
return Array.isArray(schemaOrArray) | ||
? toDiffCompatibleJsonSchemaArray(schemaOrArray) | ||
: exports.toDiffCompatibleJsonSchema(schemaOrArray); | ||
: (0, exports.toDiffCompatibleJsonSchema)(schemaOrArray); | ||
}; | ||
@@ -13,3 +13,3 @@ const toDiffCompatibleAdditionalProperties = (schema) => { | ||
? schema | ||
: exports.toDiffCompatibleJsonSchema(schema); | ||
: (0, exports.toDiffCompatibleJsonSchema)(schema); | ||
}; | ||
@@ -32,5 +32,5 @@ const toDiffCompatibleNumberBoundary = (exclusive, boundary) => { | ||
case 'not': | ||
return exports.toDiffCompatibleJsonSchema(schemaProperty); | ||
return (0, exports.toDiffCompatibleJsonSchema)(schemaProperty); | ||
case 'properties': | ||
return exports.toDiffCompatibleJsonSchemaMap(schemaProperty); | ||
return (0, exports.toDiffCompatibleJsonSchemaMap)(schemaProperty); | ||
case 'allOf': | ||
@@ -44,3 +44,3 @@ case 'anyOf': | ||
}; | ||
exports.toDiffCompatibleJsonSchema = (schema) => { | ||
const toDiffCompatibleJsonSchema = (schema) => { | ||
const compatibleJsonSchema = {}; | ||
@@ -52,8 +52,10 @@ for (const propertyName of Object.keys(schema)) { | ||
}; | ||
exports.toDiffCompatibleJsonSchemaMap = (schemaMap) => { | ||
exports.toDiffCompatibleJsonSchema = toDiffCompatibleJsonSchema; | ||
const toDiffCompatibleJsonSchemaMap = (schemaMap) => { | ||
const compatibleJsonSchemaMap = {}; | ||
for (const propertyName of Object.keys(schemaMap)) { | ||
compatibleJsonSchemaMap[propertyName] = exports.toDiffCompatibleJsonSchema(schemaMap[propertyName]); | ||
compatibleJsonSchemaMap[propertyName] = (0, exports.toDiffCompatibleJsonSchema)(schemaMap[propertyName]); | ||
} | ||
return compatibleJsonSchemaMap; | ||
}; | ||
exports.toDiffCompatibleJsonSchemaMap = toDiffCompatibleJsonSchemaMap; |
@@ -15,3 +15,3 @@ "use strict"; | ||
const open_api_diff_error_impl_1 = require("../../../common/open-api-diff-error-impl"); | ||
exports.validateAndDereferenceSpec = (spec, location) => __awaiter(void 0, void 0, void 0, function* () { | ||
const validateAndDereferenceSpec = (spec, location) => __awaiter(void 0, void 0, void 0, function* () { | ||
try { | ||
@@ -27,1 +27,2 @@ const options = { | ||
}); | ||
exports.validateAndDereferenceSpec = validateAndDereferenceSpec; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isOpenApi3Content = void 0; | ||
exports.isOpenApi3Content = (specContent) => { | ||
const isOpenApi3Content = (specContent) => { | ||
const openApiProperty = specContent.openapi; | ||
return typeof openApiProperty === 'string' && openApiProperty.indexOf('3.') === 0; | ||
}; | ||
exports.isOpenApi3Content = isOpenApi3Content; |
@@ -11,3 +11,3 @@ "use strict"; | ||
}, | ||
schema: to_diff_ready_openapi3_schema_1.toDiffReadyOpenApi3Schema(bodyObjectSchema, spec) | ||
schema: (0, to_diff_ready_openapi3_schema_1.toDiffReadyOpenApi3Schema)(bodyObjectSchema, spec) | ||
}; | ||
@@ -23,3 +23,3 @@ }; | ||
}; | ||
exports.parseOpenApi3BodyObjectJsonSchema = (bodyObject, pathBuilder, spec) => { | ||
const parseOpenApi3BodyObjectJsonSchema = (bodyObject, pathBuilder, spec) => { | ||
const bodyObjectSchema = getSchemaFromBodyObject(bodyObject); | ||
@@ -31,1 +31,2 @@ const bodyObjectPath = getPathForBodyObject(pathBuilder); | ||
}; | ||
exports.parseOpenApi3BodyObjectJsonSchema = parseOpenApi3BodyObjectJsonSchema; |
@@ -7,4 +7,4 @@ "use strict"; | ||
const parseOperation = (operation, pathBuilder, spec) => { | ||
const requestBody = parse_openapi3_request_body_1.parseOpenApi3RequestBody(operation.requestBody, pathBuilder.withChild('requestBody'), spec); | ||
const responses = parse_openapi3_responses_1.parseOpenApi3Responses(operation.responses, pathBuilder.withChild('responses'), spec); | ||
const requestBody = (0, parse_openapi3_request_body_1.parseOpenApi3RequestBody)(operation.requestBody, pathBuilder.withChild('requestBody'), spec); | ||
const responses = (0, parse_openapi3_responses_1.parseOpenApi3Responses)(operation.responses, pathBuilder.withChild('responses'), spec); | ||
return { | ||
@@ -30,3 +30,3 @@ originalValue: { | ||
const isOpenApi3Method = (propertyName) => Object.keys(typeCheckedOpenApi3Methods).indexOf(propertyName) >= 0; | ||
exports.parseOpenApi3Operations = (pathItemObject, pathBuilder, spec) => { | ||
const parseOpenApi3Operations = (pathItemObject, pathBuilder, spec) => { | ||
return Object.keys(pathItemObject) | ||
@@ -41,1 +41,2 @@ .filter(isOpenApi3Method) | ||
}; | ||
exports.parseOpenApi3Operations = parseOpenApi3Operations; |
@@ -7,3 +7,3 @@ "use strict"; | ||
return { | ||
operations: parse_openapi3_operations_1.parseOpenApi3Operations(path, pathBuilder, spec), | ||
operations: (0, parse_openapi3_operations_1.parseOpenApi3Operations)(path, pathBuilder, spec), | ||
originalValue: { | ||
@@ -15,3 +15,3 @@ originalPath: pathBuilder.build(), | ||
}; | ||
exports.parseOpenApi3Paths = (paths, pathBuilder, spec) => Object.keys(paths).reduce((accumulator, pathName) => { | ||
const parseOpenApi3Paths = (paths, pathBuilder, spec) => Object.keys(paths).reduce((accumulator, pathName) => { | ||
const pathItemObject = paths[pathName]; | ||
@@ -22,1 +22,2 @@ const originalPath = pathBuilder.withChild(pathName); | ||
}, {}); | ||
exports.parseOpenApi3Paths = parseOpenApi3Paths; |
@@ -7,4 +7,4 @@ "use strict"; | ||
const toParsedRequestBody = (requestBodyOrReference, pathBuilder, spec) => { | ||
const requestBody = dereference_object_1.dereferenceObject(requestBodyOrReference, spec); | ||
const jsonSchema = parse_openapi3_body_object_json_schema_1.parseOpenApi3BodyObjectJsonSchema(requestBody, pathBuilder, spec); | ||
const requestBody = (0, dereference_object_1.dereferenceObject)(requestBodyOrReference, spec); | ||
const jsonSchema = (0, parse_openapi3_body_object_json_schema_1.parseOpenApi3BodyObjectJsonSchema)(requestBody, pathBuilder, spec); | ||
return { | ||
@@ -26,3 +26,3 @@ jsonSchema, | ||
}; | ||
exports.parseOpenApi3RequestBody = (requestBodyOrReference, pathBuilder, spec) => { | ||
const parseOpenApi3RequestBody = (requestBodyOrReference, pathBuilder, spec) => { | ||
return requestBodyOrReference | ||
@@ -32,1 +32,2 @@ ? toParsedRequestBody(requestBodyOrReference, pathBuilder, spec) | ||
}; | ||
exports.parseOpenApi3RequestBody = parseOpenApi3RequestBody; |
@@ -34,3 +34,3 @@ "use strict"; | ||
}; | ||
exports.parseOpenApi3ResponseHeaders = (response, pathBuilder) => { | ||
const parseOpenApi3ResponseHeaders = (response, pathBuilder) => { | ||
const headers = response.headers || {}; | ||
@@ -40,1 +40,2 @@ const originalPath = pathBuilder.withChild('headers'); | ||
}; | ||
exports.parseOpenApi3ResponseHeaders = parseOpenApi3ResponseHeaders; |
@@ -8,6 +8,6 @@ "use strict"; | ||
const parseResponse = (responseOrReference, pathBuilder, spec) => { | ||
const response = dereference_object_1.dereferenceObject(responseOrReference, spec); | ||
const response = (0, dereference_object_1.dereferenceObject)(responseOrReference, spec); | ||
return { | ||
headers: parse_openapi3_response_headers_1.parseOpenApi3ResponseHeaders(response, pathBuilder), | ||
jsonSchema: parse_openapi3_body_object_json_schema_1.parseOpenApi3BodyObjectJsonSchema(response, pathBuilder, spec), | ||
headers: (0, parse_openapi3_response_headers_1.parseOpenApi3ResponseHeaders)(response, pathBuilder), | ||
jsonSchema: (0, parse_openapi3_body_object_json_schema_1.parseOpenApi3BodyObjectJsonSchema)(response, pathBuilder, spec), | ||
originalValue: { | ||
@@ -19,3 +19,3 @@ originalPath: pathBuilder.build(), | ||
}; | ||
exports.parseOpenApi3Responses = (responses, pathBuilder, spec) => { | ||
const parseOpenApi3Responses = (responses, pathBuilder, spec) => { | ||
return Object.keys(responses).reduce((accumulator, statusCode) => { | ||
@@ -27,1 +27,2 @@ const originalPath = pathBuilder.withChild(statusCode); | ||
}; | ||
exports.parseOpenApi3Responses = parseOpenApi3Responses; |
@@ -10,6 +10,7 @@ "use strict"; | ||
}; | ||
exports.toDiffReadyOpenApi3Schema = (schema, spec) => { | ||
const compatibleReferenceSources = to_diff_compatible_json_schema_1.toDiffCompatibleJsonSchemaMap(getReferenceSources(spec)); | ||
const compatibleSchema = to_diff_compatible_json_schema_1.toDiffCompatibleJsonSchema(schema); | ||
const toDiffReadyOpenApi3Schema = (schema, spec) => { | ||
const compatibleReferenceSources = (0, to_diff_compatible_json_schema_1.toDiffCompatibleJsonSchemaMap)(getReferenceSources(spec)); | ||
const compatibleSchema = (0, to_diff_compatible_json_schema_1.toDiffCompatibleJsonSchema)(schema); | ||
return Object.assign(Object.assign({}, compatibleSchema), { components: { schemas: compatibleReferenceSources } }); | ||
}; | ||
exports.toDiffReadyOpenApi3Schema = toDiffReadyOpenApi3Schema; |
@@ -7,9 +7,10 @@ "use strict"; | ||
const parse_openapi3_paths_1 = require("./openapi3/parse-openapi3-paths"); | ||
exports.parseOpenApi3Spec = (spec) => { | ||
const parseOpenApi3Spec = (spec) => { | ||
const pathBuilder = path_builder_1.PathBuilder.createRootPathBuilder(); | ||
return { | ||
format: 'openapi3', | ||
paths: parse_openapi3_paths_1.parseOpenApi3Paths(spec.paths, pathBuilder.withChild('paths'), spec), | ||
xProperties: parse_x_properties_1.parseXPropertiesInObject(spec, pathBuilder) | ||
paths: (0, parse_openapi3_paths_1.parseOpenApi3Paths)(spec.paths, pathBuilder.withChild('paths'), spec), | ||
xProperties: (0, parse_x_properties_1.parseXPropertiesInObject)(spec, pathBuilder) | ||
}; | ||
}; | ||
exports.parseOpenApi3Spec = parseOpenApi3Spec; |
@@ -7,9 +7,10 @@ "use strict"; | ||
const parse_swagger2_paths_1 = require("./swagger2/parse-swagger2-paths"); | ||
exports.parseSwagger2Spec = (spec) => { | ||
const parseSwagger2Spec = (spec) => { | ||
const pathBuilder = path_builder_1.PathBuilder.createRootPathBuilder(); | ||
return { | ||
format: 'swagger2', | ||
paths: parse_swagger2_paths_1.parseSwagger2Paths(spec.paths, pathBuilder.withChild('paths'), spec), | ||
xProperties: parse_x_properties_1.parseXPropertiesInObject(spec, pathBuilder) | ||
paths: (0, parse_swagger2_paths_1.parseSwagger2Paths)(spec.paths, pathBuilder.withChild('paths'), spec), | ||
xProperties: (0, parse_x_properties_1.parseXPropertiesInObject)(spec, pathBuilder) | ||
}; | ||
}; | ||
exports.parseSwagger2Spec = parseSwagger2Spec; |
@@ -6,3 +6,3 @@ "use strict"; | ||
const is_swagger2_content_1 = require("./swagger2/is-swagger2-content"); | ||
const detectContentFormat = (specContent) => is_swagger2_content_1.isSwagger2Content(specContent) ? 'swagger2' : 'openapi3'; | ||
const detectContentFormat = (specContent) => (0, is_swagger2_content_1.isSwagger2Content)(specContent) ? 'swagger2' : 'openapi3'; | ||
const typeSafeSupportedFormats = { | ||
@@ -22,4 +22,5 @@ openapi3: null, | ||
const isAutoDetect = (unverifiedFormat) => unverifiedFormat === autoDetectFormat; | ||
exports.resolveSpecFormat = (spec) => isAutoDetect(spec.unverifiedFormat) | ||
const resolveSpecFormat = (spec) => isAutoDetect(spec.unverifiedFormat) | ||
? detectContentFormat(spec.content) | ||
: toVerifiedFormat(spec); | ||
exports.resolveSpecFormat = resolveSpecFormat; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isSwagger2Content = void 0; | ||
exports.isSwagger2Content = (specContent) => specContent.hasOwnProperty('swagger'); | ||
const isSwagger2Content = (specContent) => specContent.hasOwnProperty('swagger'); | ||
exports.isSwagger2Content = isSwagger2Content; |
@@ -11,6 +11,6 @@ "use strict"; | ||
}, | ||
schema: to_diff_ready_swagger2_schema_1.toDiffReadySwagger2Schema(schema, spec) | ||
schema: (0, to_diff_ready_swagger2_schema_1.toDiffReadySwagger2Schema)(schema, spec) | ||
}; | ||
}; | ||
exports.parseSwagger2BodyObjectJsonSchema = (bodyObject, pathBuilder, spec) => { | ||
const parseSwagger2BodyObjectJsonSchema = (bodyObject, pathBuilder, spec) => { | ||
return bodyObject.schema | ||
@@ -20,1 +20,2 @@ ? toParsedJsonSchema(bodyObject.schema, pathBuilder, spec) | ||
}; | ||
exports.parseSwagger2BodyObjectJsonSchema = parseSwagger2BodyObjectJsonSchema; |
@@ -8,6 +8,6 @@ "use strict"; | ||
return bodyParameter | ||
? parse_swagger2_body_object_json_schema_1.parseSwagger2BodyObjectJsonSchema(bodyParameter, pathBuilder, spec) | ||
? (0, parse_swagger2_body_object_json_schema_1.parseSwagger2BodyObjectJsonSchema)(bodyParameter, pathBuilder, spec) | ||
: undefined; | ||
}; | ||
const resolveParameters = (parameterOrReferenceArray, spec) => parameterOrReferenceArray.map((entry) => dereference_object_1.dereferenceObject(entry, spec)); | ||
const resolveParameters = (parameterOrReferenceArray, spec) => parameterOrReferenceArray.map((entry) => (0, dereference_object_1.dereferenceObject)(entry, spec)); | ||
const findBodyParameterAndIndex = (parameters, spec) => { | ||
@@ -18,3 +18,3 @@ const resolvedParameters = resolveParameters(parameters, spec); | ||
}; | ||
exports.parseSwagger2BodyParameter = (parameters, pathBuilder, spec) => { | ||
const parseSwagger2BodyParameter = (parameters, pathBuilder, spec) => { | ||
const { bodyParameter, index } = findBodyParameterAndIndex(parameters, spec); | ||
@@ -30,1 +30,2 @@ const jsonSchema = parseBodyParameterJsonSchema(bodyParameter, pathBuilder.withChild(`${index}`), spec); | ||
}; | ||
exports.parseSwagger2BodyParameter = parseSwagger2BodyParameter; |
@@ -8,4 +8,4 @@ "use strict"; | ||
const parameters = operation.parameters || []; | ||
const requestBody = parse_swagger2_body_parameter_1.parseSwagger2BodyParameter(parameters, pathBuilder.withChild('parameters'), spec); | ||
const responses = parse_swagger2_responses_1.parseSwagger2Responses(operation.responses, pathBuilder.withChild('responses'), spec); | ||
const requestBody = (0, parse_swagger2_body_parameter_1.parseSwagger2BodyParameter)(parameters, pathBuilder.withChild('parameters'), spec); | ||
const responses = (0, parse_swagger2_responses_1.parseSwagger2Responses)(operation.responses, pathBuilder.withChild('responses'), spec); | ||
return { | ||
@@ -30,3 +30,3 @@ originalValue: { | ||
const isSwagger2Method = (propertyName) => Object.keys(typeCheckedSwagger2Methods).indexOf(propertyName) >= 0; | ||
exports.parseSwagger2Operations = (pathItemObject, pathBuilder, spec) => { | ||
const parseSwagger2Operations = (pathItemObject, pathBuilder, spec) => { | ||
return Object.keys(pathItemObject) | ||
@@ -41,1 +41,2 @@ .filter(isSwagger2Method) | ||
}; | ||
exports.parseSwagger2Operations = parseSwagger2Operations; |
@@ -7,3 +7,3 @@ "use strict"; | ||
return { | ||
operations: parse_swagger2_operations_1.parseSwagger2Operations(path, pathBuilder, spec), | ||
operations: (0, parse_swagger2_operations_1.parseSwagger2Operations)(path, pathBuilder, spec), | ||
originalValue: { | ||
@@ -15,3 +15,3 @@ originalPath: pathBuilder.build(), | ||
}; | ||
exports.parseSwagger2Paths = (paths, pathBuilder, spec) => Object.keys(paths).reduce((accumulator, pathName) => { | ||
const parseSwagger2Paths = (paths, pathBuilder, spec) => Object.keys(paths).reduce((accumulator, pathName) => { | ||
const pathItemObject = paths[pathName]; | ||
@@ -22,1 +22,2 @@ const originalPath = pathBuilder.withChild(pathName); | ||
}, {}); | ||
exports.parseSwagger2Paths = parseSwagger2Paths; |
@@ -25,3 +25,3 @@ "use strict"; | ||
}; | ||
exports.parseSwagger2ResponseHeaders = (response, pathBuilder) => { | ||
const parseSwagger2ResponseHeaders = (response, pathBuilder) => { | ||
const headers = response.headers || {}; | ||
@@ -31,1 +31,2 @@ const originalPath = pathBuilder.withChild('headers'); | ||
}; | ||
exports.parseSwagger2ResponseHeaders = parseSwagger2ResponseHeaders; |
@@ -8,6 +8,6 @@ "use strict"; | ||
const parseResponse = (responseOrReference, pathBuilder, spec) => { | ||
const response = dereference_object_1.dereferenceObject(responseOrReference, spec); | ||
const response = (0, dereference_object_1.dereferenceObject)(responseOrReference, spec); | ||
return { | ||
headers: parse_swagger2_response_headers_1.parseSwagger2ResponseHeaders(response, pathBuilder), | ||
jsonSchema: parse_swagger2_body_object_json_schema_1.parseSwagger2BodyObjectJsonSchema(response, pathBuilder, spec), | ||
headers: (0, parse_swagger2_response_headers_1.parseSwagger2ResponseHeaders)(response, pathBuilder), | ||
jsonSchema: (0, parse_swagger2_body_object_json_schema_1.parseSwagger2BodyObjectJsonSchema)(response, pathBuilder, spec), | ||
originalValue: { | ||
@@ -19,3 +19,3 @@ originalPath: pathBuilder.build(), | ||
}; | ||
exports.parseSwagger2Responses = (responses, pathBuilder, spec) => { | ||
const parseSwagger2Responses = (responses, pathBuilder, spec) => { | ||
return Object.keys(responses).reduce((accumulator, statusCode) => { | ||
@@ -27,1 +27,2 @@ const originalPath = pathBuilder.withChild(statusCode); | ||
}; | ||
exports.parseSwagger2Responses = parseSwagger2Responses; |
@@ -6,6 +6,7 @@ "use strict"; | ||
const getReferenceSources = (spec) => spec.definitions || {}; | ||
exports.toDiffReadySwagger2Schema = (schema, spec) => { | ||
const compatibleReferenceSources = to_diff_compatible_json_schema_1.toDiffCompatibleJsonSchemaMap(getReferenceSources(spec)); | ||
const compatibleSchema = to_diff_compatible_json_schema_1.toDiffCompatibleJsonSchema(schema); | ||
const toDiffReadySwagger2Schema = (schema, spec) => { | ||
const compatibleReferenceSources = (0, to_diff_compatible_json_schema_1.toDiffCompatibleJsonSchemaMap)(getReferenceSources(spec)); | ||
const compatibleSchema = (0, to_diff_compatible_json_schema_1.toDiffCompatibleJsonSchema)(schema); | ||
return Object.assign(Object.assign({}, compatibleSchema), { definitions: compatibleReferenceSources }); | ||
}; | ||
exports.toDiffReadySwagger2Schema = toDiffReadySwagger2Schema; |
@@ -17,9 +17,10 @@ "use strict"; | ||
const validateSpecFormat = (content, location) => { | ||
if (!is_openapi3_content_1.isOpenApi3Content(content)) { | ||
if (!(0, is_openapi3_content_1.isOpenApi3Content)(content)) { | ||
throw new open_api_diff_error_impl_1.OpenApiDiffErrorImpl('OPENAPI_DIFF_PARSE_ERROR', `"${location}" is not a "openapi3" spec`); | ||
} | ||
}; | ||
exports.validateAndDereferenceOpenapi3Spec = (content, location) => __awaiter(void 0, void 0, void 0, function* () { | ||
const validateAndDereferenceOpenapi3Spec = (content, location) => __awaiter(void 0, void 0, void 0, function* () { | ||
validateSpecFormat(content, location); | ||
return validate_and_dereference_spec_1.validateAndDereferenceSpec(content, location); | ||
return (0, validate_and_dereference_spec_1.validateAndDereferenceSpec)(content, location); | ||
}); | ||
exports.validateAndDereferenceOpenapi3Spec = validateAndDereferenceOpenapi3Spec; |
@@ -17,9 +17,10 @@ "use strict"; | ||
const validateSpecFormat = (content, location) => { | ||
if (!is_swagger2_content_1.isSwagger2Content(content)) { | ||
if (!(0, is_swagger2_content_1.isSwagger2Content)(content)) { | ||
throw new open_api_diff_error_impl_1.OpenApiDiffErrorImpl('OPENAPI_DIFF_PARSE_ERROR', `"${location}" is not a "swagger2" spec`); | ||
} | ||
}; | ||
exports.validateAndDereferenceSwagger2Spec = (content, location) => __awaiter(void 0, void 0, void 0, function* () { | ||
const validateAndDereferenceSwagger2Spec = (content, location) => __awaiter(void 0, void 0, void 0, function* () { | ||
validateSpecFormat(content, location); | ||
return validate_and_dereference_spec_1.validateAndDereferenceSpec(content, location); | ||
return (0, validate_and_dereference_spec_1.validateAndDereferenceSpec)(content, location); | ||
}); | ||
exports.validateAndDereferenceSwagger2Spec = validateAndDereferenceSwagger2Spec; |
{ | ||
"name": "openapi-diff", | ||
"version": "0.23.4", | ||
"version": "0.23.5", | ||
"description": "A CLI tool to identify differences between Swagger/OpenAPI specs.", | ||
@@ -37,9 +37,9 @@ "bin": { | ||
"devDependencies": { | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"@commitlint/cli": "^13.2.1", | ||
"@commitlint/config-conventional": "^13.2.0", | ||
"@types/express": "^4.17.8", | ||
"@types/jasmine": "^3.5.14", | ||
"@types/js-yaml": "^3.12.5", | ||
"@types/js-yaml": "^4.0.0", | ||
"@types/lodash": "^4.14.162", | ||
"@types/node": "^10.17.39", | ||
"@types/node": "^14.17.21", | ||
"@types/request": "^2.48.5", | ||
@@ -54,3 +54,3 @@ "@types/swagger-schema-official": "^2.0.21", | ||
"gulp-conventional-changelog": "^2.0.32", | ||
"gulp-filter": "^6.0.0", | ||
"gulp-filter": "^7.0.0", | ||
"gulp-git": "^2.10.1", | ||
@@ -63,10 +63,10 @@ "gulp-jasmine": "^4.0.0", | ||
"minimist": "^1.2.5", | ||
"openapi-types": "^7.0.1", | ||
"openapi-types": "^9.3.0", | ||
"tslint": "6.1.3", | ||
"typescript": "4.0.3" | ||
"typescript": "4.4.3" | ||
}, | ||
"dependencies": { | ||
"commander": "^6.1.0", | ||
"js-yaml": "^3.14.0", | ||
"json-schema-diff": "^0.16.0", | ||
"commander": "^8.2.0", | ||
"js-yaml": "^4.0.0", | ||
"json-schema-diff": "^0.17.1", | ||
"jsonpointer": "^4.1.0", | ||
@@ -73,0 +73,0 @@ "lodash": "^4.17.20", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115007
1848
+ Addedajv@8.17.1(transitive)
+ Addedcommander@7.2.08.3.0(transitive)
+ Addedfast-uri@3.0.3(transitive)
+ Addedjson-schema-diff@0.17.1(transitive)
+ Addedjson-schema-traverse@1.0.0(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
- Removedargparse@1.0.10(transitive)
- Removedcommander@5.1.06.2.1(transitive)
- Removedesprima@4.0.1(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedjson-schema-diff@0.16.0(transitive)
- Removedsprintf-js@1.0.3(transitive)
Updatedcommander@^8.2.0
Updatedjs-yaml@^4.0.0
Updatedjson-schema-diff@^0.17.1