PR follow-up comments (#17113)

This commit is contained in:
Benjin Dubishar
2021-09-20 15:46:34 -07:00
committed by GitHub
parent dec5be6915
commit 5feb660234
3 changed files with 10 additions and 5 deletions

View File

@@ -402,8 +402,6 @@
},
"dependencies": {
"@microsoft/ads-extension-telemetry": "^1.1.5",
"@types/which": "^2.0.1",
"@types/xml-formatter": "^1.1.0",
"fast-glob": "^3.1.0",
"fs-extra": "^5.0.0",
"jsonc-parser": "^2.3.1",
@@ -419,6 +417,8 @@
"@types/fs-extra": "^5.0.0",
"@types/mocha": "^5.2.5",
"@types/sinon": "^9.0.4",
"@types/which": "^2.0.1",
"@types/xml-formatter": "^1.1.0",
"@types/xmldom": "^0.1.29",
"mocha": "^5.2.0",
"mocha-junit-reporter": "^1.17.0",

View File

@@ -416,8 +416,9 @@ export const autorestPostDeploymentScriptName = 'PostDeploymentScript.sql';
export const nodeButNotAutorestFound = localize('nodeButNotAutorestFound', "Autorest tool not found in system path, but found Node.js. Running via npx. Please execute 'npm install autorest -g' to install permanently.");
export const nodeNotFound = localize('nodeNotFound', "Neither autorest nor Node.js (npx) found in system path. Please install Node.js for autorest generation to work.");
export const selectSpecFile = localize('selectSpecFile', "Select OpenAPI/Swagger spec file");
export const generatingProjectFailed = localize('generatingProjectFailed', "Generating project via AutoRest failed");
export function generatingProjectFailed(errorMessage: string) { return localize('generatingProjectFailed', "Generating project via AutoRest failed: {0}", errorMessage); }
export function multipleMostDeploymentScripts(count: number) { return localize('multipleMostDeploymentScripts', "Unexpected number of {0} files: {1}", autorestPostDeploymentScriptName, count); }
export const specSelectionText = localize('specSelectionText', "OpenAPI/Swagger spec");
// System dbs
export const systemDbs = ['master', 'msdb', 'tempdb', 'model'];

View File

@@ -840,7 +840,7 @@ export class ProjectsController {
}
const filters: { [name: string]: string[] } = {};
filters['OpenAPI/Swagger spec'] = ['yaml'];
filters[constants.specSelectionText] = ['yaml'];
let uris = await vscode.window.showOpenDialog({
canSelectFiles: true,
@@ -964,12 +964,16 @@ export class ProjectsController {
return project;
} catch (err) {
void vscode.window.showErrorMessage(`${constants.generatingProjectFailed}: ${utils.getErrorMessage(err)}`);
void vscode.window.showErrorMessage(constants.generatingProjectFailed(utils.getErrorMessage(err)));
return;
}
}
private findPostDeploymentScript(files: vscode.Uri[]): vscode.Uri | undefined {
// Locate the post-deployment script generated by autorest, if one exists.
// It's only generated if enums are present in spec, b/c the enum values need to be inserted into the generated table.
// Because autorest is executed via command rather than API, we can't easily "receive" the name of the script,
// so we're stuck just matching on a file name.
const results = files.filter(f => f.fsPath.endsWith(constants.autorestPostDeploymentScriptName));
switch (results.length) {