From 73e33d06b7f3c08b11717374837332cfc5f96a5d Mon Sep 17 00:00:00 2001 From: Dapeng Zhang Date: Tue, 9 Jul 2024 11:22:47 +0800 Subject: [PATCH] fix spread for purview datamap and translation document (#29707) * update * update * update * update translation * update * fix ai document translation * fix wrong change and regen * fix * update swagger * update * format * change to use @body * update * format --------- Co-authored-by: tadelesh --- .../routes.tsp | 48 +++++++---- .../stable/2023-09-01/purviewdatamap.json | 31 +++++-- .../Azure.AI.DocumentTranslation/client.tsp | 10 +++ .../Azure.AI.DocumentTranslation/models.tsp | 84 +++++++++++-------- .../Azure.AI.DocumentTranslation/routes.tsp | 4 +- .../stable/2024-05-01/openapi.json | 69 ++++++++------- 6 files changed, 146 insertions(+), 100 deletions(-) diff --git a/specification/purview/Azure.Analytics.Purview.DataMap/routes.tsp b/specification/purview/Azure.Analytics.Purview.DataMap/routes.tsp index 7dd2a7fb5645..b0bce3569d39 100644 --- a/specification/purview/Azure.Analytics.Purview.DataMap/routes.tsp +++ b/specification/purview/Azure.Analytics.Purview.DataMap/routes.tsp @@ -116,7 +116,7 @@ interface Entity { """) @query collectionId?: string; - } & AtlasEntityWithExtInfo, + } & BodyParameter, EntityMutationResult, AtlasApiVersionParameterTraits >; @@ -174,7 +174,7 @@ interface Entity { """) @query businessAttributeUpdateBehavior?: BusinessAttributeUpdateBehavior; - } & AtlasEntitiesWithExtInfo, + } & BodyParameter, EntityMutationResult, AtlasApiVersionParameterTraits >; @@ -205,7 +205,11 @@ interface Entity { @doc("Associate a classification to multiple entities in bulk.") @route("/atlas/v2/entity/bulk/classification") @post - addClassification is AtlasOperation; + addClassification is AtlasOperation< + BodyParameter, + void, + {} + >; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" @@ -447,7 +451,7 @@ interface Entity { """) @query("attr:qualifiedName") attribute?: string; - } & AtlasEntityWithExtInfo, + } & BodyParameter, EntityMutationResult, {} >; @@ -576,7 +580,7 @@ interface Entity { @route("/atlas/v2/entity/bulk/setClassifications") @post bulkSetClassifications is AtlasOperation< - AtlasEntityHeaders, + BodyParameter, OkResponse, {} >; @@ -765,7 +769,7 @@ interface Entity { @route("/atlas/v2/entity/businessmetadata/import") @post importBusinessMetadata is AtlasImportOperation< - BusinessMetadataOptions, + BodyParameter, BulkImportResult, MultipartFormDataRequestHeadersTraits >; @@ -966,7 +970,7 @@ interface Entity { @doc("The collection where entities will be moved to.") @query collectionId: string; - } & MoveEntitiesOptions, + } & BodyParameter, EntityMutationResult, {}, AtlasErrorResponse @@ -1011,7 +1015,7 @@ interface Glossary { @doc("Create a glossary.") @route("/atlas/v2/glossary") @post - create is AtlasOperation; + create is AtlasOperation, AtlasGlossary, {}>; #suppress "@azure-tools/typespec-azure-core/request-body-problem" "This is Atlas API behavior" #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" @@ -1035,7 +1039,7 @@ interface Glossary { @route("/atlas/v2/glossary/category") @post createCategory is AtlasOperation< - AtlasGlossaryCategory, + BodyParameter, AtlasGlossaryCategory, {} >; @@ -1065,7 +1069,7 @@ interface Glossary { @doc("The globally unique identifier of the category.") @path categoryId: string; - } & AtlasGlossaryCategory, + } & BodyParameter, AtlasGlossaryCategory, {} >; @@ -1178,7 +1182,7 @@ interface Glossary { @doc("Whether include term hierarchy") @query includeTermHierarchy?: boolean; - } & AtlasGlossaryTerm, + } & BodyParameter, AtlasGlossaryTerm, {} >; @@ -1210,7 +1214,7 @@ interface Glossary { @doc("Whether include term hierarchy") @query includeTermHierarchy?: boolean; - } & AtlasGlossaryTerm, + } & BodyParameter, AtlasGlossaryTerm, AtlasApiVersionParameterTraits >; @@ -1412,7 +1416,7 @@ interface Glossary { @doc("Whether ignore terms and categories") @query ignoreTermsAndCategories?: boolean; - } & AtlasGlossary, + } & BodyParameter, AtlasGlossary, AtlasApiVersionParameterTraits >; @@ -1752,14 +1756,22 @@ interface Relationship { @doc("Create a new relationship between entities.") @route("/atlas/v2/relationship") @post - create is AtlasOperation; + create is AtlasOperation< + BodyParameter, + AtlasRelationship, + {} + >; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" @doc("Update an existing relationship between entities.") @route("/atlas/v2/relationship") @put - update is AtlasOperation; + update is AtlasOperation< + BodyParameter, + AtlasRelationship, + {} + >; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" @@ -2051,7 +2063,7 @@ interface Type { """) @route("/atlas/v2/types/typedefs") @post - bulkCreate is AtlasOperation; + bulkCreate is AtlasOperation, AtlasTypesDef, {}>; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" @@ -2061,14 +2073,14 @@ interface Type { """) @route("/atlas/v2/types/typedefs") @put - bulkUpdate is AtlasOperation; + bulkUpdate is AtlasOperation, AtlasTypesDef, {}>; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" #suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This is Atlas API, which does not require api version" @doc("Delete API for all types in bulk.") @route("/atlas/v2/types/typedefs") @delete - bulkDelete is AtlasOperation; + bulkDelete is AtlasOperation, void, {}>; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "This is Atlas API" @doc("List all type definitions returned as a list of minimal information header.") diff --git a/specification/purview/data-plane/Azure.Analytics.Purview.DataMap/stable/2023-09-01/purviewdatamap.json b/specification/purview/data-plane/Azure.Analytics.Purview.DataMap/stable/2023-09-01/purviewdatamap.json index 2d8ab19b2b35..4acce1bf0f2f 100644 --- a/specification/purview/data-plane/Azure.Analytics.Purview.DataMap/stable/2023-09-01/purviewdatamap.json +++ b/specification/purview/data-plane/Azure.Analytics.Purview.DataMap/stable/2023-09-01/purviewdatamap.json @@ -101,6 +101,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasEntityWithExtInfo" @@ -241,6 +242,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasEntitiesWithExtInfo" @@ -312,6 +314,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/ClassificationAssociateOptions" @@ -344,6 +347,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasEntityHeaders" @@ -438,7 +442,11 @@ ], "parameters": [ { - "$ref": "#/parameters/BusinessMetadataOptions" + "name": "file", + "in": "formData", + "description": "InputStream of file", + "required": true, + "type": "file" } ], "responses": { @@ -1237,6 +1245,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasEntityWithExtInfo" @@ -1671,6 +1680,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasGlossary" @@ -1755,6 +1765,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasGlossary" @@ -2203,6 +2214,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasGlossaryCategory" @@ -2277,6 +2289,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasGlossaryCategory" @@ -2519,6 +2532,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasGlossaryTerm" @@ -2612,6 +2626,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasGlossaryTerm" @@ -3156,6 +3171,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasRelationship" @@ -3189,6 +3205,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasRelationship" @@ -3915,6 +3932,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasTypesDef" @@ -3948,6 +3966,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasTypesDef" @@ -3984,6 +4003,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/AtlasTypesDef" @@ -4142,6 +4162,7 @@ { "name": "body", "in": "body", + "description": "Body parameter.", "required": true, "schema": { "$ref": "#/definitions/MoveEntitiesOptions" @@ -8241,14 +8262,6 @@ "minLength": 1, "x-ms-parameter-location": "method", "x-ms-client-name": "apiVersion" - }, - "BusinessMetadataOptions": { - "name": "file", - "in": "formData", - "description": "InputStream of file", - "required": true, - "type": "file", - "x-ms-parameter-location": "method" } } } diff --git a/specification/translation/Azure.AI.DocumentTranslation/client.tsp b/specification/translation/Azure.AI.DocumentTranslation/client.tsp index 0eb76c501974..121ca660a59a 100644 --- a/specification/translation/Azure.AI.DocumentTranslation/client.tsp +++ b/specification/translation/Azure.AI.DocumentTranslation/client.tsp @@ -77,3 +77,13 @@ interface SingleDocumentTranslationClient { @@access(DocumentTranslation.DocumentsStatus, Access.internal, "python"); @@access(DocumentTranslation.SupportedFileFormats, Access.internal, "python"); @@access(DocumentTranslation.FileFormat, Access.internal, "python"); + +@@clientName(DocumentTranslation.DocumentTranslateBody.body, + "documentTranslateContent", + "csharp,java" +); + +@@clientName(DocumentTranslation.StartTranslationBody.body, + "startTranslationDetails", + "csharp,java" +); diff --git a/specification/translation/Azure.AI.DocumentTranslation/models.tsp b/specification/translation/Azure.AI.DocumentTranslation/models.tsp index 98f36a54789c..892e598176b8 100644 --- a/specification/translation/Azure.AI.DocumentTranslation/models.tsp +++ b/specification/translation/Azure.AI.DocumentTranslation/models.tsp @@ -10,41 +10,6 @@ using TypeSpec.Versioning; namespace DocumentTranslation; @doc("Document Translate Request Content") model DocumentTranslateContent { - @doc(""" - Specifies source language of the input document. - If this parameter isn't specified, automatic language detection is applied to determine the source language. - For example if the source document is written in English, then use sourceLanguage=en - """) - @query("sourceLanguage") - sourceLanguage?: string; - - @doc(""" - Specifies the language of the output document. - The target language must be one of the supported languages included in the translation scope. - For example if you want to translate the document in German language, then use targetLanguage=de - """) - @query("targetLanguage") - targetLanguage: string; - - @doc(""" - A string specifying the category (domain) of the translation. This parameter is used to get translations - from a customized system built with Custom Translator. Add the Category ID from your Custom Translator - project details to this parameter to use your deployed customized system. Default value is: general. - """) - @query("category") - category?: string = "general"; - - @doc(""" - Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist. - Possible values are: true (default) or false. - """) - @query("allowFallback") - allowFallback?: boolean; - - @doc("Content Type as multipart/form-data") - @header - contentType: "multipart/form-data"; - @doc("Document to be translated in the form") document: bytes; @@ -470,3 +435,52 @@ model FileFormat { @doc("Supported Type for this format") type?: string; } + +@doc("Document Translate Request Body") +model DocumentTranslateBody { + @doc(""" + Specifies source language of the input document. + If this parameter isn't specified, automatic language detection is applied to determine the source language. + For example if the source document is written in English, then use sourceLanguage=en + """) + @query("sourceLanguage") + sourceLanguage?: string; + + @doc(""" + Specifies the language of the output document. + The target language must be one of the supported languages included in the translation scope. + For example if you want to translate the document in German language, then use targetLanguage=de + """) + @query("targetLanguage") + targetLanguage: string; + + @doc(""" + A string specifying the category (domain) of the translation. This parameter is used to get translations + from a customized system built with Custom Translator. Add the Category ID from your Custom Translator + project details to this parameter to use your deployed customized system. Default value is: general. + """) + @query("category") + category?: string = "general"; + + @doc(""" + Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist. + Possible values are: true (default) or false. + """) + @query("allowFallback") + allowFallback?: boolean; + + @doc("Content Type as multipart/form-data") + @header + contentType: "multipart/form-data"; + + @doc("Document Translate Request Content") + @body + body: DocumentTranslateContent; +} + +@doc("Start Translation Request Body") +model StartTranslationBody { + @doc("Translation job submission batch request") + @body + body: StartTranslationDetails; +} diff --git a/specification/translation/Azure.AI.DocumentTranslation/routes.tsp b/specification/translation/Azure.AI.DocumentTranslation/routes.tsp index 63a640672fd5..4b556b6496dc 100644 --- a/specification/translation/Azure.AI.DocumentTranslation/routes.tsp +++ b/specification/translation/Azure.AI.DocumentTranslation/routes.tsp @@ -21,7 +21,7 @@ interface DocumentTranslationOperations { @route("document:translate") @post documentTranslate is RpcOperation< - DocumentTranslateContent, + DocumentTranslateBody, DocumentTranslateResult, ServiceTraits >; @@ -54,7 +54,7 @@ interface DocumentTranslationOperations { @route("/document/batches") @post startTranslation is Azure.Core.Foundations.Operation< - StartTranslationDetails, + StartTranslationBody, { @doc("Request has been accepted successfully.") @statusCode diff --git a/specification/translation/data-plane/Azure.AI.DocumentTranslation/stable/2024-05-01/openapi.json b/specification/translation/data-plane/Azure.AI.DocumentTranslation/stable/2024-05-01/openapi.json index 999176fb42ad..a24e8fa059f0 100644 --- a/specification/translation/data-plane/Azure.AI.DocumentTranslation/stable/2024-05-01/openapi.json +++ b/specification/translation/data-plane/Azure.AI.DocumentTranslation/stable/2024-05-01/openapi.json @@ -189,12 +189,7 @@ "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/StartTranslationDetails" - } + "$ref": "#/parameters/StartTranslationBody" } ], "responses": { @@ -577,25 +572,37 @@ "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { - "$ref": "#/parameters/DocumentTranslateContent.sourceLanguage" + "$ref": "#/parameters/DocumentTranslateBody.sourceLanguage" }, { - "$ref": "#/parameters/DocumentTranslateContent.targetLanguage" + "$ref": "#/parameters/DocumentTranslateBody.targetLanguage" }, { - "$ref": "#/parameters/DocumentTranslateContent.category" + "$ref": "#/parameters/DocumentTranslateBody.category" }, { - "$ref": "#/parameters/DocumentTranslateContent.allowFallback" + "$ref": "#/parameters/DocumentTranslateBody.allowFallback" }, { "$ref": "#/parameters/Azure.Core.ClientRequestIdHeader" }, { - "$ref": "#/parameters/DocumentTranslateContent.document" + "name": "document", + "in": "formData", + "description": "Document to be translated in the form", + "required": true, + "type": "file" }, { - "$ref": "#/parameters/DocumentTranslateContent.glossary" + "name": "glossary", + "in": "formData", + "description": "Glossary-translation memory will be used during translation in the form. ", + "required": false, + "type": "array", + "items": { + "type": "string", + "format": "binary" + } } ], "responses": { @@ -1412,7 +1419,7 @@ "x-ms-parameter-location": "method", "x-ms-client-name": "apiVersion" }, - "DocumentTranslateContent.allowFallback": { + "DocumentTranslateBody.allowFallback": { "name": "allowFallback", "in": "query", "description": "Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist. \nPossible values are: true (default) or false.", @@ -1420,7 +1427,7 @@ "type": "boolean", "x-ms-parameter-location": "method" }, - "DocumentTranslateContent.category": { + "DocumentTranslateBody.category": { "name": "category", "in": "query", "description": "A string specifying the category (domain) of the translation. This parameter is used to get translations \nfrom a customized system built with Custom Translator. Add the Category ID from your Custom Translator \nproject details to this parameter to use your deployed customized system. Default value is: general.", @@ -1429,27 +1436,7 @@ "default": "general", "x-ms-parameter-location": "method" }, - "DocumentTranslateContent.document": { - "name": "document", - "in": "formData", - "description": "Document to be translated in the form", - "required": true, - "type": "file", - "x-ms-parameter-location": "method" - }, - "DocumentTranslateContent.glossary": { - "name": "glossary", - "in": "formData", - "description": "Glossary-translation memory will be used during translation in the form. ", - "required": false, - "type": "array", - "items": { - "type": "string", - "format": "binary" - }, - "x-ms-parameter-location": "method" - }, - "DocumentTranslateContent.sourceLanguage": { + "DocumentTranslateBody.sourceLanguage": { "name": "sourceLanguage", "in": "query", "description": "Specifies source language of the input document.\nIf this parameter isn't specified, automatic language detection is applied to determine the source language.\nFor example if the source document is written in English, then use sourceLanguage=en", @@ -1457,13 +1444,23 @@ "type": "string", "x-ms-parameter-location": "method" }, - "DocumentTranslateContent.targetLanguage": { + "DocumentTranslateBody.targetLanguage": { "name": "targetLanguage", "in": "query", "description": "Specifies the language of the output document.\nThe target language must be one of the supported languages included in the translation scope.\nFor example if you want to translate the document in German language, then use targetLanguage=de ", "required": true, "type": "string", "x-ms-parameter-location": "method" + }, + "StartTranslationBody": { + "name": "body", + "in": "body", + "description": "Translation job submission batch request", + "required": true, + "schema": { + "$ref": "#/definitions/StartTranslationDetails" + }, + "x-ms-parameter-location": "method" } } }