diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 84d0ecad93..9396863970 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -194,7 +194,7 @@ importers: '@azure-tools/typespec-autorest': '>=0.45.0 <1.0.0' '@azure-tools/typespec-azure-core': '>=0.45.0 <1.0.0' '@azure-tools/typespec-azure-resource-manager': '>=0.45.0 <1.0.0' - '@azure-tools/typespec-client-generator-core': '>=0.45.1 <1.0.0' + '@azure-tools/typespec-client-generator-core': '>=0.45.4 <1.0.0' '@azure-tools/typespec-ts': workspace:^0.32.0 '@types/mocha': ^5.2.7 '@types/node': ^18.0.0 @@ -208,10 +208,10 @@ importers: ts-node: ^8.5.2 typescript: ~5.5.3 dependencies: - '@azure-tools/typespec-autorest': 0.45.0_n4w2xh5fhregk7uzwn23tc3udm + '@azure-tools/typespec-autorest': 0.45.0_ch4e7dmaodljkmzs7h7dd2lznu '@azure-tools/typespec-azure-core': 0.45.0_alrznhyrw66bvx6gp4zrtdfkte '@azure-tools/typespec-azure-resource-manager': 0.45.0_rxzquxnvxkwebgrumlsfc6ni5i - '@azure-tools/typespec-client-generator-core': 0.45.1_rxzquxnvxkwebgrumlsfc6ni5i + '@azure-tools/typespec-client-generator-core': 0.45.4_rxzquxnvxkwebgrumlsfc6ni5i '@azure-tools/typespec-ts': link:../typespec-ts '@typespec/compiler': 0.59.0 '@typespec/http': 0.59.0_@typespec+compiler@0.59.0 @@ -237,7 +237,7 @@ importers: '@azure-tools/typespec-autorest': '>=0.45.0 <1.0.0' '@azure-tools/typespec-azure-core': '>=0.45.0 <1.0.0' '@azure-tools/typespec-azure-resource-manager': '>=0.45.0 <1.0.0' - '@azure-tools/typespec-client-generator-core': '>=0.45.1 <1.0.0' + '@azure-tools/typespec-client-generator-core': '>=0.45.4 <1.0.0' '@azure/abort-controller': ^2.1.2 '@azure/core-auth': ^1.6.0 '@azure/core-lro': ^3.0.0 @@ -292,10 +292,10 @@ importers: '@azure-tools/cadl-ranch-api': 0.4.6 '@azure-tools/cadl-ranch-expect': 0.15.1_y3yxhtjg35d3g6m2dacugmsjfu '@azure-tools/cadl-ranch-specs': 0.36.1_cvode6xhpuyl3aj5dk75xzx5nu - '@azure-tools/typespec-autorest': 0.45.0_n4w2xh5fhregk7uzwn23tc3udm + '@azure-tools/typespec-autorest': 0.45.0_ch4e7dmaodljkmzs7h7dd2lznu '@azure-tools/typespec-azure-core': 0.45.0_alrznhyrw66bvx6gp4zrtdfkte '@azure-tools/typespec-azure-resource-manager': 0.45.0_rxzquxnvxkwebgrumlsfc6ni5i - '@azure-tools/typespec-client-generator-core': 0.45.1_rxzquxnvxkwebgrumlsfc6ni5i + '@azure-tools/typespec-client-generator-core': 0.45.4_rxzquxnvxkwebgrumlsfc6ni5i '@azure/abort-controller': 2.1.2 '@azure/core-auth': 1.6.0 '@azure/core-lro': 3.0.0 @@ -542,7 +542,7 @@ packages: - supports-color dev: true - /@azure-tools/typespec-autorest/0.45.0_n4w2xh5fhregk7uzwn23tc3udm: + /@azure-tools/typespec-autorest/0.45.0_ch4e7dmaodljkmzs7h7dd2lznu: resolution: {integrity: sha512-6ycZ0bEfXC0U26FHHEt9smAhxh78SACIDY+u7zLAopRzmxjTuthDdGgYSShuRDu3J+vEBi1fOKpz4cYQkgRkBQ==} engines: {node: '>=18.0.0'} peerDependencies: @@ -557,7 +557,7 @@ packages: dependencies: '@azure-tools/typespec-azure-core': 0.45.0_alrznhyrw66bvx6gp4zrtdfkte '@azure-tools/typespec-azure-resource-manager': 0.45.0_rxzquxnvxkwebgrumlsfc6ni5i - '@azure-tools/typespec-client-generator-core': 0.45.1_rxzquxnvxkwebgrumlsfc6ni5i + '@azure-tools/typespec-client-generator-core': 0.45.4_rxzquxnvxkwebgrumlsfc6ni5i '@typespec/compiler': 0.59.0 '@typespec/http': 0.59.0_@typespec+compiler@0.59.0 '@typespec/openapi': 0.59.0_kqkvcwi4aithpv7x2xgy7toc2q @@ -596,8 +596,8 @@ packages: change-case: 5.4.4 pluralize: 8.0.0 - /@azure-tools/typespec-client-generator-core/0.45.1_rxzquxnvxkwebgrumlsfc6ni5i: - resolution: {integrity: sha512-C68pONnONncKlYjlU7JyxxS57NCLancPfoq0eDcaeXUcjFL34kkLKTE3VK0V6aBKBerAB5qOicsO9X81acFFCw==} + /@azure-tools/typespec-client-generator-core/0.45.4_rxzquxnvxkwebgrumlsfc6ni5i: + resolution: {integrity: sha512-QJygwMqhEtBi2tPYs/HAfs0QTowXAwp6QpP/Vd2pHnJAncTV1BN17n/9LLAlMu2CnLimqvTuIN+FfliM28AX9w==} engines: {node: '>=18.0.0'} peerDependencies: '@azure-tools/typespec-azure-core': ~0.45.0 diff --git a/packages/typespec-test/package.json b/packages/typespec-test/package.json index d412bd859b..65f87f5499 100644 --- a/packages/typespec-test/package.json +++ b/packages/typespec-test/package.json @@ -8,7 +8,7 @@ "@azure-tools/typespec-autorest": ">=0.45.0 <1.0.0", "@typespec/openapi3": ">=0.59.0 <1.0.0", "@azure-tools/typespec-azure-core": ">=0.45.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.45.1 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.45.4 <1.0.0", "@azure-tools/typespec-azure-resource-manager": ">=0.45.0 <1.0.0", "@typespec/compiler": ">=0.59.0 <1.0.0", "@typespec/http": ">=0.59.0 <1.0.0", diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts index 399c499152..c24bb16dd9 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/index.ts @@ -15,11 +15,11 @@ export { SchemaGroup, SchemaContentTypeValues, SchemaVersion, + ServiceApiVersions, SchemaProperties, SchemaFormat, Schema, ContentTypeEnum, - ServiceApiVersions, SchemaOperationsListSchemaGroupsOptionalParams, SchemaOperationsGetSchemaByIdOptionalParams, SchemaOperationsListSchemaVersionsOptionalParams, diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/index.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/index.ts index 7042bee062..025f576757 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/index.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/index.ts @@ -5,11 +5,11 @@ export { SchemaGroup, SchemaContentTypeValues, SchemaVersion, + ServiceApiVersions, SchemaProperties, SchemaFormat, Schema, ContentTypeEnum, - ServiceApiVersions, } from "./models.js"; export { SchemaOperationsListSchemaGroupsOptionalParams, diff --git a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts index 746bdc4300..23df6d93ed 100644 --- a/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts +++ b/packages/typespec-test/test/schemaRegistry/generated/typespec-ts/src/models/models.ts @@ -20,6 +20,9 @@ export interface SchemaVersion { readonly schemaVersion: number; } +/** Represents the Schema Registry API version to use for requests. */ +export type ServiceApiVersions = "2021-10" | "2022-10" | "2023-07-01"; + /** Meta properties of a schema. */ export interface SchemaProperties { /** References a specific schema in the registry namespace. */ @@ -70,8 +73,6 @@ export type ContentTypeEnum = | "application/json; serialization=Avro" | "application/json; serialization=json" | "text/vnd.ms.protobuf"; -/** Represents the Schema Registry API version to use for requests. */ -export type ServiceApiVersions = "2021-10" | "2022-10" | "2023-07-01"; /** Paged collection of SchemaGroup items */ export interface _PagedSchemaGroup { 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 9452493ae2..4abca8d1d9 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 @@ -19,8 +19,8 @@ export { CreateWidget, UpdateWidget, AnalyzeResult, - NonReferencedModel, Versions, + NonReferencedModel, WidgetsListWidgetsOptionalParams, WidgetsListWidgetsPagesOptionalParams, WidgetsQueryWidgetsPagesOptionalParams, 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 cc5787116c..e421942252 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 @@ -8,8 +8,8 @@ export { CreateWidget, UpdateWidget, AnalyzeResult, - NonReferencedModel, Versions, + NonReferencedModel, } from "./models.js"; export { WidgetsListWidgetsOptionalParams, 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 0897828b06..153108d928 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 @@ -59,6 +59,9 @@ export interface AnalyzeResult { summary: string; } +/** The Contoso Widget Manager service version. */ +export type Versions = "1.0.0"; + export interface NonReferencedModel { /** The weight of the widget. This is an int32, but must be greater than zero. */ prop1: number; @@ -74,6 +77,3 @@ export function nonReferencedModelSerializer( prop2: item["prop2"], }; } - -/** The Contoso Widget Manager service version. */ -export type Versions = "1.0.0"; diff --git a/packages/typespec-ts/package.json b/packages/typespec-ts/package.json index 65f3075739..21eb100b19 100644 --- a/packages/typespec-ts/package.json +++ b/packages/typespec-ts/package.json @@ -70,7 +70,7 @@ "@azure-tools/typespec-autorest": ">=0.45.0 <1.0.0", "@azure-tools/typespec-azure-core": ">=0.45.0 <1.0.0", "@azure-tools/typespec-azure-resource-manager": ">=0.45.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.45.1 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.45.4 <1.0.0", "@azure/abort-controller": "^2.1.2", "@azure/core-auth": "^1.6.0", "@azure/core-lro": "^3.0.0", @@ -111,7 +111,7 @@ }, "peerDependencies": { "@azure-tools/typespec-azure-core": ">=0.45.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.45.1 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.45.4 <1.0.0", "@typespec/compiler": ">=0.59.0 <1.0.0", "@typespec/http": ">=0.59.0 <1.0.0", "@typespec/rest": ">=0.59.0 <1.0.0", diff --git a/packages/typespec-ts/src/modular/buildCodeModel.ts b/packages/typespec-ts/src/modular/buildCodeModel.ts index 240419d00d..dcef4bc1b7 100644 --- a/packages/typespec-ts/src/modular/buildCodeModel.ts +++ b/packages/typespec-ts/src/modular/buildCodeModel.ts @@ -980,6 +980,7 @@ function getName(program: Program, type: Model): string { if ( type.templateMapper && type.templateMapper.args && + type.name !== "" && type.templateMapper.args.length > 0 ) { return (