diff --git a/.changeset/twelve-dingos-ring.md b/.changeset/twelve-dingos-ring.md deleted file mode 100644 index 5d60caeb94..0000000000 --- a/.changeset/twelve-dingos-ring.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@azure-tools/typespec-client-generator-core": minor ---- - -add property `flatten` onto the sdk type for a model's property, corresponding to the `flatten` decorator diff --git a/.chronus/changes/dependabot-submodules-core-717af64-2024-1-29-10-7-42.md b/.chronus/changes/dependabot-submodules-core-717af64-2024-1-29-10-7-42.md new file mode 100644 index 0000000000..ce4bba4876 --- /dev/null +++ b/.chronus/changes/dependabot-submodules-core-717af64-2024-1-29-10-7-42.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@azure-tools/typespec-azure-resource-manager" + - "@azure-tools/typespec-client-generator-core" +--- + diff --git a/.chronus/changes/dependabot-submodules-core-717af64-2024-1-29-10-8-7.md b/.chronus/changes/dependabot-submodules-core-717af64-2024-1-29-10-8-7.md new file mode 100644 index 0000000000..9dc50784c2 --- /dev/null +++ b/.chronus/changes/dependabot-submodules-core-717af64-2024-1-29-10-8-7.md @@ -0,0 +1,7 @@ +--- +changeKind: feature +packages: + - "@azure-tools/typespec-autorest" +--- + +Add support for all properties of openapi `info` object on the `@info` decorator \ No newline at end of file diff --git a/core b/core index 8b062e33bb..717af6421f 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 8b062e33bbc4273d2470fa9fbc182df8ce1ef0b7 +Subproject commit 717af6421f652e63da9812c1497dcbd03b8cec96 diff --git a/packages/samples/specs/data-plane/confidentialledger/confidentialledger.tsp b/packages/samples/specs/data-plane/confidentialledger/confidentialledger.tsp index 85ade02b5b..29cb78eea7 100644 --- a/packages/samples/specs/data-plane/confidentialledger/confidentialledger.tsp +++ b/packages/samples/specs/data-plane/confidentialledger/confidentialledger.tsp @@ -27,7 +27,6 @@ using TypeSpec.OpenAPI; ) @service({ title: "Confidential Ledger Service", - version: "2022-05-13", }) @useDependency(Azure.Core.Versions.v1_0_Preview_2) @server( diff --git a/packages/samples/specs/data-plane/formrecognizer/main.tsp b/packages/samples/specs/data-plane/formrecognizer/main.tsp index c8de646fff..34ee59d4f0 100644 --- a/packages/samples/specs/data-plane/formrecognizer/main.tsp +++ b/packages/samples/specs/data-plane/formrecognizer/main.tsp @@ -11,7 +11,6 @@ using Azure.Core; @useAuth(AadOauth2Auth<["https://cognitiveservices.azure.com/.default"]>) @service({ title: "Form Recognizer", - version: "2021-09-30-preview", }) @useDependency(Azure.Core.Versions.v1_0_Preview_1) @doc("Extracts content, layout, and structured data from documents.") diff --git a/packages/samples/specs/data-plane/language/authoring/authoring.tsp b/packages/samples/specs/data-plane/language/authoring/authoring.tsp index 5d27844949..a6033c6bab 100644 --- a/packages/samples/specs/data-plane/language/authoring/authoring.tsp +++ b/packages/samples/specs/data-plane/language/authoring/authoring.tsp @@ -19,7 +19,6 @@ using Azure.Core.Traits; ) @service({ title: "Microsoft Cognitive Language Service - Analyze Text Authoring", - version: "202ß2-05-15-preview", }) @useDependency(Azure.Core.Versions.v1_0_Preview_2) @route("/authoring/analyze-text/") diff --git a/packages/samples/specs/data-plane/languageqna/Interface/main.tsp b/packages/samples/specs/data-plane/languageqna/Interface/main.tsp index 35bed8a897..b0a62cebf8 100644 --- a/packages/samples/specs/data-plane/languageqna/Interface/main.tsp +++ b/packages/samples/specs/data-plane/languageqna/Interface/main.tsp @@ -14,7 +14,6 @@ import "./questionanswering-authoring_models.tsp"; ) @service({ title: "Hello world", - version: "0.1.0", }) namespace Azure.Language.QnA; //@route("") // TODO diff --git a/packages/samples/specs/data-plane/languageqna/Raw/main.tsp b/packages/samples/specs/data-plane/languageqna/Raw/main.tsp index 62ef920196..78f9c83d20 100644 --- a/packages/samples/specs/data-plane/languageqna/Raw/main.tsp +++ b/packages/samples/specs/data-plane/languageqna/Raw/main.tsp @@ -26,7 +26,6 @@ using TypeSpec.OpenAPI; ) @service({ title: "Microsoft Cognitive Language Service - Question Answering - Authoring", - version: "21-10-01", }) @useDependency(Azure.Core.Versions.v1_0_Preview_2) namespace Azure.QnAMaker; diff --git a/packages/samples/specs/data-plane/searchindex/main.tsp b/packages/samples/specs/data-plane/searchindex/main.tsp index aa3530fcea..71d3694b34 100644 --- a/packages/samples/specs/data-plane/searchindex/main.tsp +++ b/packages/samples/specs/data-plane/searchindex/main.tsp @@ -24,7 +24,6 @@ import "@azure-tools/typespec-azure-core"; ) @service({ title: "SearchIndexClient", - version: "2021-04-30-Preview", }) namespace Azure.SearchIndex; diff --git a/packages/samples/specs/data-plane/searchservice/search-indexer.ops.tsp b/packages/samples/specs/data-plane/searchservice/search-indexer.ops.tsp index 5f365218ac..3f97a40044 100644 --- a/packages/samples/specs/data-plane/searchservice/search-indexer.ops.tsp +++ b/packages/samples/specs/data-plane/searchservice/search-indexer.ops.tsp @@ -16,7 +16,6 @@ import "./searchservice.models.tsp"; ) @service({ title: "Search Service", - version: "2021-04-30-Preview", }) namespace Azure.SearchService; diff --git a/packages/samples/specs/resource-manager/arm-library/main.tsp b/packages/samples/specs/resource-manager/arm-library/main.tsp index 7db08dfa27..2211538937 100644 --- a/packages/samples/specs/resource-manager/arm-library/main.tsp +++ b/packages/samples/specs/resource-manager/arm-library/main.tsp @@ -13,6 +13,8 @@ using Azure.ResourceManager; @service({ title: "Microsoft.EnvelopeTest", +}) +@OpenAPI.info({ version: "2021-09-21-preview", }) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) diff --git a/packages/samples/specs/resource-manager/codesigning/codesigning.tsp b/packages/samples/specs/resource-manager/codesigning/codesigning.tsp index 0bc42770c4..31e65558f5 100644 --- a/packages/samples/specs/resource-manager/codesigning/codesigning.tsp +++ b/packages/samples/specs/resource-manager/codesigning/codesigning.tsp @@ -12,6 +12,8 @@ using TypeSpec.Versioning; @armProviderNamespace @service({ title: "CodeSigningManagementClient", +}) +@OpenAPI.info({ version: "2020-12-14-preview", }) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) diff --git a/packages/samples/specs/resource-manager/contoso/contoso.tsp b/packages/samples/specs/resource-manager/contoso/contoso.tsp index e7b9b2e322..2fa5818a70 100644 --- a/packages/samples/specs/resource-manager/contoso/contoso.tsp +++ b/packages/samples/specs/resource-manager/contoso/contoso.tsp @@ -12,6 +12,8 @@ using Azure.ResourceManager; @armProviderNamespace @service({ title: "ContosoProviderHubClient", +}) +@OpenAPI.info({ version: "2021-10-01-preview", }) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) diff --git a/packages/samples/specs/resource-manager/csharpattributetest/main.tsp b/packages/samples/specs/resource-manager/csharpattributetest/main.tsp index a26da89922..c9ffe95424 100644 --- a/packages/samples/specs/resource-manager/csharpattributetest/main.tsp +++ b/packages/samples/specs/resource-manager/csharpattributetest/main.tsp @@ -13,6 +13,8 @@ using Azure.ResourceManager; @armProviderNamespace @service({ title: "Microsoft.CSharpAttributeTest", +}) +@OpenAPI.info({ version: "2021-09-21-preview", }) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) diff --git a/packages/samples/specs/resource-manager/customer-managed-keys/main.tsp b/packages/samples/specs/resource-manager/customer-managed-keys/main.tsp index 2247f91373..c1dd64d1a5 100644 --- a/packages/samples/specs/resource-manager/customer-managed-keys/main.tsp +++ b/packages/samples/specs/resource-manager/customer-managed-keys/main.tsp @@ -13,6 +13,8 @@ using Azure.Core; @armProviderNamespace("Contoso.CustomerManagedKeyExample") @service({ title: "Contoso.CustomerManagedKeyExample", +}) +@OpenAPI.info({ version: "2023-03-01-preview", }) @doc("An example of using the Customer Managed Key Encryption properties in a resource type.") diff --git a/packages/samples/specs/resource-manager/discriminatortest/main.tsp b/packages/samples/specs/resource-manager/discriminatortest/main.tsp index 4cddba57b6..291b1764c1 100644 --- a/packages/samples/specs/resource-manager/discriminatortest/main.tsp +++ b/packages/samples/specs/resource-manager/discriminatortest/main.tsp @@ -14,6 +14,8 @@ using Microsoft.DiscriminatorTest.Common; @armProviderNamespace @service({ title: "DiscriminatorTest", +}) +@OpenAPI.info({ version: "2021-10-01-preview", }) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) diff --git a/packages/samples/specs/resource-manager/envelopetest/main.tsp b/packages/samples/specs/resource-manager/envelopetest/main.tsp index f28466698b..f055e0c628 100644 --- a/packages/samples/specs/resource-manager/envelopetest/main.tsp +++ b/packages/samples/specs/resource-manager/envelopetest/main.tsp @@ -11,6 +11,8 @@ using Azure.ResourceManager; @service({ title: "Microsoft.EnvelopeTest", +}) +@OpenAPI.info({ version: "2021-09-21-preview", }) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) diff --git a/packages/samples/specs/resource-manager/liftr.confluent/confluent.tsp b/packages/samples/specs/resource-manager/liftr.confluent/confluent.tsp index 8d9238161f..4fc6d32785 100644 --- a/packages/samples/specs/resource-manager/liftr.confluent/confluent.tsp +++ b/packages/samples/specs/resource-manager/liftr.confluent/confluent.tsp @@ -14,6 +14,8 @@ using Autorest; @armProviderNamespace @service({ title: "Microsoft.Confluent", +}) +@OpenAPI.info({ version: "2021-03-01-preview", }) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) diff --git a/packages/samples/specs/resource-manager/liftr.frs/fluidrelay.tsp b/packages/samples/specs/resource-manager/liftr.frs/fluidrelay.tsp index a082e3a2ef..97bf0fac9f 100644 --- a/packages/samples/specs/resource-manager/liftr.frs/fluidrelay.tsp +++ b/packages/samples/specs/resource-manager/liftr.frs/fluidrelay.tsp @@ -12,6 +12,8 @@ using Azure.ResourceManager; @armProviderNamespace @service({ title: "Azure Fluid Relay", +}) +@OpenAPI.info({ version: "2021-03-12-preview", }) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) diff --git a/packages/samples/specs/resource-manager/liftr.playfab/playfab.tsp b/packages/samples/specs/resource-manager/liftr.playfab/playfab.tsp index c322b2725e..1f55bbd97f 100644 --- a/packages/samples/specs/resource-manager/liftr.playfab/playfab.tsp +++ b/packages/samples/specs/resource-manager/liftr.playfab/playfab.tsp @@ -12,6 +12,8 @@ using Azure.ResourceManager; @armProviderNamespace @service({ title: "Azure PlayFab", +}) +@OpenAPI.info({ version: "2021-06-15-preview", }) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) diff --git a/packages/samples/specs/resource-manager/logz/logz.tsp b/packages/samples/specs/resource-manager/logz/logz.tsp index 8b15bad41b..ac4021c050 100644 --- a/packages/samples/specs/resource-manager/logz/logz.tsp +++ b/packages/samples/specs/resource-manager/logz/logz.tsp @@ -13,6 +13,8 @@ using Azure.ResourceManager; @armProviderNamespace @service({ title: "Microsoft.Logz", +}) +@OpenAPI.info({ version: "2020-10-01-preview", }) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1, Azure.Core.Versions.v1_0_Preview_2) diff --git a/packages/samples/specs/resource-manager/operationsTest/main.tsp b/packages/samples/specs/resource-manager/operationsTest/main.tsp index a8716076bf..6405e1203d 100644 --- a/packages/samples/specs/resource-manager/operationsTest/main.tsp +++ b/packages/samples/specs/resource-manager/operationsTest/main.tsp @@ -12,6 +12,8 @@ using Azure.ResourceManager; @service({ title: "Microsoft.OperationsTest", +}) +@OpenAPI.info({ version: "2022-11-01-preview", }) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) diff --git a/packages/samples/specs/resource-manager/servicelinker/servicelinker.tsp b/packages/samples/specs/resource-manager/servicelinker/servicelinker.tsp index daea95c8bd..e0cc9131a2 100644 --- a/packages/samples/specs/resource-manager/servicelinker/servicelinker.tsp +++ b/packages/samples/specs/resource-manager/servicelinker/servicelinker.tsp @@ -13,6 +13,8 @@ using Azure.ResourceManager; @armProviderNamespace @service({ title: "Microsoft.ServiceLinker provider", +}) +@OpenAPI.info({ version: "2021-01-01-privatepreview", }) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) diff --git a/packages/samples/specs/resource-manager/tagsUpdateTest/main.tsp b/packages/samples/specs/resource-manager/tagsUpdateTest/main.tsp index 03dfafab21..ef8ea52cc5 100644 --- a/packages/samples/specs/resource-manager/tagsUpdateTest/main.tsp +++ b/packages/samples/specs/resource-manager/tagsUpdateTest/main.tsp @@ -14,6 +14,8 @@ using Azure.Core; @armProviderNamespace("Microsoft.UpdateTests") @service({ title: "Microsoft.UpdateTests", +}) +@OpenAPI.info({ version: "2023-03-01-preview", }) @doc("Testing resource update using a Management API") diff --git a/packages/samples/specs/resource-manager/tenantResource/main.tsp b/packages/samples/specs/resource-manager/tenantResource/main.tsp index d71b7fb663..6a20fdd7c4 100644 --- a/packages/samples/specs/resource-manager/tenantResource/main.tsp +++ b/packages/samples/specs/resource-manager/tenantResource/main.tsp @@ -2,6 +2,7 @@ import "@typespec/http"; import "@typespec/rest"; import "@typespec/versioning"; import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/openapi"; using TypeSpec.Rest; using TypeSpec.Http; @@ -11,9 +12,11 @@ using Azure.ResourceManager; @armProviderNamespace @service({ title: "Microsoft.Contoso", - version: "2022-05-22-preview", }) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) +@OpenAPI.info({ + version: "2022-05-22-preview", +}) namespace Microsoft.Contoso; interface Operations extends Azure.ResourceManager.Operations {} diff --git a/packages/samples/test/output/azure/core/data-plane/confidentialledger/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/core/data-plane/confidentialledger/@azure-tools/typespec-autorest/openapi.json index 56d8aadc7c..38380b20c4 100644 --- a/packages/samples/test/output/azure/core/data-plane/confidentialledger/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/core/data-plane/confidentialledger/@azure-tools/typespec-autorest/openapi.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { "title": "Confidential Ledger Service", - "version": "2022-05-13", + "version": "0000-00-00", "x-typespec-generated": [ { "emitter": "@azure-tools/typespec-autorest" diff --git a/packages/samples/test/output/azure/core/data-plane/confidentialledger/@typespec/openapi3/openapi.yaml b/packages/samples/test/output/azure/core/data-plane/confidentialledger/@typespec/openapi3/openapi.yaml index 7d5bee226c..322a2e7f0f 100644 --- a/packages/samples/test/output/azure/core/data-plane/confidentialledger/@typespec/openapi3/openapi.yaml +++ b/packages/samples/test/output/azure/core/data-plane/confidentialledger/@typespec/openapi3/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: title: Confidential Ledger Service - version: 2022-05-13 + version: 0.0.0 tags: [] paths: /app/collections: diff --git a/packages/samples/test/output/azure/core/data-plane/formrecognizer/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/core/data-plane/formrecognizer/@azure-tools/typespec-autorest/openapi.json index 6bae9fd02a..2088ebcced 100644 --- a/packages/samples/test/output/azure/core/data-plane/formrecognizer/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/core/data-plane/formrecognizer/@azure-tools/typespec-autorest/openapi.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { "title": "Form Recognizer", - "version": "2021-09-30-preview", + "version": "0000-00-00", "description": "Extracts content, layout, and structured data from documents.", "x-typespec-generated": [ { diff --git a/packages/samples/test/output/azure/core/data-plane/formrecognizer/@typespec/openapi3/openapi.yaml b/packages/samples/test/output/azure/core/data-plane/formrecognizer/@typespec/openapi3/openapi.yaml index 44b7f29492..80d6112a29 100644 --- a/packages/samples/test/output/azure/core/data-plane/formrecognizer/@typespec/openapi3/openapi.yaml +++ b/packages/samples/test/output/azure/core/data-plane/formrecognizer/@typespec/openapi3/openapi.yaml @@ -1,8 +1,8 @@ openapi: 3.0.0 info: title: Form Recognizer - version: 2021-09-30-preview description: Extracts content, layout, and structured data from documents. + version: 0.0.0 tags: - name: Management - name: Analysis diff --git a/packages/samples/test/output/azure/core/data-plane/language/authoring/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/core/data-plane/language/authoring/@azure-tools/typespec-autorest/openapi.json index 2ccfe74612..4c490c1944 100644 --- a/packages/samples/test/output/azure/core/data-plane/language/authoring/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/core/data-plane/language/authoring/@azure-tools/typespec-autorest/openapi.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { "title": "Microsoft Cognitive Language Service - Analyze Text Authoring", - "version": "202ß2-05-15-preview", + "version": "0000-00-00", "x-typespec-generated": [ { "emitter": "@azure-tools/typespec-autorest" diff --git a/packages/samples/test/output/azure/core/data-plane/language/authoring/@typespec/openapi3/openapi.yaml b/packages/samples/test/output/azure/core/data-plane/language/authoring/@typespec/openapi3/openapi.yaml index e6c81e819f..fa32117dd4 100644 --- a/packages/samples/test/output/azure/core/data-plane/language/authoring/@typespec/openapi3/openapi.yaml +++ b/packages/samples/test/output/azure/core/data-plane/language/authoring/@typespec/openapi3/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: title: Microsoft Cognitive Language Service - Analyze Text Authoring - version: 202ß2-05-15-preview + version: 0.0.0 tags: [] paths: /authoring/analyze-text/projects: diff --git a/packages/samples/test/output/azure/core/data-plane/languageqna/Interface/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/core/data-plane/languageqna/Interface/@azure-tools/typespec-autorest/openapi.json index 08e7e1c5a7..cceaba2707 100644 --- a/packages/samples/test/output/azure/core/data-plane/languageqna/Interface/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/core/data-plane/languageqna/Interface/@azure-tools/typespec-autorest/openapi.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { "title": "Hello world", - "version": "0.1.0", + "version": "0000-00-00", "x-typespec-generated": [ { "emitter": "@azure-tools/typespec-autorest" diff --git a/packages/samples/test/output/azure/core/data-plane/languageqna/Interface/@typespec/openapi3/openapi.yaml b/packages/samples/test/output/azure/core/data-plane/languageqna/Interface/@typespec/openapi3/openapi.yaml index 79697fd3b9..9fb841c14c 100644 --- a/packages/samples/test/output/azure/core/data-plane/languageqna/Interface/@typespec/openapi3/openapi.yaml +++ b/packages/samples/test/output/azure/core/data-plane/languageqna/Interface/@typespec/openapi3/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: title: Hello world - version: 0.1.0 + version: 0.0.0 tags: [] paths: /feedback/{projectName}: diff --git a/packages/samples/test/output/azure/core/data-plane/languageqna/Raw/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/core/data-plane/languageqna/Raw/@azure-tools/typespec-autorest/openapi.json index ec0fe43084..5dc82e5641 100644 --- a/packages/samples/test/output/azure/core/data-plane/languageqna/Raw/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/core/data-plane/languageqna/Raw/@azure-tools/typespec-autorest/openapi.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { "title": "Microsoft Cognitive Language Service - Question Answering - Authoring", - "version": "21-10-01", + "version": "0000-00-00", "x-typespec-generated": [ { "emitter": "@azure-tools/typespec-autorest" diff --git a/packages/samples/test/output/azure/core/data-plane/languageqna/Raw/@typespec/openapi3/openapi.yaml b/packages/samples/test/output/azure/core/data-plane/languageqna/Raw/@typespec/openapi3/openapi.yaml index 05e26011e8..b7f6ba8016 100644 --- a/packages/samples/test/output/azure/core/data-plane/languageqna/Raw/@typespec/openapi3/openapi.yaml +++ b/packages/samples/test/output/azure/core/data-plane/languageqna/Raw/@typespec/openapi3/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: title: Microsoft Cognitive Language Service - Question Answering - Authoring - version: 21-10-01 + version: 0.0.0 tags: [] paths: /query-knowledgebases/projects: diff --git a/packages/samples/test/output/azure/core/data-plane/searchindex/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/core/data-plane/searchindex/@azure-tools/typespec-autorest/openapi.json index d9e4e65fa7..f60b0b7a0b 100644 --- a/packages/samples/test/output/azure/core/data-plane/searchindex/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/core/data-plane/searchindex/@azure-tools/typespec-autorest/openapi.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { "title": "SearchIndexClient", - "version": "2021-04-30-Preview", + "version": "0000-00-00", "x-typespec-generated": [ { "emitter": "@azure-tools/typespec-autorest" diff --git a/packages/samples/test/output/azure/core/data-plane/searchindex/@typespec/openapi3/openapi.yaml b/packages/samples/test/output/azure/core/data-plane/searchindex/@typespec/openapi3/openapi.yaml index 43766e9b0c..b214294190 100644 --- a/packages/samples/test/output/azure/core/data-plane/searchindex/@typespec/openapi3/openapi.yaml +++ b/packages/samples/test/output/azure/core/data-plane/searchindex/@typespec/openapi3/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: title: SearchIndexClient - version: 2021-04-30-Preview + version: 0.0.0 tags: - name: Documents paths: diff --git a/packages/samples/test/output/azure/core/data-plane/searchservice/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/azure/core/data-plane/searchservice/@azure-tools/typespec-autorest/openapi.json index b69af5efe3..6ba7f28939 100644 --- a/packages/samples/test/output/azure/core/data-plane/searchservice/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/azure/core/data-plane/searchservice/@azure-tools/typespec-autorest/openapi.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { "title": "Search Service", - "version": "2021-04-30-Preview", + "version": "0000-00-00", "description": "Client that can be used to manage and query indexes and documents, as well as manage other resources, on a search service.", "x-typespec-generated": [ { diff --git a/packages/samples/test/output/azure/core/data-plane/searchservice/@typespec/openapi3/openapi.yaml b/packages/samples/test/output/azure/core/data-plane/searchservice/@typespec/openapi3/openapi.yaml index 5debab905b..d249c75a4b 100644 --- a/packages/samples/test/output/azure/core/data-plane/searchservice/@typespec/openapi3/openapi.yaml +++ b/packages/samples/test/output/azure/core/data-plane/searchservice/@typespec/openapi3/openapi.yaml @@ -1,8 +1,8 @@ openapi: 3.0.0 info: title: Search Service - version: 2021-04-30-Preview description: Client that can be used to manage and query indexes and documents, as well as manage other resources, on a search service. + version: 0.0.0 tags: - name: DataSources - name: Service diff --git a/packages/samples/test/output/azure/core/misc/appconfig/@typespec/openapi3/openapi.yaml b/packages/samples/test/output/azure/core/misc/appconfig/@typespec/openapi3/openapi.yaml index 834c2a0a2d..f2cc5b088e 100644 --- a/packages/samples/test/output/azure/core/misc/appconfig/@typespec/openapi3/openapi.yaml +++ b/packages/samples/test/output/azure/core/misc/appconfig/@typespec/openapi3/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: title: App Config Service - version: 0000-00-00 + version: 0.0.0 tags: [] paths: /keys: diff --git a/packages/samples/test/output/core/petstore/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/core/petstore/@azure-tools/typespec-autorest/openapi.json index 41467cf195..ece1d43927 100644 --- a/packages/samples/test/output/core/petstore/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/core/petstore/@azure-tools/typespec-autorest/openapi.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { "title": "Pet Store Service", - "version": "2021-03-25", + "version": "0000-00-00", "description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", "x-typespec-generated": [ { diff --git a/packages/samples/test/output/core/rest/petstore/@azure-tools/typespec-autorest/openapi.json b/packages/samples/test/output/core/rest/petstore/@azure-tools/typespec-autorest/openapi.json index 4afff122a4..b9c8a49efa 100644 --- a/packages/samples/test/output/core/rest/petstore/@azure-tools/typespec-autorest/openapi.json +++ b/packages/samples/test/output/core/rest/petstore/@azure-tools/typespec-autorest/openapi.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { "title": "Pet Store Service", - "version": "2021-03-25", + "version": "0000-00-00", "x-typespec-generated": [ { "emitter": "@azure-tools/typespec-autorest" diff --git a/packages/typespec-autorest/src/openapi.ts b/packages/typespec-autorest/src/openapi.ts index 8ca25357ce..b03e7354ac 100644 --- a/packages/typespec-autorest/src/openapi.ts +++ b/packages/typespec-autorest/src/openapi.ts @@ -118,10 +118,10 @@ import { checkDuplicateTypeName, getExtensions, getExternalDocs, - getInfo, getOpenAPITypeName, getParameterKey, isReadonlyProperty, + resolveInfo, shouldInline, } from "@typespec/openapi"; import { buildVersionProjections } from "@typespec/versioning"; @@ -365,13 +365,13 @@ function createOAPIEmitter( function initializeEmitter(service: Service, multipleService: boolean, version?: string) { const auth = processAuth(service.type); + const info = resolveInfo(program, service.type); root = { swagger: "2.0", info: { - title: service.title ?? "(title)", - version: version ?? service.version ?? "0000-00-00", - description: getDoc(program, service.type), - ...getInfo(program, service.type), + title: "(title)", + ...info, + version: version ?? info?.version ?? "0000-00-00", "x-typespec-generated": getEmitterDetails(program), }, schemes: ["https"], @@ -401,7 +401,7 @@ function createOAPIEmitter( operationExamplesMap = new Map(); operationIdsWithExample = new Set(); - outputFile = resolveOutputFile(service, multipleService, options, version); + outputFile = resolveOutputFile(program, service, multipleService, options, version); } function resolveHost( @@ -2313,6 +2313,7 @@ export function sortOpenAPIDocument(doc: OpenAPI2Document): OpenAPI2Document { } function resolveOutputFile( + program: Program, service: Service, multipleServices: boolean, options: ResolvedAutorestEmitterOptions, @@ -2320,7 +2321,8 @@ function resolveOutputFile( ): string { const azureResourceProviderFolder = options.azureResourceProviderFolder; if (azureResourceProviderFolder) { - version = version ?? service.version ?? "0000-00-00"; + const info = resolveInfo(program, service.type); + version = version ?? info?.version ?? "0000-00-00"; } const interpolated = interpolatePath(options.outputFile, { "azure-resource-provider-folder": azureResourceProviderFolder, diff --git a/packages/typespec-autorest/test/info.test.ts b/packages/typespec-autorest/test/info.test.ts index 3cf5c21849..a467467753 100644 --- a/packages/typespec-autorest/test/info.test.ts +++ b/packages/typespec-autorest/test/info.test.ts @@ -16,7 +16,10 @@ describe("typespec-autorest: info", () => { it("set the service version with @service", async () => { const res = await openApiFor( ` - @service({version: "1.2.3-test"}) + @service({ + #suppress "deprecated" "For test" + version: "1.2.3-test" + }) namespace Foo {} ` ); diff --git a/packages/typespec-azure-portal-core/src/decorators.ts b/packages/typespec-azure-portal-core/src/decorators.ts index 07dc4811e5..9d80912a17 100644 --- a/packages/typespec-azure-portal-core/src/decorators.ts +++ b/packages/typespec-azure-portal-core/src/decorators.ts @@ -89,6 +89,7 @@ export function $promotion(context: DecoratorContext, target: Model, options: Mo } } else if (target.namespace) { const service = getService(program, target.namespace); + // eslint-disable-next-line deprecation/deprecation if (service?.version && currentApiVersion !== service.version) { reportDiagnostic(program, { code: "invalid-apiversion", diff --git a/packages/typespec-azure-resource-manager/test/resource.test.ts b/packages/typespec-azure-resource-manager/test/resource.test.ts index 27d7e866d3..994f73d21c 100644 --- a/packages/typespec-azure-resource-manager/test/resource.test.ts +++ b/packages/typespec-azure-resource-manager/test/resource.test.ts @@ -81,7 +81,7 @@ describe("typespec-azure-resource-manager: ARM resource model", () => { it("allows overriding armProviderNamespace", async () => { const { program, diagnostics } = await checkFor(` @armProviderNamespace - @service({title: "Microsoft.Test", version: "2022-03-01-preview"}) + @service({title: "Microsoft.Test"}) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) namespace Microsoft.Test { @@ -129,7 +129,7 @@ describe("typespec-azure-resource-manager: ARM resource model", () => { it("gathers metadata about ProxyResources", async () => { const { program, diagnostics } = await checkFor(` @armProviderNamespace - @service({title: "Microsoft.Test", version: "2022-03-01-preview"}) + @service({title: "Microsoft.Test"}) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) namespace Microsoft.Test; diff --git a/packages/typespec-azure-resource-manager/test/rules/operation-usage.test.ts b/packages/typespec-azure-resource-manager/test/rules/operation-usage.test.ts index b725369754..88812c24e0 100644 --- a/packages/typespec-azure-resource-manager/test/rules/operation-usage.test.ts +++ b/packages/typespec-azure-resource-manager/test/rules/operation-usage.test.ts @@ -166,7 +166,7 @@ describe("typespec-azure-resource-manager: improper list by subscription operati await tester .expect( ` - @service({title: "Microsoft.Foo"; version: "2022-01-10-alpha.1"}) + @service({title: "Microsoft.Foo"}) @armProviderNamespace @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) 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 f83e6234ba..c68eff87c0 100644 --- a/packages/typespec-client-generator-core/test/public-utils.test.ts +++ b/packages/typespec-client-generator-core/test/public-utils.test.ts @@ -184,7 +184,6 @@ describe("typespec-client-generator-core: public-utils", () => { await runner.compile(` @service({ title: "ApiVersion", - version: "1.0.0", }) @server( "{endpoint}/{ApiVersion}", diff --git a/packages/typespec-service-csharp/test/test-host.ts b/packages/typespec-service-csharp/test/test-host.ts index bb0611c2b6..54d76739d0 100644 --- a/packages/typespec-service-csharp/test/test-host.ts +++ b/packages/typespec-service-csharp/test/test-host.ts @@ -46,7 +46,7 @@ export async function createCSharpServiceEmitterTestRunner( export function getStandardService(code: string): string { return ` - @service({title: "Microsoft.Contoso", version: "2023-03-01-preview"}) + @service({title: "Microsoft.Contoso"}) @useDependency(Azure.Core.Versions.v1_0_Preview_2) namespace Microsoft.Contoso { ${code}