diff --git a/.chronus/changes/add_typespec_raw_doc-2024-7-15-16-7-32.md b/.chronus/changes/add_typespec_raw_doc-2024-7-15-16-7-32.md new file mode 100644 index 0000000000..89a45ffbab --- /dev/null +++ b/.chronus/changes/add_typespec_raw_doc-2024-7-15-16-7-32.md @@ -0,0 +1,7 @@ +--- +changeKind: feature +packages: + - "@azure-tools/typespec-client-generator-core" +--- + +add `doc` and `summary` to tcgc types \ No newline at end of file diff --git a/packages/typespec-client-generator-core/src/http.ts b/packages/typespec-client-generator-core/src/http.ts index dd3309a1a0..d6dde6d8a2 100644 --- a/packages/typespec-client-generator-core/src/http.ts +++ b/packages/typespec-client-generator-core/src/http.ts @@ -4,6 +4,8 @@ import { Operation, Type, createDiagnosticCollector, + getDoc, + getSummary, ignoreDiagnostics, isErrorModel, } from "@typespec/compiler"; @@ -163,6 +165,8 @@ function getSdkHttpParameters( 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, contentTypes: [], defaultContentType: "application/json", // actual content type info is added later @@ -192,6 +196,7 @@ function getSdkHttpParameters( 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")) { methodParameters.push({ @@ -412,6 +417,8 @@ function getSdkHttpResponseAndExceptions( __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), type: clientType, }); diff --git a/packages/typespec-client-generator-core/src/interfaces.ts b/packages/typespec-client-generator-core/src/interfaces.ts index f0cfe9e14b..fec31472db 100644 --- a/packages/typespec-client-generator-core/src/interfaces.ts +++ b/packages/typespec-client-generator-core/src/interfaces.ts @@ -98,8 +98,16 @@ export interface SdkClientType extends DecoratedType { 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; methods: SdkMethod[]; apiVersions: string[]; @@ -138,8 +146,16 @@ 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; } export type SdkType = @@ -410,8 +426,16 @@ 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[]; onClient: boolean; clientDefaultValue?: any; @@ -524,8 +548,16 @@ 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; } export interface SdkMethodResponse { @@ -578,8 +610,16 @@ 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; } diff --git a/packages/typespec-client-generator-core/src/package.ts b/packages/typespec-client-generator-core/src/package.ts index 25c7785163..ad2cb8de99 100644 --- a/packages/typespec-client-generator-core/src/package.ts +++ b/packages/typespec-client-generator-core/src/package.ts @@ -2,8 +2,10 @@ import { getLroMetadata, getPagedResult } from "@azure-tools/typespec-azure-core import { createDiagnosticCollector, Diagnostic, + getDoc, getNamespaceFullName, getService, + getSummary, ignoreDiagnostics, Operation, Type, @@ -255,6 +257,8 @@ function getSdkBasicServiceMethod parameters: methodParameters, description: getDocHelper(context, operation).description, details: getDocHelper(context, operation).details, + doc: getDoc(context.program, operation), + summary: getSummary(context.program, operation), operation: serviceOperation, response, apiVersions, @@ -338,6 +342,7 @@ function getSdkInitializationType( return diagnostics.wrap({ __raw: client.service, description: "Initialization class for the client", + doc: "Initialization class for the client", kind: "model", properties, name, @@ -368,6 +373,8 @@ function getSdkMethodParameter( kind: "method", description: getDocHelper(context, type).description, details: getDocHelper(context, type).details, + doc: getDoc(context.program, type), + summary: getSummary(context.program, type), apiVersions, type: propertyType, name, @@ -409,6 +416,8 @@ function getSdkMethods( 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", response: operationGroupClient, apiVersions: getAvailableApiVersions(context, operationGroup.type, client.type), @@ -434,6 +443,7 @@ function getEndpointTypeFromSingleServer( name: "endpoint", isGeneratedName: true, description: "Service host", + doc: "Service host", kind: "path", onClient: true, urlEncode: false, @@ -538,6 +548,7 @@ function getSdkEndpointParameter( name: "endpoint", isGeneratedName: true, description: "Service host", + doc: "Service host", onClient: true, urlEncode: false, apiVersions: context.__tspTypeToApiVersions.get(client.type)!, @@ -567,6 +578,8 @@ function createSdkClientType( name, description: docWrapper.description, details: docWrapper.details, + doc: getDoc(context.program, client.type), + summary: getSummary(context.program, client.type), methods: [], apiVersions: context.__tspTypeToApiVersions.get(client.type)!, nameSpace: getClientNamespaceStringHelper(context, client.service)!, diff --git a/packages/typespec-client-generator-core/src/types.ts b/packages/typespec-client-generator-core/src/types.ts index 4efd9532bf..66edc2fdcc 100644 --- a/packages/typespec-client-generator-core/src/types.ts +++ b/packages/typespec-client-generator-core/src/types.ts @@ -21,9 +21,11 @@ import { Union, createDiagnosticCollector, getDiscriminator, + getDoc, getEncode, getFormat, getKnownValues, + getSummary, getVisibility, ignoreDiagnostics, isErrorModel, @@ -265,6 +267,8 @@ function getSdkBuiltInTypeWithDiagnostics( encode: getEncodeHelper(context, type, kind), description: docWrapper.description, details: docWrapper.details, + doc: getDoc(context.program, type), + summary: getSummary(context.program, type), baseType: type.baseScalar && !context.program.checker.isStdType(type) // we only calculate the base type when this type has a base type and this type is not a std type because for std types there is no point of calculating its base type. ? diagnostics.pipe(getSdkBuiltInTypeWithDiagnostics(context, type.baseScalar, kind)) @@ -335,6 +339,8 @@ function getSdkDateTimeType( baseType: baseType, description: docWrapper.description, details: docWrapper.details, + doc: getDoc(context.program, type), + summary: getSummary(context.program, type), crossLanguageDefinitionId: getCrossLanguageDefinitionId(context, type), }); } @@ -434,6 +440,8 @@ function getSdkDurationTypeWithDiagnostics( baseType: baseType, description: docWrapper.description, details: docWrapper.details, + doc: getDoc(context.program, type), + summary: getSummary(context.program, type), crossLanguageDefinitionId: getCrossLanguageDefinitionId(context, type), }); } @@ -681,6 +689,7 @@ function addDiscriminatorToModelType( model.properties.splice(0, 0, { kind: "property", description: `Discriminator property for ${model.name}.`, + doc: `Discriminator property for ${model.name}.`, optional: false, discriminator: true, serializedName: discriminatorProperty @@ -732,6 +741,8 @@ export function getSdkModelWithDiagnostics( isGeneratedName: !type.name, description: docWrapper.description, details: docWrapper.details, + doc: getDoc(context.program, type), + summary: getSummary(context.program, type), properties: [], additionalProperties: undefined, // going to set additional properties in the next few lines when we look at base model access: "public", @@ -841,6 +852,8 @@ function getSdkEnumValueWithDiagnostics( value: type.value ?? type.name, description: docWrapper.description, details: docWrapper.details, + doc: getDoc(context.program, type), + summary: getSummary(context.program, type), enumType, valueType: enumType.valueType, }); @@ -865,6 +878,8 @@ function getSdkEnumWithDiagnostics( isGeneratedName: false, description: docWrapper.description, details: docWrapper.details, + doc: getDoc(context.program, type), + summary: getSummary(context.program, type), valueType: diagnostics.pipe(getSdkEnumValueType(context, type.members.values())), values: [], isFixed: true, // enums are always fixed after we switch to use union to represent extensible enum @@ -900,6 +915,8 @@ function getSdkUnionEnumValues( name: name ? name : `${member.value}`, description: docWrapper.description, details: docWrapper.details, + doc: getDoc(context.program, member.type), + summary: getSummary(context.program, member.type), value: member.value, valueType: enumType.valueType, enumType, @@ -929,6 +946,8 @@ export function getSdkUnionEnumWithDiagnostics( isGeneratedName: !type.union.name, description: docWrapper.description, details: docWrapper.details, + doc: getDoc(context.program, union), + summary: getSummary(context.program, union), valueType: diagnostics.pipe(getUnionAsEnumValueType(context, type.union)) ?? diagnostics.pipe(getSdkEnumValueType(context, type.flattenedMembers.values())), @@ -970,6 +989,8 @@ function getKnownValuesEnum( isGeneratedName: false, description: docWrapper.description, details: docWrapper.details, + doc: getDoc(context.program, type), + summary: getSummary(context.program, type), valueType: diagnostics.pipe(getSdkEnumValueType(context, knownValues.members.values())), values: [], isFixed: false, @@ -1152,6 +1173,7 @@ export function getSdkCredentialParameter( name, isGeneratedName: true, description: "Credential used to authenticate requests to the service.", + doc: "Credential used to authenticate requests to the service.", apiVersions: getAvailableApiVersions(context, client.service, client.type), onClient: true, optional: false, @@ -1182,6 +1204,8 @@ export function getSdkModelPropertyTypeBase( __raw: type, description: docWrapper.description, details: docWrapper.details, + doc: getDoc(context.program, type), + summary: getSummary(context.program, type), apiVersions, type: propertyType, name, diff --git a/packages/typespec-client-generator-core/test/package.test.ts b/packages/typespec-client-generator-core/test/package.test.ts index 04f877b87a..4e70085e27 100644 --- a/packages/typespec-client-generator-core/test/package.test.ts +++ b/packages/typespec-client-generator-core/test/package.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable deprecation/deprecation */ import { AzureCoreTestLibrary } from "@azure-tools/typespec-azure-core/testing"; import { ApiKeyAuth, OAuth2Flow, Oauth2Auth } from "@typespec/http"; import { deepStrictEqual, ok, strictEqual } from "assert"; @@ -142,7 +141,7 @@ describe("typespec-client-generator-core: package", () => { strictEqual(templateArg.kind, "path"); strictEqual(templateArg.name, "endpoint"); strictEqual(templateArg.serializedName, "endpoint"); - strictEqual(templateArg.urlEncode, false); + strictEqual(templateArg.urlEncode, false); // eslint-disable-line deprecation/deprecation strictEqual(templateArg.type.kind, "string"); strictEqual(templateArg.optional, false); strictEqual(templateArg.onClient, true); @@ -334,11 +333,12 @@ describe("typespec-client-generator-core: package", () => { const templateArg = endpointParam.type.templateArguments[0]; strictEqual(templateArg.kind, "path"); strictEqual(templateArg.name, "endpointInput"); - strictEqual(templateArg.urlEncode, false); + strictEqual(templateArg.urlEncode, false); // eslint-disable-line deprecation/deprecation strictEqual(templateArg.optional, false); strictEqual(templateArg.onClient, true); strictEqual(templateArg.clientDefaultValue, undefined); - strictEqual(templateArg.description, undefined); + strictEqual(templateArg.description, undefined); // eslint-disable-line deprecation/deprecation + strictEqual(templateArg.doc, undefined); const credentialParam = client.initialization.properties.filter( (p): p is SdkCredentialParameter => p.kind === "credential" @@ -422,7 +422,7 @@ describe("typespec-client-generator-core: package", () => { const apiVersionParam = templatedEndpoint.templateArguments[1]; strictEqual(apiVersionParam.clientDefaultValue, "v1.0"); - strictEqual(apiVersionParam.urlEncode, true); + strictEqual(apiVersionParam.urlEncode, true); // eslint-disable-line deprecation/deprecation strictEqual(apiVersionParam.name, "apiVersion"); strictEqual(apiVersionParam.onClient, true); strictEqual(apiVersionParam.optional, false); diff --git a/packages/typespec-client-generator-core/test/public-utils.test.ts b/packages/typespec-client-generator-core/test/public-utils.test.ts index 6d30073c5e..69d2e99425 100644 --- a/packages/typespec-client-generator-core/test/public-utils.test.ts +++ b/packages/typespec-client-generator-core/test/public-utils.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable deprecation/deprecation */ import { AzureCoreTestLibrary } from "@azure-tools/typespec-azure-core/testing"; import { Model, diff --git a/packages/typespec-client-generator-core/test/types/body-model-property-types.test.ts b/packages/typespec-client-generator-core/test/types/body-model-property-types.test.ts index 2ad49efa50..a3cd77f83b 100644 --- a/packages/typespec-client-generator-core/test/types/body-model-property-types.test.ts +++ b/packages/typespec-client-generator-core/test/types/body-model-property-types.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable deprecation/deprecation */ import { deepStrictEqual, ok, strictEqual } from "assert"; import { beforeEach, describe, it } from "vitest"; import { isReadOnly } from "../../src/types.js"; diff --git a/packages/typespec-client-generator-core/test/types/built-in-types.test.ts b/packages/typespec-client-generator-core/test/types/built-in-types.test.ts index df986bb75d..7f97883ffb 100644 --- a/packages/typespec-client-generator-core/test/types/built-in-types.test.ts +++ b/packages/typespec-client-generator-core/test/types/built-in-types.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable deprecation/deprecation */ import { AzureCoreTestLibrary } from "@azure-tools/typespec-azure-core/testing"; import { expectDiagnostics } from "@typespec/compiler/testing"; import { ok, strictEqual } from "assert"; @@ -397,8 +396,10 @@ describe("typespec-client-generator-core: built-in types", () => { const type = models[0].properties[0].type; strictEqual(type.kind, "string"); strictEqual(type.name, "TestScalar"); - strictEqual(type.description, "title"); - strictEqual(type.details, "doc"); + strictEqual(type.description, "title"); // eslint-disable-line deprecation/deprecation + strictEqual(type.details, "doc"); // eslint-disable-line deprecation/deprecation + strictEqual(type.doc, "doc"); + strictEqual(type.summary, "title"); strictEqual(type.crossLanguageDefinitionId, "TestService.TestScalar"); }); diff --git a/packages/typespec-client-generator-core/test/types/date-time-types.test.ts b/packages/typespec-client-generator-core/test/types/date-time-types.test.ts index e2aadb482a..926f40b27b 100644 --- a/packages/typespec-client-generator-core/test/types/date-time-types.test.ts +++ b/packages/typespec-client-generator-core/test/types/date-time-types.test.ts @@ -164,8 +164,10 @@ describe("typespec-client-generator-core: date-time types", () => { strictEqual(sdkType.valueType.name, "unixTimestampDateTime"); strictEqual(sdkType.valueType.encode, "unixTimestamp"); strictEqual(sdkType.valueType.wireType?.kind, "int64"); - strictEqual(sdkType.valueType.description, "title"); - strictEqual(sdkType.valueType.details, "doc"); + strictEqual(sdkType.valueType.description, "title"); // eslint-disable-line deprecation/deprecation + strictEqual(sdkType.valueType.details, "doc"); // eslint-disable-line deprecation/deprecation + strictEqual(sdkType.valueType.doc, "doc"); + strictEqual(sdkType.valueType.summary, "title"); strictEqual(sdkType.valueType.crossLanguageDefinitionId, "TestService.unixTimestampDateTime"); strictEqual(sdkType.valueType.baseType?.kind, "utcDateTime"); strictEqual(sdkType.valueType.baseType.wireType.kind, "string"); diff --git a/packages/typespec-client-generator-core/test/types/doc-summary.test.ts b/packages/typespec-client-generator-core/test/types/doc-summary.test.ts new file mode 100644 index 0000000000..aefa151ff4 --- /dev/null +++ b/packages/typespec-client-generator-core/test/types/doc-summary.test.ts @@ -0,0 +1,25 @@ +import { strictEqual } from "assert"; +import { beforeEach, describe, it } from "vitest"; +import { createSdkTestRunner, SdkTestRunner } from "../test-host.js"; + +describe("typespec-client-generator-core: doc and summary", () => { + let runner: SdkTestRunner; + + beforeEach(async () => { + runner = await createSdkTestRunner({ emitterName: "@azure-tools/typespec-java" }); + }); + + it("unicode", async () => { + await runner.compileWithBuiltInService(` + @usage(Usage.input | Usage.output) + @doc("测试doc") + @summary("测试summary") + model Test {} + `); + + const models = runner.context.sdkPackage.models; + strictEqual(models.length, 1); + strictEqual(models[0].doc, "测试doc"); + strictEqual(models[0].summary, "测试summary"); + }); +}); diff --git a/packages/typespec-client-generator-core/test/types/duration-type.test.ts b/packages/typespec-client-generator-core/test/types/duration-type.test.ts index 90ca69ab52..a095b66c13 100644 --- a/packages/typespec-client-generator-core/test/types/duration-type.test.ts +++ b/packages/typespec-client-generator-core/test/types/duration-type.test.ts @@ -109,8 +109,10 @@ describe("typespec-client-generator-core: duration types", () => { strictEqual(sdkType.kind, "array"); strictEqual(sdkType.valueType.kind, "duration"); strictEqual(sdkType.valueType.name, "Float32Duration"); - strictEqual(sdkType.valueType.description, "title"); - strictEqual(sdkType.valueType.details, "doc"); + strictEqual(sdkType.valueType.description, "title"); // eslint-disable-line deprecation/deprecation + strictEqual(sdkType.valueType.details, "doc"); // eslint-disable-line deprecation/deprecation + strictEqual(sdkType.valueType.doc, "doc"); + strictEqual(sdkType.valueType.summary, "title"); // the encode and wireType will only be added to the outer type strictEqual(sdkType.valueType.encode, "seconds"); strictEqual(sdkType.valueType.crossLanguageDefinitionId, "TestService.Float32Duration"); diff --git a/packages/typespec-client-generator-core/test/types/model-types.test.ts b/packages/typespec-client-generator-core/test/types/model-types.test.ts index 658c614c5d..9a0d9ac900 100644 --- a/packages/typespec-client-generator-core/test/types/model-types.test.ts +++ b/packages/typespec-client-generator-core/test/types/model-types.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable deprecation/deprecation */ import { AzureCoreTestLibrary } from "@azure-tools/typespec-azure-core/testing"; import { isErrorModel } from "@typespec/compiler"; import { deepStrictEqual, ok, strictEqual } from "assert"; @@ -187,7 +186,8 @@ describe("typespec-client-generator-core: model types", () => { const kindProperty = fish.properties[0]; ok(kindProperty); strictEqual(kindProperty.name, "kind"); - strictEqual(kindProperty.description, "Discriminator property for Fish."); + strictEqual(kindProperty.description, "Discriminator property for Fish."); // eslint-disable-line deprecation/deprecation + strictEqual(kindProperty.doc, "Discriminator property for Fish."); strictEqual(kindProperty.kind, "property"); strictEqual(kindProperty.discriminator, true); strictEqual(kindProperty.type.kind, "string"); @@ -199,7 +199,8 @@ describe("typespec-client-generator-core: model types", () => { const sharktypeProperty = shark.properties[0]; ok(sharktypeProperty); strictEqual(sharktypeProperty.name, "sharktype"); - strictEqual(sharktypeProperty.description, "Discriminator property for Shark."); + strictEqual(sharktypeProperty.description, "Discriminator property for Shark."); // eslint-disable-line deprecation/deprecation + strictEqual(sharktypeProperty.doc, "Discriminator property for Shark."); strictEqual(sharktypeProperty.kind, "property"); strictEqual(sharktypeProperty.discriminator, true); strictEqual(sharktypeProperty.type.kind, "string"); @@ -230,7 +231,8 @@ describe("typespec-client-generator-core: model types", () => { const kindProperty = fish.properties[0]; ok(kindProperty); strictEqual(kindProperty.name, "kind"); - strictEqual(kindProperty.description, "Discriminator property for Fish."); + strictEqual(kindProperty.description, "Discriminator property for Fish."); // eslint-disable-line deprecation/deprecation + strictEqual(kindProperty.doc, "Discriminator property for Fish."); strictEqual(kindProperty.kind, "property"); strictEqual(kindProperty.discriminator, true); strictEqual(kindProperty.type.kind, "string"); @@ -262,7 +264,8 @@ describe("typespec-client-generator-core: model types", () => { const kindProperty = fish.properties[0]; ok(kindProperty); strictEqual(kindProperty.name, "kind"); - strictEqual(kindProperty.description, "Discriminator property for Fish."); + strictEqual(kindProperty.description, "Discriminator property for Fish."); // eslint-disable-line deprecation/deprecation + strictEqual(kindProperty.doc, "Discriminator property for Fish."); strictEqual(kindProperty.kind, "property"); strictEqual(kindProperty.discriminator, true); strictEqual(kindProperty.type.kind, "string"); @@ -365,7 +368,8 @@ describe("typespec-client-generator-core: model types", () => { const catValue = values.find((x) => x.name === "Cat"); ok(catValue); strictEqual(catValue.value, "cat"); - strictEqual(catValue.description, "Cat"); + strictEqual(catValue.description, "Cat"); // eslint-disable-line deprecation/deprecation + strictEqual(catValue.doc, "Cat"); strictEqual(catValue.enumType, petKind); strictEqual(catValue.valueType, petKind.valueType); strictEqual(catValue.kind, "enumvalue"); @@ -373,7 +377,8 @@ describe("typespec-client-generator-core: model types", () => { const dogValue = values.find((x) => x.name === "Dog"); ok(dogValue); strictEqual(dogValue.value, "dog"); - strictEqual(dogValue.description, "Dog"); + strictEqual(dogValue.description, "Dog"); // eslint-disable-line deprecation/deprecation + strictEqual(dogValue.doc, "Dog"); strictEqual(dogValue.enumType, petKind); strictEqual(dogValue.valueType, petKind.valueType); strictEqual(dogValue.kind, "enumvalue"); @@ -494,7 +499,8 @@ describe("typespec-client-generator-core: model types", () => { const dogKindProperty = dog.properties[0]; ok(dogKindProperty); strictEqual(dogKindProperty.type, dogKind); - strictEqual(dogKindProperty.description, "Discriminator property for Dog."); + strictEqual(dogKindProperty.description, "Discriminator property for Dog."); // eslint-disable-line deprecation/deprecation + strictEqual(dogKindProperty.doc, "Discriminator property for Dog."); }); it("discriminator", async () => { diff --git a/packages/typespec-client-generator-core/test/types/multipart-types.test.ts b/packages/typespec-client-generator-core/test/types/multipart-types.test.ts index 8ad3e632fa..6f351daada 100644 --- a/packages/typespec-client-generator-core/test/types/multipart-types.test.ts +++ b/packages/typespec-client-generator-core/test/types/multipart-types.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable deprecation/deprecation */ import { expectDiagnostics } from "@typespec/compiler/testing"; import { deepEqual, ok, strictEqual } from "assert"; import { beforeEach, describe, it } from "vitest"; @@ -32,7 +31,7 @@ describe("typespec-client-generator-core: multipart types", () => { strictEqual(models.length, 1); const model = models[0]; strictEqual(model.kind, "model"); - strictEqual(model.isFormDataType, true); + strictEqual(model.isFormDataType, true); // eslint-disable-line deprecation/deprecation ok((model.usage & UsageFlags.MultipartFormData) > 0); strictEqual(model.name, "MultiPartRequest"); strictEqual(model.properties.length, 2); @@ -85,7 +84,7 @@ describe("typespec-client-generator-core: multipart types", () => { const modelA = models.find((x) => x.name === "MultipartOperationRequest"); ok(modelA); strictEqual(modelA.kind, "model"); - strictEqual(modelA.isFormDataType, true); + strictEqual(modelA.isFormDataType, true); // eslint-disable-line deprecation/deprecation strictEqual(modelA.usage, UsageFlags.MultipartFormData | UsageFlags.Spread); strictEqual(modelA.properties.length, 1); const modelAProp = modelA.properties[0]; @@ -97,7 +96,7 @@ describe("typespec-client-generator-core: multipart types", () => { const modelB = models.find((x) => x.name === "NormalOperationRequest"); ok(modelB); strictEqual(modelB.kind, "model"); - strictEqual(modelB.isFormDataType, false); + strictEqual(modelB.isFormDataType, false); // eslint-disable-line deprecation/deprecation strictEqual(modelB.usage, UsageFlags.Spread | UsageFlags.Json); strictEqual(modelB.properties.length, 1); strictEqual(modelB.properties[0].type.kind, "bytes"); @@ -186,13 +185,13 @@ describe("typespec-client-generator-core: multipart types", () => { const pictureWrapper = models.find((x) => x.name === "PictureWrapper"); ok(pictureWrapper); - strictEqual(pictureWrapper.isFormDataType, true); + strictEqual(pictureWrapper.isFormDataType, true); // eslint-disable-line deprecation/deprecation ok((pictureWrapper.usage & UsageFlags.MultipartFormData) > 0); const errorResponse = models.find((x) => x.name === "ErrorResponse"); ok(errorResponse); strictEqual(errorResponse.kind, "model"); - strictEqual(errorResponse.isFormDataType, false); + strictEqual(errorResponse.isFormDataType, false); // eslint-disable-line deprecation/deprecation ok((errorResponse.usage & UsageFlags.MultipartFormData) === 0); });