Skip to content

Conversation

@alvadb
Copy link
Contributor

@alvadb alvadb commented May 18, 2018

No description provided.

if (Info != null &&
previousDefinition.Info != null &&
Info.Version != null &&
previousDefinition.Info.Version != null)
Copy link

@vladbarosan vladbarosan May 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use sequential check to simpify :

Info?.Version != null && previousDefinition.Info?.Version != null #Closed

Copy link
Contributor Author

@alvadb alvadb May 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done #Closed

default: true
},
o: {
alias: 'old-tag-name',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old-tag-name [](start = 12, length = 12)

oad uses camelCase parameters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

n: {
alias: 'new-tag-name',
describe: 'The tag name for the readme. If include also indicates that the old spec file is a readme file',
}
Copy link

@vladbarosan vladbarosan May 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also we need to update the readme for the new option and the changelog

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the version in the package.json


In reply to: 189362203 [](ancestors = 189362203)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@vladbarosan
Copy link

vladbarosan commented May 18, 2018

since the specs are passed as positional, wouldn't be better to pass the tags as optional positional also ?


Refers to: lib/commands/oad.js:9 in f43173c. [](commit_id = f43173c, deletion_comment = False)

@vladbarosan
Copy link

also to make an alias for the spec ( i.e. <old-spec|old-readme>


In reply to: 390302087 [](ancestors = 390302087)


Refers to: lib/commands/oad.js:9 in f43173c. [](commit_id = f43173c, deletion_comment = False)

* @param {string} swaggerPath Path to the specification file.
*
* @param {string} outputFileName Name of the output file to which autorest outputs swagger-doc.
*
Copy link

@vladbarosan vladbarosan May 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing comment for new param

Copy link
Contributor Author

@alvadb alvadb May 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done #Closed

@vladbarosan
Copy link

vladbarosan commented May 18, 2018

or Readme , we should change the name to a more generic name since it can be swagger or readme


Refers to: lib/validators/openApiDiff.js:118 in f43173c. [](commit_id = f43173c, deletion_comment = False)

let autoRestCmd = `${self.autoRestPath()} --input-file=${swaggerPath} --output-artifact=swagger-document.json --output-file=${outputFileName} --output-folder=${outputFolder}`;
var autoRestCmd;
if(tagName) {
autoRestCmd = `${self.autoRestPath()} ${swaggerPath} --tag=${tagName} --output-artifact=swagger-document.json --output-file=${outputFileName} --output-folder=${outputFolder}`;
Copy link

@vladbarosan vladbarosan May 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ternary operator instead tslint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link

@vladbarosan vladbarosan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

@vladbarosan
Copy link

also here to document the new option


Refers to: lib/validators/openApiDiff.js:29 in f43173c. [](commit_id = f43173c, deletion_comment = False)

cli.js Outdated
alias: 'newTagName',
describe: `The tag name for the new specification file. If include it ` +
`indicates that the new spec file is a readme file`
})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here should be only global parameters ( i.e. not tied to a command), those should go in the specific command folder. You can check https://github.com/yargs/yargs/blob/master/docs/advanced.md for documentation on how to structure yargs.

@vladbarosan
Copy link

here still not updated


In reply to: 390303096 [](ancestors = 390303096)


Refers to: lib/validators/openApiDiff.js:118 in f43173c. [](commit_id = f43173c, deletion_comment = False)

var promise1 = self.processViaAutoRest(oldSwagger, 'old');
var promise2 = self.processViaAutoRest(newSwagger, 'new');
var promise1 = self.processViaAutoRest(oldSwagger, 'old', self.options.oldTagName);
var promise2 = self.processViaAutoRest(newSwagger, 'new', self.options.newTagName);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.options.newTagName); [](start = 62, length = 25)

it doesn't really make sense to have the tag name in the constructor right ? that would mean if we call compare multiple times there will be static tags. Maybe add them as optional parameters to compare

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense, we send in two swaggers and a tag is associated with a swagger. This seems like an ok implementation.

@vladbarosan
Copy link

exports.command = 'compare ';

something weird with the previous doesn't show up. was asking if it makes more sense to have the tags as optional positional arguments ?


Refers to: lib/commands/oad.js:8 in 932c74d. [](commit_id = 932c74d, deletion_comment = False)


let compareFunc;
if(oldTag && newTag) {
compareFunc = validate.compareTags(oldSpec, oldTag, oldSpec, newTag, vOptions);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo newSpec

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

log.filepath = options.logFilepath || log.filepath;
let openApiDiff = new OpenApiDiff(options);

return openApiDiff.compare(oldSwagger, newSwagger, oldTag, newTag);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this will always be a Readme, maybe we can name it something like oldReadme newReadme

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets look at this in a subsequent checkin.

Copy link

@vladbarosan vladbarosan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vladbarosan vladbarosan merged commit 6a62de5 into Azure:master May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants