Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tcgc] remove deprecated nameInClient property from SdkModelPropertyTypes #1064

Merged
merged 3 commits into from
Jun 24, 2024
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
7 changes: 7 additions & 0 deletions .chronus/changes/remove_name_in_client-2024-5-24-13-45-6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: breaking
packages:
- "@azure-tools/typespec-client-generator-core"
---

remove deprecated `.nameInClient` property from `SdkModelPropertyType`s
3 changes: 0 additions & 3 deletions packages/typespec-client-generator-core/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ function getSdkHttpParameters(
retval.bodyParam = {
kind: "body",
name,
nameInClient: name,
isGeneratedName: true,
description: getDocHelper(context, tspBody.type).description,
details: getDocHelper(context, tspBody.type).details,
Expand Down Expand Up @@ -259,7 +258,6 @@ function createContentTypeOrAcceptHeader(
// No need for clientDefaultValue because it's a constant, it only has one value
return {
type,
nameInClient: name,
name,
isGeneratedName: true,
apiVersions: bodyObject.apiVersions,
Expand Down Expand Up @@ -473,7 +471,6 @@ export function getCorrespondingMethodParams(
const apiVersionParamUpdated: SdkParameter = {
...apiVersionParam,
name: "apiVersion",
nameInClient: "apiVersion",
isGeneratedName: apiVersionParam.name !== "apiVersion",
optional: false,
clientDefaultValue:
Expand Down
4 changes: 0 additions & 4 deletions packages/typespec-client-generator-core/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,6 @@ export interface SdkEndpointType extends SdkTypeBase {
export interface SdkModelPropertyTypeBase {
__raw?: ModelProperty;
type: SdkType;
/**
* @deprecated This property is deprecated. Use `.name` instead.
*/
nameInClient: string;
name: string;
isGeneratedName: boolean;
description?: string;
Expand Down
3 changes: 0 additions & 3 deletions packages/typespec-client-generator-core/src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ function getSdkMethodParameter(
details: getDocHelper(context, type).details,
apiVersions,
type: propertyType,
nameInClient: name,
name,
isGeneratedName: Boolean(libraryName),
optional: false,
Expand Down Expand Up @@ -478,7 +477,6 @@ function getSdkEndpointParameter(
templateArguments: [
{
name,
nameInClient: name,
isGeneratedName: true,
description: "Service host",
kind: "path",
Expand Down Expand Up @@ -533,7 +531,6 @@ function getSdkEndpointParameter(
return diagnostics.wrap({
kind: "endpoint",
type,
nameInClient: "endpoint",
name: "endpoint",
isGeneratedName: true,
description: "Service host",
Expand Down
3 changes: 0 additions & 3 deletions packages/typespec-client-generator-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,6 @@ function addDiscriminatorToModelType(
? discriminatorProperty.serializedName
: discriminator.propertyName,
type: discriminatorType!,
nameInClient: name,
name,
isGeneratedName: false,
onClient: false,
Expand Down Expand Up @@ -966,7 +965,6 @@ export function getSdkCredentialParameter(
return {
type: getSdkCredentialType(context, client, auth),
kind: "credential",
nameInClient: name,
name,
isGeneratedName: true,
description: "Credential used to authenticate requests to the service.",
Expand Down Expand Up @@ -1001,7 +999,6 @@ export function getSdkModelPropertyTypeBase(
details: docWrapper.details,
apiVersions,
type: propertyType,
nameInClient: name,
name,
isGeneratedName: false,
optional: type.optional,
Expand Down
79 changes: 0 additions & 79 deletions packages/typespec-client-generator-core/test/package.test.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,20 @@ describe("typespec-client-generator-core: body model property types", () => {
(x) => x.kind === "property" && x.serializedName === "encodedWireName"
);
ok(jsonEncodedProp);
strictEqual(jsonEncodedProp.nameInClient, "jsonEncodedAndProjectedName");
strictEqual(jsonEncodedProp.name, "jsonEncodedAndProjectedName");

// wire name test with deprecated projected
const jsonProjectedProp = sdkModel.properties.find(
(x) => x.kind === "property" && x.serializedName === "realWireName"
);
ok(jsonProjectedProp);
strictEqual(jsonProjectedProp.nameInClient, "jsonProjectedName");
strictEqual(jsonProjectedProp.name, "jsonProjectedName");

// regular
const regularProp = sdkModel.properties.find(
(x) => x.kind === "property" && x.serializedName === "regular"
);
ok(regularProp);
strictEqual(regularProp.nameInClient, "regular");
strictEqual(regularProp.name, "regular");
});
it("union type", async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ describe("typespec-client-generator-core: model types", () => {
strictEqual(recursiveModel.properties.length, 1);
const prop = recursiveModel.properties[0];
strictEqual(prop.kind, "property");
strictEqual(prop.nameInClient, "prop");
strictEqual(prop.name, "prop");
strictEqual(prop.type.kind, "model");
strictEqual(prop.type.name, "RecursiveModel");
Expand Down
Loading