Skip to content

Commit a3db030

Browse files
committed
fixed bug in compareTags method
1 parent 0997434 commit a3db030

File tree

1 file changed

+36
-24
lines changed

1 file changed

+36
-24
lines changed

lib/commands/oad.js

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4-
'use strict';
5-
const log = require('../util/logging'),
6-
validate = require('../validate');
4+
"use strict";
5+
const log = require("../util/logging"),
6+
validate = require("../validate");
77

8-
exports.command = 'compare <old-spec> <new-spec>';
8+
exports.command = "compare <old-spec> <new-spec>";
99

10-
exports.describe = 'Compares old and new open api specification for breaking changes.';
10+
exports.describe =
11+
"Compares old and new open api specification for breaking changes.";
1112

1213
exports.builder = {
1314
j: {
14-
alias: 'inJson',
15-
describe: 'A boolean flag indicating whether output format of the messages is json.',
15+
alias: "inJson",
16+
describe:
17+
"A boolean flag indicating whether output format of the messages is json.",
1618
boolean: true,
1719
default: true
1820
},
1921
o: {
20-
alias: 'oldTagName',
21-
describe: 'The tag name for the old specification file. If included it indicates that the old spec file is a readme file',
22+
alias: "oldTagName",
23+
describe:
24+
"The tag name for the old specification file. If included it indicates that the old spec file is a readme file"
2225
},
2326
n: {
24-
alias: 'newTagName',
25-
describe: 'The tag name for the new specification file. If included it indicates that the new spec file is a readme file',
27+
alias: "newTagName",
28+
describe:
29+
"The tag name for the new specification file. If included it indicates that the new spec file is a readme file"
2630
}
2731
};
2832

29-
exports.handler = function (argv) {
33+
exports.handler = function(argv) {
3034
log.debug(argv);
3135
let oldSpec = argv.oldSpec;
3236
let oldTag = argv.o;
@@ -36,20 +40,28 @@ exports.handler = function (argv) {
3640
vOptions.consoleLogLevel = argv.logLevel;
3741
vOptions.logFilepath = argv.f;
3842
vOptions.json = argv.j;
39-
43+
4044
let compareFunc;
41-
if(oldTag && newTag) {
42-
compareFunc = validate.compareTags(oldSpec, oldTag, oldSpec, newTag, vOptions);
43-
}else {
45+
if (oldTag && newTag) {
46+
compareFunc = validate.compareTags(
47+
oldSpec,
48+
oldTag,
49+
newSpec,
50+
newTag,
51+
vOptions
52+
);
53+
} else {
4454
compareFunc = validate.compare(oldSpec, newSpec, vOptions);
4555
}
46-
47-
return compareFunc.then((result) => {
48-
console.log(result);
49-
}).catch(err => {
50-
console.log(err);
51-
process.exitCode = 1;
52-
});
53-
}
56+
57+
return compareFunc
58+
.then(result => {
59+
console.log(result);
60+
})
61+
.catch(err => {
62+
console.log(err);
63+
process.exitCode = 1;
64+
});
65+
};
5466

5567
exports = module.exports;

0 commit comments

Comments
 (0)