From 03d2e4c7041e46077be50534ace92d2131696658 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Fri, 29 Nov 2024 17:17:47 +0800 Subject: [PATCH 1/3] add ut for error models in MPG if it is not referenced --- common/config/rush/pnpm-lock.yaml | 26 ++-- packages/typespec-test/package.json | 2 +- .../review/arm-networkanalytics.api.md | 20 --- .../sdk/test/arm-test/src/index.ts | 3 - .../sdk/test/arm-test/src/models/index.ts | 3 - .../sdk/test/arm-test/src/models/models.ts | 86 ------------- .../review/ai-anomaly-detector.api.md | 9 -- .../generated/typespec-ts/src/index.ts | 2 - .../generated/typespec-ts/src/models/index.ts | 2 - .../typespec-ts/src/models/models.ts | 31 ----- .../typespec-ts/review/openai-generic.api.md | 18 --- .../generated/typespec-ts/src/index.ts | 2 - .../generated/typespec-ts/src/models/index.ts | 2 - .../typespec-ts/src/models/models.ts | 28 ----- .../review/openai-non-branded.api.md | 18 --- .../generated/typespec-ts/src/index.ts | 2 - .../generated/typespec-ts/src/models/index.ts | 2 - .../typespec-ts/src/models/models.ts | 28 ----- .../generated/typespec-ts/package.json | 109 +--------------- .../typespec-ts/review/schema-registry.api.md | 118 ------------------ .../typespec-ts/review/widget_dpg.api.md | 6 - .../generated/typespec-ts/src/index.ts | 1 - .../generated/typespec-ts/src/models/index.ts | 1 - .../typespec-ts/src/models/models.ts | 15 --- packages/typespec-ts/package.json | 4 +- .../authentication/api-key/src/index.d.ts | 4 - .../authentication/http/custom/src/index.d.ts | 4 - .../authentication/oauth2/src/index.d.ts | 4 - .../common-properties/src/index.d.ts | 17 --- .../resource-manager/resources/src/index.d.ts | 17 --- 30 files changed, 22 insertions(+), 562 deletions(-) delete mode 100644 packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 014d1e7a6a..afbe0a639f 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -195,7 +195,7 @@ importers: '@azure-tools/typespec-azure-core': '>=0.48.0 <1.0.0' '@azure-tools/typespec-azure-resource-manager': '>=0.48.0 <1.0.0' '@azure-tools/typespec-azure-rulesets': '>=0.48.0 <1.0.0' - '@azure-tools/typespec-client-generator-core': '>=0.48.0 <1.0.0' + '@azure-tools/typespec-client-generator-core': '>=0.48.3 <1.0.0' '@azure-tools/typespec-ts': workspace:^0.34.0 '@types/mocha': ^5.2.7 '@types/node': ^18.0.0 @@ -209,11 +209,11 @@ importers: ts-node: ^8.5.2 typescript: ~5.6.2 dependencies: - '@azure-tools/typespec-autorest': 0.48.0_ox3wjptpcck6ih5jxiqdmkmsau + '@azure-tools/typespec-autorest': 0.48.0_oxyscq5ldpbiqyqn7seen263ii '@azure-tools/typespec-azure-core': 0.48.0_aaegv3jydxpwng7gbukr25tg2m '@azure-tools/typespec-azure-resource-manager': 0.48.0_xptzwysxh7uiycxgwx225suwku - '@azure-tools/typespec-azure-rulesets': 0.48.0_eibu3mzdg6wb26jplwmxghr54m - '@azure-tools/typespec-client-generator-core': 0.48.1_xptzwysxh7uiycxgwx225suwku + '@azure-tools/typespec-azure-rulesets': 0.48.0_rkphdz4biyq4ogc7tvoxdxosym + '@azure-tools/typespec-client-generator-core': 0.48.3_xptzwysxh7uiycxgwx225suwku '@azure-tools/typespec-ts': link:../typespec-ts '@typespec/compiler': 0.62.0 '@typespec/http': 0.62.0_@typespec+compiler@0.62.0 @@ -239,7 +239,7 @@ importers: '@azure-tools/typespec-autorest': '>=0.48.0 <1.0.0' '@azure-tools/typespec-azure-core': '>=0.48.0 <1.0.0' '@azure-tools/typespec-azure-resource-manager': '>=0.48.0 <1.0.0' - '@azure-tools/typespec-client-generator-core': '>=0.48.0 <1.0.0' + '@azure-tools/typespec-client-generator-core': '>=0.48.3 <1.0.0' '@azure/abort-controller': ^2.1.2 '@azure/core-auth': ^1.6.0 '@azure/core-lro': ^3.1.0 @@ -294,10 +294,10 @@ importers: '@azure-tools/cadl-ranch-api': 0.5.0 '@azure-tools/cadl-ranch-expect': 0.15.6_f5giq3reeireto67b6daw62k5y '@azure-tools/cadl-ranch-specs': 0.39.2_fm5bpb4bfczzprftnu3bq22rpm - '@azure-tools/typespec-autorest': 0.48.0_ox3wjptpcck6ih5jxiqdmkmsau + '@azure-tools/typespec-autorest': 0.48.0_oxyscq5ldpbiqyqn7seen263ii '@azure-tools/typespec-azure-core': 0.48.0_aaegv3jydxpwng7gbukr25tg2m '@azure-tools/typespec-azure-resource-manager': 0.48.0_xptzwysxh7uiycxgwx225suwku - '@azure-tools/typespec-client-generator-core': 0.48.1_xptzwysxh7uiycxgwx225suwku + '@azure-tools/typespec-client-generator-core': 0.48.3_xptzwysxh7uiycxgwx225suwku '@azure/abort-controller': 2.1.2 '@azure/core-auth': 1.6.0 '@azure/core-lro': 3.1.0 @@ -550,7 +550,7 @@ packages: - supports-color dev: true - /@azure-tools/typespec-autorest/0.48.0_ox3wjptpcck6ih5jxiqdmkmsau: + /@azure-tools/typespec-autorest/0.48.0_oxyscq5ldpbiqyqn7seen263ii: resolution: {integrity: sha512-AyoNMq3EORugHynFF8bN0TJh+zYxui/ApU5DoVEL7Xr1yMD6k9p5b90VD4HiCsP0dz8470ApFnjt5Vl6xCSzig==} engines: {node: '>=18.0.0'} peerDependencies: @@ -565,7 +565,7 @@ packages: dependencies: '@azure-tools/typespec-azure-core': 0.48.0_aaegv3jydxpwng7gbukr25tg2m '@azure-tools/typespec-azure-resource-manager': 0.48.0_xptzwysxh7uiycxgwx225suwku - '@azure-tools/typespec-client-generator-core': 0.48.1_xptzwysxh7uiycxgwx225suwku + '@azure-tools/typespec-client-generator-core': 0.48.3_xptzwysxh7uiycxgwx225suwku '@typespec/compiler': 0.62.0 '@typespec/http': 0.62.0_@typespec+compiler@0.62.0 '@typespec/openapi': 0.62.0_ehpjn7t5lr2snllrxt4bmumehe @@ -604,7 +604,7 @@ packages: change-case: 5.4.4 pluralize: 8.0.0 - /@azure-tools/typespec-azure-rulesets/0.48.0_eibu3mzdg6wb26jplwmxghr54m: + /@azure-tools/typespec-azure-rulesets/0.48.0_rkphdz4biyq4ogc7tvoxdxosym: resolution: {integrity: sha512-IkPxC8v9wVSl/eKU7N4NhqD3RPh+bIYpxDW5LBAhkuQVcE3RumAkWqh2pmkckihQRhgwiCXhcJVZAzBpVa5SUA==} engines: {node: '>=18.0.0'} peerDependencies: @@ -615,12 +615,12 @@ packages: dependencies: '@azure-tools/typespec-azure-core': 0.48.0_aaegv3jydxpwng7gbukr25tg2m '@azure-tools/typespec-azure-resource-manager': 0.48.0_xptzwysxh7uiycxgwx225suwku - '@azure-tools/typespec-client-generator-core': 0.48.1_xptzwysxh7uiycxgwx225suwku + '@azure-tools/typespec-client-generator-core': 0.48.3_xptzwysxh7uiycxgwx225suwku '@typespec/compiler': 0.62.0 dev: false - /@azure-tools/typespec-client-generator-core/0.48.1_xptzwysxh7uiycxgwx225suwku: - resolution: {integrity: sha512-pYEZDExltNNLAaA12EwEag5VLESyPoKNQQ/6Olj4rJouA4cBjZDTW80VYgKuPQBt/uCtA0Yn6xxl0nH7TGOwWQ==} + /@azure-tools/typespec-client-generator-core/0.48.3_xptzwysxh7uiycxgwx225suwku: + resolution: {integrity: sha512-EWyET1EXCee6TYfxway57L+SQdQurRZ8NuOWgenRjQf/Ja/0+Ht3IYfbFoqIYS2+/uFpLeotYCd4hUPjsW0Jwg==} engines: {node: '>=18.0.0'} peerDependencies: '@azure-tools/typespec-azure-core': ~0.48.0 diff --git a/packages/typespec-test/package.json b/packages/typespec-test/package.json index 471a93033a..5d927ccff0 100644 --- a/packages/typespec-test/package.json +++ b/packages/typespec-test/package.json @@ -8,7 +8,7 @@ "@azure-tools/typespec-autorest": ">=0.48.0 <1.0.0", "@typespec/openapi3": ">=0.62.0 <1.0.0", "@azure-tools/typespec-azure-core": ">=0.48.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.48.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.48.3 <1.0.0", "@azure-tools/typespec-azure-resource-manager": ">=0.48.0 <1.0.0", "@azure-tools/typespec-azure-rulesets": ">=0.48.0 <1.0.0", "@typespec/compiler": ">=0.62.0 <1.0.0", diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md index b94c06df1c..9d4e6f04bf 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/review/arm-networkanalytics.api.md @@ -307,26 +307,6 @@ export interface EncryptionKeyDetails { keyVersion: string; } -// @public -export interface ErrorAdditionalInfo { - readonly info?: Record; - readonly type?: string; -} - -// @public -export interface ErrorDetail { - readonly additionalInfo?: ErrorAdditionalInfo[]; - readonly code?: string; - readonly details?: ErrorDetail[]; - readonly message?: string; - readonly target?: string; -} - -// @public -export interface ErrorResponse { - error?: ErrorDetail; -} - // @public export interface IPRules { action: string; diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/index.ts index 47275e60fd..ffc8e35dae 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/index.ts @@ -33,9 +33,6 @@ export { SystemData, KnownCreatedByType, CreatedByType, - ErrorResponse, - ErrorDetail, - ErrorAdditionalInfo, DataProductUpdate, DataProductUpdateProperties, AccountSas, diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/index.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/index.ts index dfac36d796..da8dd58662 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/index.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/index.ts @@ -25,9 +25,6 @@ export { SystemData, KnownCreatedByType, CreatedByType, - ErrorResponse, - ErrorDetail, - ErrorAdditionalInfo, DataProductUpdate, DataProductUpdateProperties, AccountSas, diff --git a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/models.ts b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/models.ts index 44958af454..89a33448f7 100644 --- a/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/models.ts +++ b/packages/typespec-test/test/NetworkAnalytics.Management/generated/typespec-ts/sdk/test/arm-test/src/models/models.ts @@ -647,92 +647,6 @@ export enum KnownCreatedByType { */ export type CreatedByType = string; -/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ -export interface ErrorResponse { - /** The error object. */ - error?: ErrorDetail; -} - -export function errorResponseDeserializer(item: any): ErrorResponse { - return { - error: !item["error"] - ? item["error"] - : errorDetailDeserializer(item["error"]), - }; -} - -/** The error detail. */ -export interface ErrorDetail { - /** The error code. */ - readonly code?: string; - /** The error message. */ - readonly message?: string; - /** The error target. */ - readonly target?: string; - /** The error details. */ - readonly details?: ErrorDetail[]; - /** The error additional info. */ - readonly additionalInfo?: ErrorAdditionalInfo[]; -} - -export function errorDetailDeserializer(item: any): ErrorDetail { - return { - code: item["code"], - message: item["message"], - target: item["target"], - details: !item["details"] - ? item["details"] - : errorDetailArrayDeserializer(item["details"]), - additionalInfo: !item["additionalInfo"] - ? item["additionalInfo"] - : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), - }; -} - -export function errorDetailArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return errorDetailDeserializer(item); - }); -} - -export function errorAdditionalInfoArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return errorAdditionalInfoDeserializer(item); - }); -} - -/** The resource management error additional info. */ -export interface ErrorAdditionalInfo { - /** The additional info type. */ - readonly type?: string; - /** The additional info. */ - readonly info?: Record; -} - -export function errorAdditionalInfoDeserializer( - item: any, -): ErrorAdditionalInfo { - return { - type: item["type"], - info: !item["info"] - ? item["info"] - : _errorAdditionalInfoInfoDeserializer(item["info"]), - }; -} - -/** model interface _ErrorAdditionalInfoInfo */ -export interface _ErrorAdditionalInfoInfo {} - -export function _errorAdditionalInfoInfoDeserializer( - item: any, -): _ErrorAdditionalInfoInfo { - return item; -} - /** The type used for update operations of the DataProduct. */ export interface DataProductUpdate { /** The managed service identities assigned to this resource. */ diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md index 0e724ef35a..a67df11f8a 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/review/ai-anomaly-detector.api.md @@ -228,15 +228,6 @@ export interface PageSettings { continuationToken?: string; } -// @public -export interface UnivariateAnomalyDetectorError { - code?: UnivariateAnomalyDetectorErrorCodes; - message?: string; -} - -// @public -export type UnivariateAnomalyDetectorErrorCodes = "InvalidCustomInterval" | "BadArgument" | "InvalidGranularity" | "InvalidPeriod" | "InvalidModelArgument" | "InvalidSeries" | "InvalidJsonFormat" | "RequiredGranularity" | "RequiredSeries" | "InvalidImputeMode" | "InvalidImputeFixedValue"; - // @public export interface UnivariateDetectUnivariateChangePointOptionalParams extends OperationOptions { } diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts index 1ffeb30c5e..d0a887e898 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/index.ts @@ -36,8 +36,6 @@ export { UnivariateTimeGranularity, UnivariateImputeMode, UnivariateUnivariateEntireDetectionResult, - UnivariateAnomalyDetectorError, - UnivariateAnomalyDetectorErrorCodes, UnivariateUnivariateLastDetectionResult, UnivariateUnivariateChangePointDetectionOptions, UnivariateUnivariateChangePointDetectionResult, diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts index 5eb7ae421a..71119d2f41 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/index.ts @@ -29,8 +29,6 @@ export { UnivariateTimeGranularity, UnivariateImputeMode, UnivariateUnivariateEntireDetectionResult, - UnivariateAnomalyDetectorError, - UnivariateAnomalyDetectorErrorCodes, UnivariateUnivariateLastDetectionResult, UnivariateUnivariateChangePointDetectionOptions, UnivariateUnivariateChangePointDetectionResult, diff --git a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts index deba0d49a3..e9d6193152 100644 --- a/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/anomalyDetector/generated/typespec-ts/src/models/models.ts @@ -893,37 +893,6 @@ export function univariateUnivariateEntireDetectionResultDeserializer( }; } -/** Error information returned by the API. */ -export interface UnivariateAnomalyDetectorError { - /** The error code. */ - code?: UnivariateAnomalyDetectorErrorCodes; - /** A message explaining the error reported by the service. */ - message?: string; -} - -export function univariateAnomalyDetectorErrorDeserializer( - item: any, -): UnivariateAnomalyDetectorError { - return { - code: item["code"], - message: item["message"], - }; -} - -/** Type of UnivariateAnomalyDetectorErrorCodes */ -export type UnivariateAnomalyDetectorErrorCodes = - | "InvalidCustomInterval" - | "BadArgument" - | "InvalidGranularity" - | "InvalidPeriod" - | "InvalidModelArgument" - | "InvalidSeries" - | "InvalidJsonFormat" - | "RequiredGranularity" - | "RequiredSeries" - | "InvalidImputeMode" - | "InvalidImputeFixedValue"; - /** The response of last anomaly detection. */ export interface UnivariateUnivariateLastDetectionResult { /** diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md b/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md index c63afb2f67..fc3cda6dc5 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/review/openai-generic.api.md @@ -411,24 +411,6 @@ export interface EmbeddingsOperations { create: (embedding: CreateEmbeddingRequest, options?: EmbeddingsCreateOptionalParams) => Promise; } -// @public -export interface ErrorModel { - // (undocumented) - code: string | null; - // (undocumented) - message: string; - // (undocumented) - param: string | null; - // (undocumented) - type: string; -} - -// @public -export interface ErrorResponse { - // (undocumented) - error: ErrorModel; -} - // @public export interface FilesCreateOptionalParams extends OperationOptions { // (undocumented) diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts index 1dfa49c813..e67b5edf9f 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/index.ts @@ -5,8 +5,6 @@ export { OpenAIClient } from "./openAIClient.js"; export { CreateModerationRequest, CreateModerationResponse, - ErrorResponse, - ErrorModel, CreateImageRequest, ImagesResponse, Image, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts index 4217d92f18..04b5769ca2 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/index.ts @@ -4,8 +4,6 @@ export { CreateModerationRequest, CreateModerationResponse, - ErrorResponse, - ErrorModel, CreateImageRequest, ImagesResponse, Image, diff --git a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts index 1d64f37856..dda8339c3e 100644 --- a/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_generic/generated/typespec-ts/src/models/models.ts @@ -247,34 +247,6 @@ export function _createModerationResponseResultCategoryScoresDeserializer( }; } -/** model interface ErrorResponse */ -export interface ErrorResponse { - error: ErrorModel; -} - -export function errorResponseDeserializer(item: any): ErrorResponse { - return { - error: errorDeserializer(item["error"]), - }; -} - -/** model interface ErrorModel */ -export interface ErrorModel { - type: string; - message: string; - param: string | null; - code: string | null; -} - -export function errorDeserializer(item: any): ErrorModel { - return { - type: item["type"], - message: item["message"], - param: item["param"], - code: item["code"], - }; -} - /** model interface CreateImageRequest */ export interface CreateImageRequest { /** A text description of the desired image(s). The maximum length is 1000 characters. */ diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md index 65d6915e76..7c737452c6 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/review/openai-non-branded.api.md @@ -411,24 +411,6 @@ export interface EmbeddingsOperations { create: (embedding: CreateEmbeddingRequest, options?: EmbeddingsCreateOptionalParams) => Promise; } -// @public -export interface ErrorModel { - // (undocumented) - code: string | null; - // (undocumented) - message: string; - // (undocumented) - param: string | null; - // (undocumented) - type: string; -} - -// @public -export interface ErrorResponse { - // (undocumented) - error: ErrorModel; -} - // @public export interface FilesCreateOptionalParams extends OperationOptions { // (undocumented) diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts index d36caa2d19..03f8ddb9d2 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/index.ts @@ -4,8 +4,6 @@ export { OpenAIClient } from "./openAIClient.js"; export { CreateModerationRequest, CreateModerationResponse, - ErrorResponse, - ErrorModel, CreateImageRequest, ImagesResponse, Image, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts index d7eab75081..318e974721 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/index.ts @@ -3,8 +3,6 @@ export { CreateModerationRequest, CreateModerationResponse, - ErrorResponse, - ErrorModel, CreateImageRequest, ImagesResponse, Image, diff --git a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts index 34fd2b618d..ea930d16aa 100644 --- a/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/openai_non_branded/generated/typespec-ts/src/models/models.ts @@ -249,34 +249,6 @@ export function _createModerationResponseResultCategoryScoresDeserializer( }; } -/** model interface ErrorResponse */ -export interface ErrorResponse { - error: ErrorModel; -} - -export function errorResponseDeserializer(item: any): ErrorResponse { - return { - error: errorDeserializer(item["error"]), - }; -} - -/** model interface ErrorModel */ -export interface ErrorModel { - type: string; - message: string; - param: string | null; - code: string | null; -} - -export function errorDeserializer(item: any): ErrorModel { - return { - type: item["type"], - message: item["message"], - param: item["param"], - code: item["code"], - }; -} - /** model interface CreateImageRequest */ export interface CreateImageRequest { /** A text description of the desired image(s). The maximum length is 1000 characters. */ diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/package.json b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/package.json index 13aa7677c6..3b1834d803 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/package.json @@ -13,36 +13,17 @@ ".": "./src/index.ts", "./models": "./src/models/index.ts", "./api": "./src/api/index.ts", - "./api/schemaOperations": "./src/api/schemaOperations/index.ts" + "./api/schemaOperations": "src/api/schemaOperations/index.ts" }, - "dialects": [ - "esm", - "commonjs" - ], - "esmDialects": [ - "browser", - "react-native" - ], + "dialects": ["esm", "commonjs"], + "esmDialects": ["browser", "react-native"], "selfLink": false }, "type": "module", - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"], "author": "Microsoft Corporation", "license": "MIT", - "files": [ - "dist", - "README.md", - "LICENSE", - "review/*", - "CHANGELOG.md" - ], + "files": ["dist", "README.md", "LICENSE", "review/*", "CHANGELOG.md"], "dependencies": { "@azure/core-util": "^1.9.2", "@azure-rest/core-client": "^2.3.1", @@ -68,83 +49,5 @@ "lint": "eslint package.json api-extractor.json src", "lint:fix": "eslint package.json api-extractor.json src --fix --fix-type [problem,suggestion]", "build": "npm run clean && tshy && npm run extract-api" - }, - "exports": { - "./package.json": "./package.json", - ".": { - "browser": { - "types": "./dist/browser/index.d.ts", - "default": "./dist/browser/index.js" - }, - "react-native": { - "types": "./dist/react-native/index.d.ts", - "default": "./dist/react-native/index.js" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - }, - "./models": { - "browser": { - "types": "./dist/browser/models/index.d.ts", - "default": "./dist/browser/models/index.js" - }, - "react-native": { - "types": "./dist/react-native/models/index.d.ts", - "default": "./dist/react-native/models/index.js" - }, - "import": { - "types": "./dist/esm/models/index.d.ts", - "default": "./dist/esm/models/index.js" - }, - "require": { - "types": "./dist/commonjs/models/index.d.ts", - "default": "./dist/commonjs/models/index.js" - } - }, - "./api": { - "browser": { - "types": "./dist/browser/api/index.d.ts", - "default": "./dist/browser/api/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/index.d.ts", - "default": "./dist/react-native/api/index.js" - }, - "import": { - "types": "./dist/esm/api/index.d.ts", - "default": "./dist/esm/api/index.js" - }, - "require": { - "types": "./dist/commonjs/api/index.d.ts", - "default": "./dist/commonjs/api/index.js" - } - }, - "./api/schemaOperations": { - "browser": { - "types": "./dist/browser/api/schemaOperations/index.d.ts", - "default": "./dist/browser/api/schemaOperations/index.js" - }, - "react-native": { - "types": "./dist/react-native/api/schemaOperations/index.d.ts", - "default": "./dist/react-native/api/schemaOperations/index.js" - }, - "import": { - "types": "./dist/esm/api/schemaOperations/index.d.ts", - "default": "./dist/esm/api/schemaOperations/index.js" - }, - "require": { - "types": "./dist/commonjs/api/schemaOperations/index.d.ts", - "default": "./dist/commonjs/api/schemaOperations/index.js" - } - } - }, - "main": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - "module": "./dist/esm/index.js" + } } diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md deleted file mode 100644 index 73f2602824..0000000000 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md +++ /dev/null @@ -1,118 +0,0 @@ -## API Report File for "@msinternal/schema-registry" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; -import { TokenCredential } from '@azure/core-auth'; - -// @public -export type ContentTypeEnum = "application/octet-stream" | "application/json; serialization=Avro" | "application/json; serialization=json" | "text/vnd.ms.protobuf"; - -// @public -export type ContinuablePage = TPage & { - continuationToken?: string; -}; - -// @public -export enum KnownServiceApiVersions { - V2021_10 = "2021-10", - V2022_10 = "2022-10", - V2023_07_01 = "2023-07-01" -} - -// @public -export interface PagedAsyncIterableIterator { - [Symbol.asyncIterator](): PagedAsyncIterableIterator; - byPage: (settings?: TPageSettings) => AsyncIterableIterator>; - next(): Promise>; -} - -// @public -export interface PageSettings { - continuationToken?: string; -} - -// @public -export interface Schema { - definition: string; - properties: SchemaProperties; -} - -// @public -export type SchemaContentTypeValues = "application/json; serialization=Avro" | "application/json; serialization=json" | "text/plain; charset=utf-8" | "text/vnd.ms.protobuf"; - -// @public -export type SchemaFormat = "Avro" | "Json" | "Custom" | "Protobuf"; - -// @public -export interface SchemaGroup { - readonly groupName: string; -} - -// @public -export interface SchemaOperationsGetSchemaByIdOptionalParams extends OperationOptions { -} - -// @public -export interface SchemaOperationsGetSchemaByVersionOptionalParams extends OperationOptions { -} - -// @public -export interface SchemaOperationsGetSchemaIdByContentOptionalParams extends OperationOptions { -} - -// @public -export interface SchemaOperationsListSchemaGroupsOptionalParams extends OperationOptions { -} - -// @public -export interface SchemaOperationsListSchemaVersionsOptionalParams extends OperationOptions { -} - -// @public -export interface SchemaOperationsOperations { - getSchemaById: (id: string, options?: SchemaOperationsGetSchemaByIdOptionalParams) => Promise; - getSchemaByVersion: (groupName: string, name: string, schemaVersion: number, options?: SchemaOperationsGetSchemaByVersionOptionalParams) => Promise; - getSchemaIdByContent: (groupName: string, name: string, contentType: SchemaContentTypeValues, schemaContent: Uint8Array, options?: SchemaOperationsGetSchemaIdByContentOptionalParams) => Promise; - listSchemaGroups: (options?: SchemaOperationsListSchemaGroupsOptionalParams) => PagedAsyncIterableIterator; - listSchemaVersions: (groupName: string, name: string, options?: SchemaOperationsListSchemaVersionsOptionalParams) => PagedAsyncIterableIterator; - registerSchema: (groupName: string, name: string, contentType: SchemaContentTypeValues, content: Uint8Array, options?: SchemaOperationsRegisterSchemaOptionalParams) => Promise; -} - -// @public -export interface SchemaOperationsRegisterSchemaOptionalParams extends OperationOptions { -} - -// @public -export interface SchemaProperties { - format: SchemaFormat; - groupName: string; - id: string; - name: string; - version: number; -} - -// @public (undocumented) -export class SchemaRegistryClient { - constructor(fullyQualifiedNamespace: string, credential: TokenCredential, options?: SchemaRegistryClientOptionalParams); - readonly pipeline: Pipeline; - readonly schemaOperations: SchemaOperationsOperations; -} - -// @public -export interface SchemaRegistryClientOptionalParams extends ClientOptions { - apiVersion?: string; -} - -// @public -export interface SchemaVersion { - readonly schemaVersion: number; -} - -// (No @packageDocumentation comment for this package) - -``` diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md index 334ef05a0e..adeb64a0cc 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/review/widget_dpg.api.md @@ -82,12 +82,6 @@ export interface Widget { weight: number; } -// @public -export interface WidgetError { - code: number; - message: string; -} - // @public export interface WidgetsAnalyzeWidgetOptionalParams extends OperationOptions { } diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/index.ts index 608b7c6431..aea9c394f9 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/index.ts @@ -12,7 +12,6 @@ export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; export { User, Widget, - WidgetError, AnalyzeResult, NonReferencedModel, KnownVersions, diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/index.ts index abffc3b6ec..6d4bb6db3d 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/index.ts @@ -4,7 +4,6 @@ export { User, Widget, - WidgetError, AnalyzeResult, NonReferencedModel, KnownVersions, diff --git a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts index 76d8c3a4c3..b5bb89bee6 100644 --- a/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/widget_dpg/generated/typespec-ts/src/models/models.ts @@ -41,21 +41,6 @@ export function widgetDeserializer(item: any): Widget { }; } -/** model interface WidgetError */ -export interface WidgetError { - /** The HTTP error code. */ - code: number; - /** A human-readable message describing the error. */ - message: string; -} - -export function widgetErrorDeserializer(item: any): WidgetError { - return { - code: item["code"], - message: item["message"], - }; -} - /** model interface _ListWidgetsPagesResults */ export interface _ListWidgetsPagesResults { /** The current page of results. */ diff --git a/packages/typespec-ts/package.json b/packages/typespec-ts/package.json index a22e8702b9..7c26558580 100644 --- a/packages/typespec-ts/package.json +++ b/packages/typespec-ts/package.json @@ -70,7 +70,7 @@ "@azure-tools/typespec-autorest": ">=0.48.0 <1.0.0", "@azure-tools/typespec-azure-core": ">=0.48.0 <1.0.0", "@azure-tools/typespec-azure-resource-manager": ">=0.48.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.48.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.48.3 <1.0.0", "@azure/abort-controller": "^2.1.2", "@azure/core-auth": "^1.6.0", "@azure/core-lro": "^3.1.0", @@ -111,7 +111,7 @@ }, "peerDependencies": { "@azure-tools/typespec-azure-core": ">=0.48.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.48.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.48.3 <1.0.0", "@typespec/compiler": ">=0.62.0 <1.0.0", "@typespec/http": ">=0.62.0 <1.0.0", "@typespec/rest": ">=0.62.0 <1.0.0", diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.d.ts index 7879b60d60..1afae402ce 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/api-key/src/index.d.ts @@ -14,10 +14,6 @@ export declare class ApiKeyClient { export declare interface ApiKeyClientOptionalParams extends ClientOptions { } -export declare interface InvalidAuth { - error: string; -} - export declare interface InvalidOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/src/index.d.ts index cbeab8119f..a8f5070031 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/http/custom/src/index.d.ts @@ -14,10 +14,6 @@ export declare class CustomClient { export declare interface CustomClientOptionalParams extends ClientOptions { } -export declare interface InvalidAuth { - error: string; -} - export declare interface InvalidOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.d.ts index 5b2549c730..94b6bab8f4 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/authentication/oauth2/src/index.d.ts @@ -3,10 +3,6 @@ import { OperationOptions } from '@azure-rest/core-client'; import { Pipeline } from '@azure/core-rest-pipeline'; import { TokenCredential } from '@azure/core-auth'; -export declare interface InvalidAuth { - error: string; -} - export declare interface InvalidOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts index 8b77590770..acc180aa01 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/common-properties/src/index.d.ts @@ -20,23 +20,6 @@ export declare type CreatedByType = string; export declare interface CreateWithSystemAssignedOptionalParams extends OperationOptions { } -export declare interface ErrorAdditionalInfo { - readonly type?: string; - readonly info?: Record; -} - -export declare interface ErrorDetail { - readonly code?: string; - readonly message?: string; - readonly target?: string; - readonly details?: ErrorDetail[]; - readonly additionalInfo?: ErrorAdditionalInfo[]; -} - -export declare interface ErrorResponse { - error?: ErrorDetail; -} - export declare interface GetOptionalParams extends OperationOptions { } diff --git a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts index 106c7891bc..0870c76f6e 100644 --- a/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts +++ b/packages/typespec-ts/test/modularIntegration/generated/azure/resource-manager/resources/src/index.d.ts @@ -12,23 +12,6 @@ export declare type ContinuablePage = TPage & { export declare type CreatedByType = string; -export declare interface ErrorAdditionalInfo { - readonly type?: string; - readonly info?: Record; -} - -export declare interface ErrorDetail { - readonly code?: string; - readonly message?: string; - readonly target?: string; - readonly details?: ErrorDetail[]; - readonly additionalInfo?: ErrorAdditionalInfo[]; -} - -export declare interface ErrorResponse { - error?: ErrorDetail; -} - export declare enum KnownCreatedByType { User = "User", Application = "Application", From 8815aa22c2c2ad17c68260f93376064cf8b8cf54 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Fri, 29 Nov 2024 17:18:11 +0800 Subject: [PATCH 2/3] add ut for error models in MPG if it is not referenced --- .../models/serialization/errorModels.md | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 packages/typespec-ts/test/modularUnit/scenarios/models/serialization/errorModels.md diff --git a/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/errorModels.md b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/errorModels.md new file mode 100644 index 0000000000..7a1b1f428d --- /dev/null +++ b/packages/typespec-ts/test/modularUnit/scenarios/models/serialization/errorModels.md @@ -0,0 +1,39 @@ +# Not generate error models in MPG if it is not referenced + +## TypeSpec + +This is tsp definition. + +```tsp +model Foo { + name: string; +} +model ErrorDetail { + /** A human readable message */ + message: string; +} +@error +model ApiError { + /** A machine readable error code */ + code: string; + detail?: ErrorDetail; +} +@get op bar(): Foo | ApiError; +``` + +## Provide generated models and its serializer + +Generated Models. + +```ts models +/** model interface Foo */ +export interface Foo { + name: string; +} + +export function fooDeserializer(item: any): Foo { + return { + name: item["name"] + }; +} +``` From 2f8c4892fe6e1ab3bd04ba8dbedcfd6e48e47c20 Mon Sep 17 00:00:00 2001 From: "Jiao Di (MSFT)" <80496810+v-jiaodi@users.noreply.github.com> Date: Fri, 29 Nov 2024 17:42:44 +0800 Subject: [PATCH 3/3] fix ci --- .../generated/typespec-ts/package.json | 109 +++++++++++++++- .../typespec-ts/review/schema-registry.api.md | 118 ++++++++++++++++++ 2 files changed, 221 insertions(+), 6 deletions(-) create mode 100644 packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/package.json b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/package.json index 3b1834d803..13aa7677c6 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/package.json +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/package.json @@ -13,17 +13,36 @@ ".": "./src/index.ts", "./models": "./src/models/index.ts", "./api": "./src/api/index.ts", - "./api/schemaOperations": "src/api/schemaOperations/index.ts" + "./api/schemaOperations": "./src/api/schemaOperations/index.ts" }, - "dialects": ["esm", "commonjs"], - "esmDialects": ["browser", "react-native"], + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], "selfLink": false }, "type": "module", - "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"], + "keywords": [ + "node", + "azure", + "cloud", + "typescript", + "browser", + "isomorphic" + ], "author": "Microsoft Corporation", "license": "MIT", - "files": ["dist", "README.md", "LICENSE", "review/*", "CHANGELOG.md"], + "files": [ + "dist", + "README.md", + "LICENSE", + "review/*", + "CHANGELOG.md" + ], "dependencies": { "@azure/core-util": "^1.9.2", "@azure-rest/core-client": "^2.3.1", @@ -49,5 +68,83 @@ "lint": "eslint package.json api-extractor.json src", "lint:fix": "eslint package.json api-extractor.json src --fix --fix-type [problem,suggestion]", "build": "npm run clean && tshy && npm run extract-api" - } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "react-native": { + "types": "./dist/react-native/index.d.ts", + "default": "./dist/react-native/index.js" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./api/schemaOperations": { + "browser": { + "types": "./dist/browser/api/schemaOperations/index.d.ts", + "default": "./dist/browser/api/schemaOperations/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/schemaOperations/index.d.ts", + "default": "./dist/react-native/api/schemaOperations/index.js" + }, + "import": { + "types": "./dist/esm/api/schemaOperations/index.d.ts", + "default": "./dist/esm/api/schemaOperations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/schemaOperations/index.d.ts", + "default": "./dist/commonjs/api/schemaOperations/index.js" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" } diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md new file mode 100644 index 0000000000..73f2602824 --- /dev/null +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/review/schema-registry.api.md @@ -0,0 +1,118 @@ +## API Report File for "@msinternal/schema-registry" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export type ContentTypeEnum = "application/octet-stream" | "application/json; serialization=Avro" | "application/json; serialization=json" | "text/vnd.ms.protobuf"; + +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + +// @public +export enum KnownServiceApiVersions { + V2021_10 = "2021-10", + V2022_10 = "2022-10", + V2023_07_01 = "2023-07-01" +} + +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} + +// @public +export interface PageSettings { + continuationToken?: string; +} + +// @public +export interface Schema { + definition: string; + properties: SchemaProperties; +} + +// @public +export type SchemaContentTypeValues = "application/json; serialization=Avro" | "application/json; serialization=json" | "text/plain; charset=utf-8" | "text/vnd.ms.protobuf"; + +// @public +export type SchemaFormat = "Avro" | "Json" | "Custom" | "Protobuf"; + +// @public +export interface SchemaGroup { + readonly groupName: string; +} + +// @public +export interface SchemaOperationsGetSchemaByIdOptionalParams extends OperationOptions { +} + +// @public +export interface SchemaOperationsGetSchemaByVersionOptionalParams extends OperationOptions { +} + +// @public +export interface SchemaOperationsGetSchemaIdByContentOptionalParams extends OperationOptions { +} + +// @public +export interface SchemaOperationsListSchemaGroupsOptionalParams extends OperationOptions { +} + +// @public +export interface SchemaOperationsListSchemaVersionsOptionalParams extends OperationOptions { +} + +// @public +export interface SchemaOperationsOperations { + getSchemaById: (id: string, options?: SchemaOperationsGetSchemaByIdOptionalParams) => Promise; + getSchemaByVersion: (groupName: string, name: string, schemaVersion: number, options?: SchemaOperationsGetSchemaByVersionOptionalParams) => Promise; + getSchemaIdByContent: (groupName: string, name: string, contentType: SchemaContentTypeValues, schemaContent: Uint8Array, options?: SchemaOperationsGetSchemaIdByContentOptionalParams) => Promise; + listSchemaGroups: (options?: SchemaOperationsListSchemaGroupsOptionalParams) => PagedAsyncIterableIterator; + listSchemaVersions: (groupName: string, name: string, options?: SchemaOperationsListSchemaVersionsOptionalParams) => PagedAsyncIterableIterator; + registerSchema: (groupName: string, name: string, contentType: SchemaContentTypeValues, content: Uint8Array, options?: SchemaOperationsRegisterSchemaOptionalParams) => Promise; +} + +// @public +export interface SchemaOperationsRegisterSchemaOptionalParams extends OperationOptions { +} + +// @public +export interface SchemaProperties { + format: SchemaFormat; + groupName: string; + id: string; + name: string; + version: number; +} + +// @public (undocumented) +export class SchemaRegistryClient { + constructor(fullyQualifiedNamespace: string, credential: TokenCredential, options?: SchemaRegistryClientOptionalParams); + readonly pipeline: Pipeline; + readonly schemaOperations: SchemaOperationsOperations; +} + +// @public +export interface SchemaRegistryClientOptionalParams extends ClientOptions { + apiVersion?: string; +} + +// @public +export interface SchemaVersion { + readonly schemaVersion: number; +} + +// (No @packageDocumentation comment for this package) + +```