proper parsing and modification
This commit is contained in:
Родитель
79064a4fb4
Коммит
7c362564d6
|
@ -38,6 +38,8 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@azure-tools/autorest-extension-base": "~3.1.0",
|
||||
"@azure-tools/codemodel": "~3.0.0",
|
||||
"@azure-tools/codegen": "~2.1.0",
|
||||
"node-yaml": "^3.2.0"
|
||||
},
|
||||
"files": [
|
||||
|
|
13
src/index.ts
13
src/index.ts
|
@ -1,5 +1,6 @@
|
|||
import { AutoRestExtension, Channel } from '@azure-tools/autorest-extension-base';
|
||||
|
||||
import { AutoRestExtension, Channel, Host, startSession } from '@azure-tools/autorest-extension-base';
|
||||
import { codeModelSchema, CodeModel } from '@azure-tools/codemodel';
|
||||
import { serialize } from '@azure-tools/codegen';
|
||||
|
||||
export type LogCallback = (message: string) => void;
|
||||
export type FileCallback = (path: string, rows: string[]) => void;
|
||||
|
@ -21,6 +22,7 @@ extension.Add("cli.common", async autoRestApi => {
|
|||
const isDebugFlagSet = await autoRestApi.GetValue("debug");
|
||||
let cliCommonSettings = await autoRestApi.GetValue("cli");
|
||||
|
||||
const session = await startSession<CodeModel>(autoRestApi, {}, codeModelSchema);
|
||||
|
||||
// emit messages
|
||||
|
||||
|
@ -39,8 +41,13 @@ extension.Add("cli.common", async autoRestApi => {
|
|||
Text: "AutoRest offers the following input files: " + inputFileUris.join(", "),
|
||||
});
|
||||
|
||||
|
||||
let result = session.model;
|
||||
|
||||
result["ADDITIONAL"] = "TEST";
|
||||
|
||||
// emit a file (all input files concatenated)
|
||||
autoRestApi.WriteFile("code-model-v4-cli.yaml", inputFiles[inputFileUris.indexOf("code-model-v4-no-tags.yaml")]);
|
||||
autoRestApi.WriteFile("code-model-v4-cli.yaml", serialize(result, codeModelSchema));
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче