@@ -51,13 +51,17 @@ class OpenApiDiff {
5151 *
5252 * @param {string } newSwagger Path to the new specification file.
5353 *
54+ * @param {string } oldTag Tag name used for autorest with the old specification file.
55+ *
56+ * @param {string } newTag Tag name used for autorest with the new specification file.
57+ *
5458 */
55- compare ( oldSwagger , newSwagger ) {
59+ compare ( oldSwagger , newSwagger , oldTag , newTag ) {
5660 log . silly ( `compare is being called` ) ;
5761
5862 let self = this ;
59- var promise1 = self . processViaAutoRest ( oldSwagger , 'old' ) ;
60- var promise2 = self . processViaAutoRest ( newSwagger , 'new' ) ;
63+ var promise1 = self . processViaAutoRest ( oldSwagger , 'old' , oldTag ) ;
64+ var promise2 = self . processViaAutoRest ( newSwagger , 'new' , newTag ) ;
6165
6266 return Promise . all ( [ promise1 , promise2 ] ) . then ( results => {
6367 return self . processViaOpenApiDiff ( results [ 0 ] , results [ 1 ] ) ;
@@ -118,8 +122,10 @@ class OpenApiDiff {
118122 *
119123 * @param {string } outputFileName Name of the output file to which autorest outputs swagger-doc.
120124 *
125+ * @param {string } tagName Name of the tag in the specification file.
126+ *
121127 */
122- processViaAutoRest ( swaggerPath , outputFileName ) {
128+ processViaAutoRest ( swaggerPath , outputFileName , tagName ) {
123129 log . silly ( `processViaAutoRest is being called` ) ;
124130
125131 let self = this ;
@@ -141,7 +147,9 @@ class OpenApiDiff {
141147
142148 let outputFolder = os . tmpdir ( ) ;
143149 let outputFilePath = path . join ( outputFolder , `${ outputFileName } .json` ) ;
144- let autoRestCmd = `${ self . autoRestPath ( ) } --input-file=${ swaggerPath } --output-artifact=swagger-document.json --output-file=${ outputFileName } --output-folder=${ outputFolder } ` ;
150+ var autoRestCmd = tagName
151+ ? `${ self . autoRestPath ( ) } ${ swaggerPath } --tag=${ tagName } --output-artifact=swagger-document.json --output-file=${ outputFileName } --output-folder=${ outputFolder } `
152+ : `${ self . autoRestPath ( ) } --input-file=${ swaggerPath } --output-artifact=swagger-document.json --output-file=${ outputFileName } --output-folder=${ outputFolder } ` ;
145153
146154 log . debug ( `Executing: "${ autoRestCmd } "` ) ;
147155
0 commit comments