openapi-diff
Advanced tools
Comparing version 0.0.1 to 0.1.0
@@ -0,1 +1,11 @@ | ||
<a name="0.1.0"></a> | ||
# [0.1.0](https://bitbucket.org/atlassian/openapi-diff/compare/0.0.1...v0.1.0) (2017-07-07) | ||
### Features | ||
* support for editions to the info object and ^x- properties ([8464ac6](https://bitbucket.org/atlassian/openapi-diff/commits/8464ac6)) | ||
<a name="0.0.1"></a> | ||
@@ -2,0 +12,0 @@ ## 0.0.1 (2017-06-22) |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const greet_1 = require("./greet"); | ||
// Hello world | ||
console.log(greet_1.sayHello('OpenAPI Diff')); | ||
const json_loader_1 = require("./openapi-diff/json-loader"); | ||
const result_reporter_1 = require("./openapi-diff/result-reporter"); | ||
const spec_differ_1 = require("./openapi-diff/spec-differ"); | ||
const spec_parser_1 = require("./openapi-diff/spec-parser"); | ||
const openApiDiff = { | ||
run: (oldSpecPath, newSpecPath) => { | ||
const oldSpec = json_loader_1.default.load(oldSpecPath); | ||
const parsedOldSpec = spec_parser_1.default.parse(oldSpec); | ||
const newSpec = json_loader_1.default.load(newSpecPath); | ||
const parsedNewSpec = spec_parser_1.default.parse(newSpec); | ||
const diffResult = spec_differ_1.default.diff(parsedOldSpec, parsedNewSpec); | ||
const results = result_reporter_1.default.print(diffResult); | ||
return results; | ||
} | ||
}; | ||
exports.default = openApiDiff; |
@@ -54,3 +54,3 @@ 'use strict'; | ||
'clean-build-output', | ||
'compile-build-output', | ||
['copy-build-output-package-json', 'compile-build-output'], | ||
callback | ||
@@ -89,2 +89,6 @@ ); | ||
gulp.task('copy-build-output-package-json', () => { | ||
return gulp.src('package.json').pipe(gulp.dest('build-output')) | ||
}); | ||
gulp.task('create-new-tag', (callback) => { | ||
@@ -103,2 +107,7 @@ const version = getPackageJsonVersion(); | ||
gulp.task('e2e-test', () => { | ||
return gulp.src('build-output/test/e2e/**/*.spec.js') | ||
.pipe(jasmine()) | ||
}); | ||
gulp.task('lint-commits', (callback) => { | ||
@@ -140,5 +149,14 @@ return exec('./node_modules/.bin/conventional-changelog-lint --from \"d9a3266\"', (err, stdout, stderr) => { | ||
gulp.task('unit-test', () => { | ||
return gulp.src('build-output/test/unit/**/*[sS]pec.js') | ||
.pipe(jasmine()) | ||
}); | ||
gulp.task('watch', ['clean-copy-and-compile-build-output'], () => { | ||
gulp.watch(['lib/**/*.ts', 'test/**/*.ts'], ['compile-build-output']); | ||
gulp.watch(['build-output/lib/**/*', 'build-output/test/**/*'], ['test']); | ||
gulp.watch(['build-output/lib/**/*', 'build-output/test/unit/**/*'], ['unit-test']); | ||
}); | ||
gulp.task('watch-e2e', ['clean-copy-and-compile-build-output'], () => { | ||
gulp.watch(['build-output/lib/**/*', 'build-output/test/e2e/**/*', 'test/e2e/**/*.json'], ['e2e-test']); | ||
}); |
@@ -1,4 +0,25 @@ | ||
import { sayHello } from './greet'; | ||
import { | ||
Diff, OpenAPIDiff, OpenAPISpec, ParsedSpec, ResultObject | ||
} from './openapi-diff/types'; | ||
// Hello world | ||
console.log(sayHello('OpenAPI Diff')); | ||
import jsonLoader from './openapi-diff/json-loader'; | ||
import resultReporter from './openapi-diff/result-reporter'; | ||
import specDiffer from './openapi-diff/spec-differ'; | ||
import specParser from './openapi-diff/spec-parser'; | ||
const openApiDiff: OpenAPIDiff = { | ||
run: (oldSpecPath, newSpecPath) => { | ||
const oldSpec: OpenAPISpec = jsonLoader.load(oldSpecPath); | ||
const parsedOldSpec: ParsedSpec = specParser.parse(oldSpec as OpenAPISpec); | ||
const newSpec: OpenAPISpec = jsonLoader.load(newSpecPath); | ||
const parsedNewSpec: ParsedSpec = specParser.parse(newSpec as OpenAPISpec); | ||
const diffResult: Diff = specDiffer.diff(parsedOldSpec, parsedNewSpec); | ||
const results: ResultObject = resultReporter.print(diffResult); | ||
return results; | ||
} | ||
}; | ||
export default openApiDiff; |
{ | ||
"name": "openapi-diff", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "A CLI tool to identify differences between Swagger/OpenAPI specs.", | ||
"bin": { | ||
"openapi-diff": "./bin/openapi-diff" | ||
}, | ||
"scripts": { | ||
@@ -10,3 +13,4 @@ "release-major": "./node_modules/.bin/gulp release --type major", | ||
"test": "./node_modules/.bin/gulp", | ||
"watch": "./node_modules/.bin/gulp watch" | ||
"watch": "./node_modules/.bin/gulp watch", | ||
"watch-e2e": "./node_modules/.bin/gulp watch-e2e" | ||
}, | ||
@@ -33,3 +37,8 @@ "repository": { | ||
"devDependencies": { | ||
"@types/commander": "^2.9.1", | ||
"@types/deep-diff": "0.0.30", | ||
"@types/jasmine": "^2.5.52", | ||
"@types/lodash": "^4.14.66", | ||
"@types/q": "^1.0.2", | ||
"@types/verror": "^1.10.0", | ||
"conventional-changelog-lint": "^1.1.9", | ||
@@ -48,3 +57,10 @@ "del": "^3.0.0", | ||
"typescript": "2.3.4" | ||
}, | ||
"dependencies": { | ||
"commander": "^2.10.0", | ||
"deep-diff": "0.3.4", | ||
"lodash": "^4.17.4", | ||
"q": "^1.5.0", | ||
"verror": "^1.10.0" | ||
} | ||
} |
# OpenAPI Diff | ||
> A CLI tool to identify differences between Swagger/OpenAPI specs. | ||
## Requirements | ||
- NodeJS 4.x or higher (tested using 4.x, 6.x and 8.x) | ||
- NPM 2.x or higher (tested using 2.x, 3.x and 5x) | ||
## Installation | ||
Install the tool using NPM: | ||
``` | ||
npm install --global openapi-diff | ||
``` | ||
## Usage | ||
Invoke the tool with two paths to Swagger/OpenAPI files in order to find differences between them. These files should be in JSON format. | ||
``` | ||
openapi-diff /path/to/old/openapi.json /path/to/new/openapi.json | ||
``` | ||
The tool's output will display amount and type of changes (breaking, non-breaking, unclassified), and then list the changes with the relevant info. | ||
## Feature support | ||
### Supported | ||
- Editions to the Info object and ^x- properties at the top level of the spec. | ||
### Beta support | ||
- Additions and deletions to the Info object and ^x- properties at the top level of the spec. | ||
### Not supported | ||
- Any other additions, editions or deletions to the spec. | ||
- Specs in YML format | ||
- Specs as URLs |
@@ -8,6 +8,10 @@ { | ||
"rules": { | ||
// "cyclomatic-complexity": [true, 4], | ||
"interface-name": [true, "never-prefix"], | ||
"no-console": false, | ||
"quotemark": [true, "single"] | ||
"object-literal-key-quotes": [true, "as-needed"], | ||
"quotemark": [true, "single"], | ||
"trailing-comma": [true, {"multiline": "never", "singleline": "never"}] | ||
}, | ||
"rulesDirectory": [] | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
96779
40
1661
34
5
19
3
2
+ Addedcommander@^2.10.0
+ Addeddeep-diff@0.3.4
+ Addedlodash@^4.17.4
+ Addedq@^1.5.0
+ Addedverror@^1.10.0
+ Addedassert-plus@1.0.0(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addeddeep-diff@0.3.4(transitive)
+ Addedextsprintf@1.4.1(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedq@1.5.1(transitive)
+ Addedverror@1.10.1(transitive)