Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions powershell/llcsharp/operation/method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,20 +396,20 @@ export class NewOperationMethod extends Method {

// replace any server params in the uri
for (const pp of serverParams) {
url = url.replace(`{${pp.param.language.csharp?.name}}`, `"
url = url.replace(`{${pp.param.language.default.serializedName}}`, `"
+ ${pp.name}
+ "`);
}

for (const pp of pathParams) {
rx = rx.replace(`{${pp.param.language.csharp?.name}}`, `(?<${pp.param.language.csharp?.name}>[^/]+)`);
rx = rx.replace(`{${pp.param.language.default.serializedName}}`, `(?<${pp.param.language.default.serializedName}>[^/]+)`);

if (this.viaIdentity) {
url = url.replace(`{${pp.param.language.csharp?.name}}`, `"
url = url.replace(`{${pp.param.language.default.serializedName}}`, `"
+ ${pp.name}
+ "`);
} else {
url = url.replace(`{${pp.param.language.csharp?.name}}`, `"
url = url.replace(`{${pp.param.language.default.serializedName}}`, `"
+ ${newRemoveEncoding(pp, '', KnownMediaType.UriParameter)}
+ "`);
}
Expand All @@ -435,7 +435,7 @@ export class NewOperationMethod extends Method {
yield EOL;
yield '// replace URI parameters with values from identity';
for (const pp of pathParams) {
yield `var ${pp.name} = ${match.value}.Groups["${pp.param.language.csharp?.name}"].Value;`;
yield `var ${pp.name} = ${match.value}.Groups["${pp.param.language.default.serializedName}"].Value;`;
}
}

Expand Down Expand Up @@ -469,7 +469,7 @@ export class NewOperationMethod extends Method {
// content length is set when the request body is set
continue;
}
yield hp.serializeToContainerMember(KnownMediaType.Header, new LocalVariable('request.Headers', dotnet.Var), hp.param.language.csharp?.serializedName || hp.param.language.default.serializedName, ClientRuntime.SerializationMode.None);
yield hp.serializeToContainerMember(KnownMediaType.Header, new LocalVariable('request.Headers', dotnet.Var), hp.param.language.default.serializedName, ClientRuntime.SerializationMode.None);
}
yield EOL;
}
Expand Down
2 changes: 1 addition & 1 deletion powershell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@
"source-map-support": "0.5.13",
"xmlbuilder": "10.1.1"
}
}
}
2 changes: 2 additions & 0 deletions powershell/plugins/cs-namer-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ function setSchemaNames(schemaGroups: Dictionary<Array<Schema>>, azure: boolean,
namespace: '<INVALID_NAMESPACE>',
fullname: '<INVALID_FULLNAME>'
};
// xichen: for invalid namespace case, we won't create model class. So we do not need consider dup case
thisNamespace.delete(schemaName);
}

// name each property in this schema
Expand Down
12 changes: 1 addition & 11 deletions powershell/plugins/llcsharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,11 @@ import { Dictionary } from '@azure-tools/linq';

const resources = `${__dirname}/../../resources`;

function outerTest(service: Host, project: Project, fname: string, content: string) {
service.WriteFile(join(project.apifolder, fname), test(content, project.overrides), undefined, 'source-file-csharp');
}

function test(content: string, overrides: Dictionary<string>): string {
const a = applyOverrides(content, overrides);
return a;
}

export async function llcsharp(service: Host) {
try {
const project = await new Project(service).init();

await project.writeFiles(async (fname, content) => service.WriteFile(join(project.apifolder, fname), test(content, project.overrides), undefined, 'source-file-csharp'));
await project.writeFiles(async (fname, content) => outerTest(service, project, fname, content));
await project.writeFiles(async (fname, content) => service.WriteFile(join(project.apifolder, fname), applyOverrides(content, project.overrides), undefined, 'source-file-csharp'));

// recursive copy resources
await copyResources(join(resources, 'runtime', 'csharp', 'client'), async (fname, content) => service.WriteFile(join(project.runtimefolder, fname), content, undefined, 'source-file-csharp'), project.overrides);
Expand Down
5 changes: 4 additions & 1 deletion tests-upgrade/Configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
"extension-ms-discriminatorvalue",
"extension-ms-examples",
"extension-ms-longruningoperation",
"extension-ms-pageable"
"extension-ms-pageable",
"directive-aliasremoval",
"directive-cmdlet",
"directive-parameter"
],
"BlackList": [
"basic-get-querystr",
Expand Down