From 2595a5f70077acd240f2459b2e5307df540911bd Mon Sep 17 00:00:00 2001 From: xichen Date: Wed, 12 Aug 2020 16:32:02 +0800 Subject: [PATCH] Fix some issues --- powershell/llcsharp/operation/method.ts | 3 +-- powershell/plugins/cs-namer-v2.ts | 4 +++- powershell/plugins/plugin-tweak-m4-model.ts | 8 ++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/powershell/llcsharp/operation/method.ts b/powershell/llcsharp/operation/method.ts index a18586b58a3..f20a51ef635 100644 --- a/powershell/llcsharp/operation/method.ts +++ b/powershell/llcsharp/operation/method.ts @@ -383,8 +383,7 @@ export class NewOperationMethod extends Method { rx = rx.substr(0, idx); } - - let url = `${baseUrl}/${rx.startsWith('/') ? rx.substr(1) : rx}`; + let url = `${baseUrl}/${path.startsWith('/') ? path.substr(1) : path}`; const serverParams = this.methodParameters.filter(each => each.param.protocol.http?.in === ParameterLocation.Uri); diff --git a/powershell/plugins/cs-namer-v2.ts b/powershell/plugins/cs-namer-v2.ts index 260dc095464..6a6c66c3911 100644 --- a/powershell/plugins/cs-namer-v2.ts +++ b/powershell/plugins/cs-namer-v2.ts @@ -153,7 +153,9 @@ function setSchemaNames(schemaGroups: Dictionary>, azure: boolean, // and the value names themselves for (const value of values(schema.language.csharp.enum.values)) { - (value).name = getPascalIdentifier((value).name); + // In m3, enum.name and enum.value are same. But in m4, enum.name is named by m4. + // To keep same action as m3, use enum.value here + (value).name = getPascalIdentifier((value).value); } } } diff --git a/powershell/plugins/plugin-tweak-m4-model.ts b/powershell/plugins/plugin-tweak-m4-model.ts index b73b280fc01..3bf59ab1ca4 100644 --- a/powershell/plugins/plugin-tweak-m4-model.ts +++ b/powershell/plugins/plugin-tweak-m4-model.ts @@ -91,8 +91,12 @@ function addDictionaryApiVersion(model: CodeModel) { if ((prop.schema.type !== SchemaType.Dictionary && prop.schema.type !== SchemaType.Any) || prop.schema.apiVersions) { continue; } - const dictSchema = prop.schema; - dictSchema.apiVersions = JSON.parse(JSON.stringify(schema.apiVersions)); + const dictSchema = prop.schema as DictionarySchema; + if (dictSchema.elementType && dictSchema.elementType.apiVersions) { + dictSchema.apiVersions = JSON.parse(JSON.stringify(dictSchema.elementType.apiVersions)); + } else { + dictSchema.apiVersions = JSON.parse(JSON.stringify(schema.apiVersions)); + } } }) }