Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports.log = require('./lib/util/logging');
exports.compare = validate.compare;

// Classes
exports.OpenApiDiff = require('./lib/validators/OpenApiDiff');
exports.OpenApiDiff = require('./lib/validators/openApiDiff');

// Constants
exports.Constants = require('./lib/util/constants');
15 changes: 13 additions & 2 deletions lib/validators/openApiDiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,18 @@ class OpenApiDiff {
autoRestPath() {
log.silly(`autoRestPath is being called`);

return path.join(__dirname, "..", "..", "node_modules", "autorest", "app.js");
// When oad is installed globally
let result = path.join(__dirname, "..", "..", "node_modules", "autorest", "app.js");
if (fs.existsSync(result))
return `node ${result}`;

// When oad is installed locally
result = path.join(__dirname, "..", "..", "..", "autorest", "app.js");
if (fs.existsSync(result))
return `node ${result}`;

// Assume that autorest is in the path
return 'autorest';
}

/**
Expand Down Expand Up @@ -144,7 +155,7 @@ class OpenApiDiff {

let outputFolder = os.tmpdir();
let outputFilePath = path.join(outputFolder, `${outputFileName}.json`);
let autoRestCmd = `node ${self.autoRestPath()} --input-file=${swaggerPath} --output-artifact=swagger-document.json --output-file=${outputFileName} --output-folder=${outputFolder}`;
let autoRestCmd = `${self.autoRestPath()} --input-file=${swaggerPath} --output-artifact=swagger-document.json --output-file=${outputFileName} --output-folder=${outputFolder}`;

log.debug(`Executing: "${autoRestCmd}"`);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oad",
"version": "0.1.4",
"version": "0.1.5",
"author": {
"name": "Microsoft Corporation",
"email": "azsdkteam@microsoft.com",
Expand Down