Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openapi-diff

Package Overview
Dependencies
Maintainers
3
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-diff - npm Package Compare versions

Comparing version 0.19.0 to 0.20.0

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="0.20.0"></a>
# [0.20.0](https://bitbucket.org/atlassian/openapi-diff/compare/0.19.0...0.20.0) (2019-02-07)
### Features
* add support for the required keyword in request and response body schemas ([ecc0e48](https://bitbucket.org/atlassian/openapi-diff/commits/ecc0e48))
<a name="0.19.0"></a>

@@ -2,0 +12,0 @@ # [0.19.0](https://bitbucket.org/atlassian/openapi-diff/compare/0.18.0...0.19.0) (2019-01-04)

5

dist/openapi-diff/spec-differ/diff-finder/find-diffs-in-request-bodies.js

@@ -16,5 +16,8 @@ "use strict";

const requestBodyScopeOptions = {
addedJsonSchema: diffResults.addedJsonSchema,
additionsFound: diffResults.additionsFound,
destinationScope: destinationRequestBody,
differences: diffResults.differences,
propertyName: 'request.body.scope',
removalsFound: diffResults.removalsFound,
removedJsonSchema: diffResults.removedJsonSchema,
sourceScope: sourceRequestBody

@@ -21,0 +24,0 @@ };

@@ -16,5 +16,8 @@ "use strict";

const responseBodyScopeOptions = {
addedJsonSchema: diffResults.addedJsonSchema,
additionsFound: diffResults.additionsFound,
destinationScope: destinationResponseBody,
differences: diffResults.differences,
propertyName: 'response.body.scope',
removalsFound: diffResults.removalsFound,
removedJsonSchema: diffResults.removedJsonSchema,
sourceScope: sourceResponseBody

@@ -21,0 +24,0 @@ };

77

dist/openapi-diff/spec-differ/diff-finder/get-scope-differences.js

@@ -16,49 +16,46 @@ "use strict";

};
const createSpecOrigin = (rootPathInSpec, differenceValue) => {
return {
originalPath: [...rootPathInSpec, ...differenceValue.path],
value: differenceValue.value
};
};
const createSpecOrigins = (parsedScope, differenceValues) => {
const createSpecOrigins = (parsedScope) => {
const jsonSchemaDetails = toJsonSchemaDetails(parsedScope);
const originValue = parsedScope.jsonSchema ? parsedScope.jsonSchema.originalValue.value : undefined;
return jsonSchemaDetails.isDefinedInOrigin
? differenceValues.map((differenceValue) => createSpecOrigin(jsonSchemaDetails.path, differenceValue))
? [{ originalPath: jsonSchemaDetails.path, value: originValue }]
: [];
};
const createScopeDifference = (options) => {
const destinationSpecOrigins = createSpecOrigins(options.destinationParsedScope, options.jsonSchemaDifference.destinationValues);
const sourceSpecOrigins = createSpecOrigins(options.sourceParsedScope, options.jsonSchemaDifference.sourceValues);
return create_difference_1.createDifference({
action: options.action,
destinationSpecOrigins,
details: {
value: options.jsonSchemaDifference.value
},
propertyName: options.propertyName,
source: 'json-schema-diff',
sourceSpecOrigins
});
};
const createScopeDifference = (options) => create_difference_1.createDifference({
action: options.action,
destinationSpecOrigins: createSpecOrigins(options.destinationParsedScope),
details: {
differenceSchema: options.differenceSchema
},
propertyName: options.propertyName,
source: 'json-schema-diff',
sourceSpecOrigins: createSpecOrigins(options.sourceParsedScope)
});
exports.getScopeAddDifferences = (options) => {
const addedJsonSchemaDifferences = options.differences.filter((difference) => difference.addedByDestinationSchema);
return addedJsonSchemaDifferences
.map((jsonSchemaDifference) => createScopeDifference({
action: 'add',
destinationParsedScope: options.destinationScope,
jsonSchemaDifference,
propertyName: options.propertyName,
sourceParsedScope: options.sourceScope
}));
if (!options.additionsFound) {
return [];
}
return [
createScopeDifference({
action: 'add',
destinationParsedScope: options.destinationScope,
differenceSchema: options.addedJsonSchema,
propertyName: options.propertyName,
sourceParsedScope: options.sourceScope
})
];
};
exports.getScopeRemoveDifferences = (options) => {
const addedJsonSchemaDifferences = options.differences.filter((difference) => difference.removedByDestinationSchema);
return addedJsonSchemaDifferences
.map((jsonSchemaDifference) => createScopeDifference({
action: 'remove',
destinationParsedScope: options.destinationScope,
jsonSchemaDifference,
propertyName: options.propertyName,
sourceParsedScope: options.sourceScope
}));
if (!options.removalsFound) {
return [];
}
return [
createScopeDifference({
action: 'remove',
destinationParsedScope: options.destinationScope,
differenceSchema: options.removedJsonSchema,
propertyName: options.propertyName,
sourceParsedScope: options.sourceScope
})
];
};

@@ -162,3 +162,3 @@ # OpenApi 3 Support

(Check supported functionality for the used version of the json-schema-diff package)
Check supported functionality for the used version of the [json-schema-diff](https://bitbucket.org/atlassian/json-schema-diff) package.

@@ -165,0 +165,0 @@ ## Discriminator Object

@@ -130,3 +130,3 @@ # Swagger 2 Support

(Check supported functionality for the used version of the json-schema-diff package)
Check supported functionality for the used version of the [json-schema-diff](https://bitbucket.org/atlassian/json-schema-diff) package.

@@ -133,0 +133,0 @@ ## XML Object

{
"name": "openapi-diff",
"version": "0.19.0",
"version": "0.20.0",
"description": "A CLI tool to identify differences between Swagger/OpenAPI specs.",

@@ -66,3 +66,3 @@ "bin": {

"js-yaml": "^3.12.0",
"json-schema-diff": "^0.8.3",
"json-schema-diff": "^0.9.0",
"jsonpointer": "^4.0.1",

@@ -69,0 +69,0 @@ "lodash": "^4.17.10",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc