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 description details #1560

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: deprecation
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be marked deprecation or just bug fix since we deprecated it in a previous version

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i label it with breaking change in previous pr.

packages:
- "@azure-tools/typespec-client-generator-core"
---

Remove `.description` and `.details` from deprecated api surface
4 changes: 2 additions & 2 deletions packages/typespec-client-generator-core/src/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function handleHttpOperationExamples(
const operationExample: SdkHttpOperationExample = {
kind: "http",
name: title,
description: title,
doc: title,
filePath: example.relativePath,
parameters: diagnostics.pipe(
handleHttpParameters(
Expand Down Expand Up @@ -355,7 +355,7 @@ function handleHttpResponse(
};
if (typeof example === "object" && example !== null) {
for (const name of Object.keys(example)) {
if (name === "description") {
if (name === "doc") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a hard coded property in current json example, no need to change it to doc.

continue;
} else if (name === "body") {
if (response.type) {
Expand Down
6 changes: 0 additions & 6 deletions packages/typespec-client-generator-core/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import {
} from "./interfaces.js";
import {
getAvailableApiVersions,
getDocHelper,
getHttpBodySpreadModel,
getHttpOperationResponseHeaders,
getLocationOfOperation,
Expand Down Expand Up @@ -182,8 +181,6 @@ function getSdkHttpParameters(
kind: "body",
name,
isGeneratedName: true,
description: getDocHelper(context, tspBody.type).description,
details: getDocHelper(context, tspBody.type).details,
doc: getDoc(context.program, tspBody.type),
summary: getSummary(context.program, tspBody.type),
onClient: false,
Expand Down Expand Up @@ -214,7 +211,6 @@ function getSdkHttpParameters(
// if we have a body param and no content type header, we add one
const contentTypeBase = {
...createContentTypeOrAcceptHeader(context, httpOperation, retval.bodyParam),
description: `Body parameter's content type. Known values are ${retval.bodyParam.contentTypes}`,
doc: `Body parameter's content type. Known values are ${retval.bodyParam.contentTypes}`,
};
if (!methodParameters.some((m) => m.name === "contentType")) {
Expand Down Expand Up @@ -434,8 +430,6 @@ function getSdkHttpResponseAndExceptions(
addEncodeInfo(context, header, clientType, defaultContentType);
headers.push({
__raw: header,
description: getDocHelper(context, header).description,
details: getDocHelper(context, header).details,
doc: getDoc(context.program, header),
summary: getSummary(context.program, header),
serializedName: getHeaderFieldName(context.program, header),
Expand Down
42 changes: 1 addition & 41 deletions packages/typespec-client-generator-core/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@ export interface SdkClientType<TServiceOperation extends SdkServiceOperation>
__raw: SdkClient | SdkOperationGroup;
kind: "client";
name: string;
/**
* @deprecated Use `doc` and `summary` instead.
*/
description?: string;
/**
* @deprecated Use `doc` and `summary` instead.
*/
details?: string;
doc?: string;
summary?: string;
initialization: SdkInitializationType;
Expand Down Expand Up @@ -136,14 +128,6 @@ interface SdkTypeBase extends DecoratedType {
__raw?: Type;
kind: string;
deprecation?: string;
/**
* @deprecated Use `doc` and `summary` instead.
*/
description?: string;
/**
* @deprecated Use `doc` and `summary` instead.
*/
details?: string;
doc?: string;
summary?: string;
__accessSet?: boolean;
Expand Down Expand Up @@ -402,14 +386,6 @@ export interface SdkModelPropertyTypeBase extends DecoratedType {
type: SdkType;
name: string;
isGeneratedName: boolean;
/**
* @deprecated Use `doc` and `summary` instead.
*/
description?: string;
/**
* @deprecated Use `doc` and `summary` instead.
*/
details?: string;
doc?: string;
summary?: string;
apiVersions: string[];
Expand Down Expand Up @@ -524,14 +500,6 @@ export interface SdkServiceResponseHeader {
__raw: ModelProperty;
serializedName: string;
type: SdkType;
/**
* @deprecated Use `doc` and `summary` instead.
*/
description?: string;
/**
* @deprecated Use `doc` and `summary` instead.
*/
details?: string;
doc?: string;
summary?: string;
}
Expand Down Expand Up @@ -587,14 +555,6 @@ interface SdkMethodBase extends DecoratedType {
access: AccessFlags;
parameters: SdkParameter[];
apiVersions: string[];
/**
* @deprecated Use `doc` and `summary` instead.
*/
description?: string;
/**
* @deprecated Use `doc` and `summary` instead.
*/
details?: string;
doc?: string;
summary?: string;
crossLanguageDefintionId: string;
Expand Down Expand Up @@ -751,7 +711,7 @@ export enum UsageFlags {
interface SdkExampleBase {
kind: string;
name: string;
description: string;
doc: string;
filePath: string;
rawExample: any;
}
Expand Down
26 changes: 0 additions & 26 deletions packages/typespec-client-generator-core/src/internal-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import {
createDiagnosticCollector,
Diagnostic,
getDeprecationDetails,
getDoc,
getNamespaceFullName,
getSummary,
Interface,
isNeverType,
isNullType,
Expand Down Expand Up @@ -208,30 +206,6 @@ export function getAvailableApiVersions(
return retval;
}

interface DocWrapper {
description?: string;
details?: string;
}

/**
*
* @param context
* @param type
* @returns Returns the description and details of a type
*/
export function getDocHelper(context: TCGCContext, type: Type): DocWrapper {
const program = context.program;
if (getSummary(program, type)) {
return {
description: getSummary(program, type),
details: getDoc(program, type),
};
}
return {
description: getDoc(program, type),
};
}

/**
*
* @param type
Expand Down
12 changes: 0 additions & 12 deletions packages/typespec-client-generator-core/src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ import {
getAllResponseBodiesAndNonBodyExists,
getAvailableApiVersions,
getClientNamespaceStringHelper,
getDocHelper,
getHashForType,
getLocationOfOperation,
getTypeDecorators,
Expand Down Expand Up @@ -322,8 +321,6 @@ function getSdkBasicServiceMethod<TServiceOperation extends SdkServiceOperation>
name,
access: getAccess(context, operation) ?? "public",
parameters: methodParameters,
description: getDocHelper(context, operation).description,
details: getDocHelper(context, operation).details,
doc: getDoc(context.program, operation),
summary: getSummary(context.program, operation),
operation: serviceOperation,
Expand Down Expand Up @@ -429,8 +426,6 @@ function getSdkMethodParameter(
const propertyType = diagnostics.pipe(getClientTypeWithDiagnostics(context, type, operation));
return diagnostics.wrap({
kind: "method",
description: getDocHelper(context, type).description,
details: getDocHelper(context, type).details,
doc: getDoc(context.program, type),
summary: getSummary(context.program, type),
apiVersions,
Expand Down Expand Up @@ -480,8 +475,6 @@ function getSdkMethods<TServiceOperation extends SdkServiceOperation>(
kind: "clientaccessor",
parameters,
name,
description: getDocHelper(context, operationGroup.type).description,
details: getDocHelper(context, operationGroup.type).details,
doc: getDoc(context.program, operationGroup.type),
summary: getSummary(context.program, operationGroup.type),
access: "internal",
Expand Down Expand Up @@ -510,7 +503,6 @@ function getEndpointTypeFromSingleServer<
{
name: "endpoint",
isGeneratedName: true,
description: "Service host",
doc: "Service host",
kind: "path",
onClient: true,
Expand Down Expand Up @@ -616,7 +608,6 @@ function getSdkEndpointParameter<TServiceOperation extends SdkServiceOperation =
type,
name: "endpoint",
isGeneratedName: true,
description: "Service host",
doc: "Service host",
onClient: true,
urlEncode: false,
Expand All @@ -641,13 +632,10 @@ function createSdkClientType<TServiceOperation extends SdkServiceOperation>(
} else {
name = getClientNameOverride(context, client.type) ?? client.type.name;
}
const docWrapper = getDocHelper(context, client.type);
const sdkClientType: SdkClientType<TServiceOperation> = {
__raw: client,
kind: "client",
name,
description: docWrapper.description,
details: docWrapper.details,
doc: getDoc(context.program, client.type),
summary: getSummary(context.program, client.type),
methods: [],
Expand Down
Loading
Loading