Skip to content

Commit aafc3d8

Browse files
MikhailTryakhovsergey-shandar
authored andcommitted
Rebased master to monthly network branch (#3687)
* Swagger Coverage/Completeness- for operation CheckNameAvailability (#3663) * Update service.json * CheckNameAvailability * FIxed Parameter name fixed couple of parameters name * Update dns management Node.js version number to 3.0.0 (#3675) * Update batchai Node.js package version to 2.0.2 (#3664) * Update nofiticationhubs management Node.js package version to 2.0.0 (#3665) * WebApps - Add BackupName to backup API models (#3560) * WebApps - Add BackupName to replace non-ARM-compliant Name property on Backup API models * Revert breaking change to BackupItem. BackupItemName property will be fine in place of BackupName for now. * Update authorization management Node.js package version to 5.0.1 (#3676) * Update storagesync management Node.js package version to 1.0.0 (#3677) * add checknameavailability (#3608) * add checknameavailability * move checkname parameter to definition section * fix brackets * fix parameter name in checknameavailability exanple * update code owners for PowerBIDedicated * New Batch data plane API version 2018-08-01.7.0 (#3657) * Add new batch version 2018-08-01.7.0 * Update the new API * Fix up output from OAD, it does not output valid JSON * update OAV (#3678) * Update storage management Node.js package version to 5.2.0 (#3679) * Update compute.json and disk.json for some issues and add zone and rolling upgrade. (#3642) * Breaking change tool correctly handles multiple files with same name * Fix to breaking changes table generation * Trusted Root certificate (#3668)
1 parent 3ff4b52 commit aafc3d8

File tree

161 files changed

+20266
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+20266
-141
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
/specification/operationsmanagement/ @dashimi16
5050
/specification/policyinsights/ @bulentelmaci
5151
/specification/postgresql/ @qingqingyuan
52+
/specification/powerbidedicated/ @tarostok
5253
/specification/provisioningservices/ @kvish
5354
/specification/recoveryservices/ @dragonfly91 @sonathan
5455
/specification/recoveryservicesbackup/ @dheerendrarathor

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"json-schema-ref-parser": "^3.1.2",
2020
"mocha": "*",
2121
"oad": "^0.1.11",
22-
"oav": "^0.4.57",
22+
"oav": "^0.5.1",
2323
"request": "^2.61.0",
2424
"request-promise-native": "^1.0.5",
2525
"z-schema": "^3.16.1"

scripts/breaking-change.js

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// Licensed under the MIT License. See License in the project root for license information.
33

44
'use strict';
5-
var utils = require('../test/util/utils'),
5+
const utils = require('../test/util/utils'),
66
path = require('path'),
7-
fs = require('fs'),
7+
fs = require('fs-extra'),
88
os = require('os'),
9-
execSync = require('child_process').execSync,
9+
exec = require('util').promisify(require('child_process').exec),
1010
oad = require('oad');
1111

1212
// This map is used to store the mapping between files resolved and stored location
@@ -65,13 +65,16 @@ async function runOad(oldSpec, newSpec) {
6565
console.log(`New Spec: "${newSpec}"`);
6666
console.log(`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`);
6767

68-
const result = await oad.compare(oldSpec, newSpec, { consoleLogLevel: 'warn', json: true });
68+
let result = await oad.compare(oldSpec, newSpec, { consoleLogLevel: 'warn', json: true });
6969
console.log(result);
7070

7171
if (!result) {
7272
return;
7373
}
7474

75+
// fix up output from OAD, it does not output valid JSON
76+
result = '[' + result.replace(/}\s+{/gi,"},{") + ']'
77+
7578
return JSON.parse(result);
7679
}
7780

@@ -80,57 +83,53 @@ async function runOad(oldSpec, newSpec) {
8083
*
8184
* @param {string} swaggerPath Path to the swagger specification file.
8285
*/
83-
function processViaAutoRest(swaggerPath) {
86+
async function processViaAutoRest(swaggerPath) {
8487
if (swaggerPath === null || swaggerPath === undefined || typeof swaggerPath.valueOf() !== 'string' || !swaggerPath.trim().length) {
85-
return Promise.reject(new Error('swaggerPath is a required parameter of type "string" and it cannot be an empty string.'));
88+
throw new Error('swaggerPath is a required parameter of type "string" and it cannot be an empty string.');
8689
}
8790

88-
console.log(`Processing via AutoRest...`);
89-
90-
let outputFileNameWithExt = path.basename(swaggerPath);
91-
let outputFileNameWithoutExt = path.basename(swaggerPath, '.json');
92-
let autoRestCmd = `autorest --input-file=${swaggerPath} --output-artifact=swagger-document.json --output-file=${outputFileNameWithoutExt} --output-folder=${outputFolder}`;
91+
const swaggerOutputFolder = path.join(outputFolder, path.dirname(swaggerPath));
92+
const swaggerOutputFileNameWithoutExt = path.basename(swaggerPath, '.json');
93+
const autoRestCmd = `autorest --input-file=${swaggerPath} --output-artifact=swagger-document.json --output-file=${swaggerOutputFileNameWithoutExt} --output-folder=${swaggerOutputFolder}`;
9394

9495
console.log(`Executing : ${autoRestCmd}`);
9596

9697
try {
97-
let result = execSync(`${autoRestCmd}`, { encoding: 'utf8', maxBuffer: 1024 * 1024 * 64 });
98-
resolvedMapForNewSpecs[outputFileNameWithExt] = path.join(outputFolder, outputFileNameWithExt);
98+
await fs.ensureDir(swaggerOutputFolder);
99+
await exec(`${autoRestCmd}`, { encoding: 'utf8', maxBuffer: 1024 * 1024 * 64 });
100+
resolvedMapForNewSpecs[swaggerPath] = path.join(swaggerOutputFolder, swaggerOutputFileNameWithoutExt + '.json');
99101
} catch (err) {
100-
// Do not update map in case of errors.
102+
console.log(`Error processing via AutoRest: ${err}`);
101103
}
102-
103-
return Promise.resolve();
104104
}
105105

106106
//main function
107107
async function runScript() {
108108
// See whether script is in Travis CI context
109109
console.log(`isRunningInTravisCI: ${isRunningInTravisCI}`);
110110

111-
// Create directory to store the processed & resolved swaggers
112-
if (!fs.existsSync(outputFolder)) {
113-
fs.mkdirSync(outputFolder);
114-
}
115-
116111
let targetBranch = utils.getTargetBranch();
117112
let swaggersToProcess = utils.getFilesChangedInPR();
118113

119114
console.log('Processing swaggers:');
120115
console.log(swaggersToProcess);
121116

122-
for (const swagger of swaggersToProcess) {
123-
await processViaAutoRest(swagger);
124-
}
125-
117+
console.log('Finding new swaggers...')
126118
let newSwaggers = [];
127119
if (isRunningInTravisCI && swaggersToProcess.length > 0) {
128120
newSwaggers = await utils.doOnBranch(utils.getTargetBranch(), async () => {
129121
return swaggersToProcess.filter(s => !fs.existsSync(s))
130122
});
131123
}
132124

133-
console.log(`Resolved map for the new specification is:`);
125+
console.log('Processing via AutoRest...');
126+
for (const swagger of swaggersToProcess) {
127+
if (!newSwaggers.includes(swagger)) {
128+
await processViaAutoRest(swagger);
129+
}
130+
}
131+
132+
console.log(`Resolved map for the new specifications:`);
134133
console.dir(resolvedMapForNewSpecs);
135134

136135
let errors = 0, warnings = 0;
@@ -145,23 +144,20 @@ async function runScript() {
145144
continue;
146145
}
147146

148-
let outputFileNameWithExt = path.basename(swagger);
149-
console.log(outputFileNameWithExt);
150-
if (resolvedMapForNewSpecs[outputFileNameWithExt]) {
151-
const diff = await runOad(swagger, resolvedMapForNewSpecs[outputFileNameWithExt]);
152-
if (diff) {
153-
if (!diffFiles[swagger]) {
154-
diffFiles[swagger] = [];
155-
}
156-
diffFiles[swagger].push(diff);
157-
if (diff['type'] === 'Error') {
158-
if (errors === 0) {
159-
console.log(`There are potential breaking changes in this PR. Please review before moving forward. Thanks!`);
160-
process.exitCode = 1;
147+
if (resolvedMapForNewSpecs[swagger]) {
148+
const diffs = await runOad(swagger, resolvedMapForNewSpecs[swagger]);
149+
if (diffs) {
150+
diffFiles[swagger] = diffs;
151+
for (const diff of diffs) {
152+
if (diff['type'] === 'Error') {
153+
if (errors === 0) {
154+
console.log(`There are potential breaking changes in this PR. Please review before moving forward. Thanks!`);
155+
process.exitCode = 1;
156+
}
157+
errors += 1;
158+
} else if (diff['type'] === 'Warning') {
159+
warnings += 1;
161160
}
162-
errors += 1;
163-
} else if (diff['type'] === 'Warning') {
164-
warnings += 1;
165161
}
166162
}
167163
}

specification/authorization/resource-manager/readme.nodejs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Please also specify `--node-sdks-folder=<path to root folder of your azure-sdk-f
77
nodejs:
88
azure-arm: true
99
package-name: azure-arm-authorization
10-
package-version: 4.1.0
10+
package-version: 5.0.1
1111
output-folder: $(node-sdks-folder)/lib/services/authorizationManagement
1212
payload-flattening-threshold: 1
1313
generate-license-txt: true

0 commit comments

Comments
 (0)