diff --git a/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/client.tsp b/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/client.tsp index a8c005137e41..86cddadfeb88 100644 --- a/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/client.tsp +++ b/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/client.tsp @@ -67,3 +67,7 @@ interface QuestionAnsweringAuthoringClientOperations { #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "specified in routes.tsp" addFeedback is Language.QuestionAnswering.Authoring.QuestionAnsweringProjects.addFeedback; } + +@@clientName(QuestionAnsweringProjectMetadata, "QuestionAnsweringProject"); +@@clientName(ExportOptions.format, "fileFormat"); +@@clientName(ImportOptions.format, "fileFormat"); diff --git a/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/preview/2025-05-15-preview/questionanswering-authoring.json b/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/preview/2025-05-15-preview/questionanswering-authoring.json index dbd7ee3a4fb5..fbb2546a6dac 100644 --- a/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/preview/2025-05-15-preview/questionanswering-authoring.json +++ b/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/preview/2025-05-15-preview/questionanswering-authoring.json @@ -296,65 +296,10 @@ "pattern": "^(?=[a-zA-Z0-9])[a-zA-Z0-9-]{0,98}[a-zA-Z0-9]$" }, { - "name": "format", - "in": "query", - "description": "Knowledge base Import or Export format.", - "required": false, - "type": "string", - "default": "json", - "enum": [ - "json", - "tsv", - "excel" - ], - "x-ms-enum": { - "name": "format", - "modelAsString": true, - "values": [ - { - "name": "json", - "value": "json", - "description": "Export or Import QnA assets in JSON format." - }, - { - "name": "tsv", - "value": "tsv", - "description": "Export or Import knowledge base replica including all assets and metadata in\nExcel format." - }, - { - "name": "excel", - "value": "excel", - "description": "Export or Import knowledge base replica including all assets and metadata in\nTsv format." - } - ] - } + "$ref": "#/parameters/ExportOptions.format" }, { - "name": "assetKind", - "in": "query", - "description": "Kind of the asset of the project.", - "required": false, - "type": "string", - "enum": [ - "qnas", - "synonyms" - ], - "x-ms-enum": { - "name": "AssestKind", - "modelAsString": true, - "values": [ - { - "name": "qnas", - "value": "qnas", - "description": "Question and Answers." - }, - { - "name": "synonyms", - "value": "synonyms", - "description": "Synonyms." - } - ] - } + "$ref": "#/parameters/ExportOptions.assetKind" } ], "responses": { @@ -410,74 +355,13 @@ "pattern": "^(?=[a-zA-Z0-9])[a-zA-Z0-9-]{0,98}[a-zA-Z0-9]$" }, { - "name": "format", - "in": "query", - "description": "Knowledge base Import or Export format.", - "required": false, - "type": "string", - "default": "json", - "enum": [ - "json", - "tsv", - "excel" - ], - "x-ms-enum": { - "name": "format", - "modelAsString": true, - "values": [ - { - "name": "json", - "value": "json", - "description": "Export or Import QnA assets in JSON format." - }, - { - "name": "tsv", - "value": "tsv", - "description": "Export or Import knowledge base replica including all assets and metadata in\nExcel format." - }, - { - "name": "excel", - "value": "excel", - "description": "Export or Import knowledge base replica including all assets and metadata in\nTsv format." - } - ] - } + "$ref": "#/parameters/ImportOptions.format" }, { - "name": "assetKind", - "in": "query", - "description": "Kind of the asset of the project.", - "required": false, - "type": "string", - "enum": [ - "qnas", - "synonyms" - ], - "x-ms-enum": { - "name": "AssestKind", - "modelAsString": true, - "values": [ - { - "name": "qnas", - "value": "qnas", - "description": "Question and Answers." - }, - { - "name": "synonyms", - "value": "synonyms", - "description": "Synonyms." - } - ] - } + "$ref": "#/parameters/ImportOptions.assetKind" }, { - "name": "body", - "in": "body", - "description": "Project assets the needs to be imported.", - "required": false, - "schema": { - "$ref": "#/definitions/ImportJobOptions" - } + "$ref": "#/parameters/ImportOptions.body" } ], "responses": { @@ -3306,6 +3190,142 @@ "minLength": 1, "x-ms-parameter-location": "method", "x-ms-client-name": "apiVersion" + }, + "ExportOptions.assetKind": { + "name": "assetKind", + "in": "query", + "description": "Kind of the asset of the project.", + "required": false, + "type": "string", + "enum": [ + "qnas", + "synonyms" + ], + "x-ms-enum": { + "name": "AssestKind", + "modelAsString": true, + "values": [ + { + "name": "qnas", + "value": "qnas", + "description": "Question and Answers." + }, + { + "name": "synonyms", + "value": "synonyms", + "description": "Synonyms." + } + ] + }, + "x-ms-parameter-location": "method" + }, + "ExportOptions.format": { + "name": "format", + "in": "query", + "description": "Knowledge base Import or Export format.", + "required": false, + "type": "string", + "default": "json", + "enum": [ + "json", + "tsv", + "excel" + ], + "x-ms-enum": { + "name": "format", + "modelAsString": true, + "values": [ + { + "name": "json", + "value": "json", + "description": "Export or Import QnA assets in JSON format." + }, + { + "name": "tsv", + "value": "tsv", + "description": "Export or Import knowledge base replica including all assets and metadata in\nExcel format." + }, + { + "name": "excel", + "value": "excel", + "description": "Export or Import knowledge base replica including all assets and metadata in\nTsv format." + } + ] + }, + "x-ms-parameter-location": "method" + }, + "ImportOptions.assetKind": { + "name": "assetKind", + "in": "query", + "description": "Kind of the asset of the project.", + "required": false, + "type": "string", + "enum": [ + "qnas", + "synonyms" + ], + "x-ms-enum": { + "name": "AssestKind", + "modelAsString": true, + "values": [ + { + "name": "qnas", + "value": "qnas", + "description": "Question and Answers." + }, + { + "name": "synonyms", + "value": "synonyms", + "description": "Synonyms." + } + ] + }, + "x-ms-parameter-location": "method" + }, + "ImportOptions.body": { + "name": "body", + "in": "body", + "description": "Project assets the needs to be imported.", + "required": false, + "schema": { + "$ref": "#/definitions/ImportJobOptions" + }, + "x-ms-parameter-location": "method" + }, + "ImportOptions.format": { + "name": "format", + "in": "query", + "description": "Knowledge base Import or Export format.", + "required": false, + "type": "string", + "default": "json", + "enum": [ + "json", + "tsv", + "excel" + ], + "x-ms-enum": { + "name": "format", + "modelAsString": true, + "values": [ + { + "name": "json", + "value": "json", + "description": "Export or Import QnA assets in JSON format." + }, + { + "name": "tsv", + "value": "tsv", + "description": "Export or Import knowledge base replica including all assets and metadata in\nExcel format." + }, + { + "name": "excel", + "value": "excel", + "description": "Export or Import knowledge base replica including all assets and metadata in\nTsv format." + } + ] + }, + "x-ms-parameter-location": "method" } } } diff --git a/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/routes.tsp b/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/routes.tsp index b19b634a67fa..ed8cde5a884a 100644 --- a/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/routes.tsp +++ b/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/routes.tsp @@ -13,6 +13,37 @@ using Azure.Core.Traits; namespace Language.QuestionAnswering.Authoring; +/** + * Optional query/body parameters for the export operation. + * Using a named model enables client-side renaming without breaking wire contract. + */ +model ExportOptions { + /** Knowledge base Import or Export format. */ + @query("format") + format?: format = format.json; + + /** Kind of the asset of the project. */ + @query("assetKind") + assetKind?: AssestKind; +} + +/** + * Optional query/body parameters for the import operation. + */ +model ImportOptions { + /** Knowledge base Import or Export format. */ + @query("format") + format?: format = format.json; + + /** Kind of the asset of the project. */ + @query("assetKind") + assetKind?: AssestKind; + + /** Project assets the needs to be imported. */ + @bodyRoot + body?: ImportJobOptions; +} + alias ServiceTraits = NoRepeatableRequests & NoConditionalRequests & NoClientRequestId; @@ -80,25 +111,14 @@ interface QuestionAnsweringProjects { @pollingOperation(QuestionAnsweringProjects.getExportStatus) export is Foundations.LongRunningOperation< { - /** - * The name of the project to use. - */ + /** The name of the project to use. */ @maxLength(100) @pattern("^(?=[a-zA-Z0-9])[a-zA-Z0-9-]{0,98}[a-zA-Z0-9]$") @path projectName: string; - /** - * Knowledge base Import or Export format. - */ - @query("format") - format?: format = format.json; - - /** - * Kind of the asset of the project. - */ - @query("assetKind") - assetKind?: AssestKind; + /** Optional export parameters. See `ExportOptions`. */ + ... ExportOptions; }, ExportJobResponse, {}, @@ -122,31 +142,14 @@ interface QuestionAnsweringProjects { @pollingOperation(QuestionAnsweringProjects.getImportStatus) `import` is Foundations.LongRunningOperation< { - /** - * The name of the project to use. - */ + /** The name of the project to use. */ @maxLength(100) @pattern("^(?=[a-zA-Z0-9])[a-zA-Z0-9-]{0,98}[a-zA-Z0-9]$") @path projectName: string; - /** - * Knowledge base Import or Export format. - */ - @query("format") - format?: format = format.json; - - /** - * Kind of the asset of the project. - */ - @query("assetKind") - assetKind?: AssestKind; - - /** - * Project assets the needs to be imported. - */ - @bodyRoot - body?: ImportJobOptions; + /** Optional import parameters. See `ImportOptions`. */ + ... ImportOptions; }, AcceptedResponse, {}, diff --git a/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/stable/2023-04-01/questionanswering-authoring.json b/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/stable/2023-04-01/questionanswering-authoring.json index a26f86d3035b..25d5aa9641b9 100644 --- a/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/stable/2023-04-01/questionanswering-authoring.json +++ b/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/stable/2023-04-01/questionanswering-authoring.json @@ -296,65 +296,10 @@ "pattern": "^(?=[a-zA-Z0-9])[a-zA-Z0-9-]{0,98}[a-zA-Z0-9]$" }, { - "name": "format", - "in": "query", - "description": "Knowledge base Import or Export format.", - "required": false, - "type": "string", - "default": "json", - "enum": [ - "json", - "tsv", - "excel" - ], - "x-ms-enum": { - "name": "format", - "modelAsString": true, - "values": [ - { - "name": "json", - "value": "json", - "description": "Export or Import QnA assets in JSON format." - }, - { - "name": "tsv", - "value": "tsv", - "description": "Export or Import knowledge base replica including all assets and metadata in\nExcel format." - }, - { - "name": "excel", - "value": "excel", - "description": "Export or Import knowledge base replica including all assets and metadata in\nTsv format." - } - ] - } + "$ref": "#/parameters/ExportOptions.format" }, { - "name": "assetKind", - "in": "query", - "description": "Kind of the asset of the project.", - "required": false, - "type": "string", - "enum": [ - "qnas", - "synonyms" - ], - "x-ms-enum": { - "name": "AssestKind", - "modelAsString": true, - "values": [ - { - "name": "qnas", - "value": "qnas", - "description": "Question and Answers." - }, - { - "name": "synonyms", - "value": "synonyms", - "description": "Synonyms." - } - ] - } + "$ref": "#/parameters/ExportOptions.assetKind" } ], "responses": { @@ -410,74 +355,13 @@ "pattern": "^(?=[a-zA-Z0-9])[a-zA-Z0-9-]{0,98}[a-zA-Z0-9]$" }, { - "name": "format", - "in": "query", - "description": "Knowledge base Import or Export format.", - "required": false, - "type": "string", - "default": "json", - "enum": [ - "json", - "tsv", - "excel" - ], - "x-ms-enum": { - "name": "format", - "modelAsString": true, - "values": [ - { - "name": "json", - "value": "json", - "description": "Export or Import QnA assets in JSON format." - }, - { - "name": "tsv", - "value": "tsv", - "description": "Export or Import knowledge base replica including all assets and metadata in\nExcel format." - }, - { - "name": "excel", - "value": "excel", - "description": "Export or Import knowledge base replica including all assets and metadata in\nTsv format." - } - ] - } + "$ref": "#/parameters/ImportOptions.format" }, { - "name": "assetKind", - "in": "query", - "description": "Kind of the asset of the project.", - "required": false, - "type": "string", - "enum": [ - "qnas", - "synonyms" - ], - "x-ms-enum": { - "name": "AssestKind", - "modelAsString": true, - "values": [ - { - "name": "qnas", - "value": "qnas", - "description": "Question and Answers." - }, - { - "name": "synonyms", - "value": "synonyms", - "description": "Synonyms." - } - ] - } + "$ref": "#/parameters/ImportOptions.assetKind" }, { - "name": "body", - "in": "body", - "description": "Project assets the needs to be imported.", - "required": false, - "schema": { - "$ref": "#/definitions/ImportJobOptions" - } + "$ref": "#/parameters/ImportOptions.body" } ], "responses": { @@ -3097,6 +2981,142 @@ "minLength": 1, "x-ms-parameter-location": "method", "x-ms-client-name": "apiVersion" + }, + "ExportOptions.assetKind": { + "name": "assetKind", + "in": "query", + "description": "Kind of the asset of the project.", + "required": false, + "type": "string", + "enum": [ + "qnas", + "synonyms" + ], + "x-ms-enum": { + "name": "AssestKind", + "modelAsString": true, + "values": [ + { + "name": "qnas", + "value": "qnas", + "description": "Question and Answers." + }, + { + "name": "synonyms", + "value": "synonyms", + "description": "Synonyms." + } + ] + }, + "x-ms-parameter-location": "method" + }, + "ExportOptions.format": { + "name": "format", + "in": "query", + "description": "Knowledge base Import or Export format.", + "required": false, + "type": "string", + "default": "json", + "enum": [ + "json", + "tsv", + "excel" + ], + "x-ms-enum": { + "name": "format", + "modelAsString": true, + "values": [ + { + "name": "json", + "value": "json", + "description": "Export or Import QnA assets in JSON format." + }, + { + "name": "tsv", + "value": "tsv", + "description": "Export or Import knowledge base replica including all assets and metadata in\nExcel format." + }, + { + "name": "excel", + "value": "excel", + "description": "Export or Import knowledge base replica including all assets and metadata in\nTsv format." + } + ] + }, + "x-ms-parameter-location": "method" + }, + "ImportOptions.assetKind": { + "name": "assetKind", + "in": "query", + "description": "Kind of the asset of the project.", + "required": false, + "type": "string", + "enum": [ + "qnas", + "synonyms" + ], + "x-ms-enum": { + "name": "AssestKind", + "modelAsString": true, + "values": [ + { + "name": "qnas", + "value": "qnas", + "description": "Question and Answers." + }, + { + "name": "synonyms", + "value": "synonyms", + "description": "Synonyms." + } + ] + }, + "x-ms-parameter-location": "method" + }, + "ImportOptions.body": { + "name": "body", + "in": "body", + "description": "Project assets the needs to be imported.", + "required": false, + "schema": { + "$ref": "#/definitions/ImportJobOptions" + }, + "x-ms-parameter-location": "method" + }, + "ImportOptions.format": { + "name": "format", + "in": "query", + "description": "Knowledge base Import or Export format.", + "required": false, + "type": "string", + "default": "json", + "enum": [ + "json", + "tsv", + "excel" + ], + "x-ms-enum": { + "name": "format", + "modelAsString": true, + "values": [ + { + "name": "json", + "value": "json", + "description": "Export or Import QnA assets in JSON format." + }, + { + "name": "tsv", + "value": "tsv", + "description": "Export or Import knowledge base replica including all assets and metadata in\nExcel format." + }, + { + "name": "excel", + "value": "excel", + "description": "Export or Import knowledge base replica including all assets and metadata in\nTsv format." + } + ] + }, + "x-ms-parameter-location": "method" } } } diff --git a/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/tspconfig.yaml b/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/tspconfig.yaml index d4a09436f401..69f65132ebfd 100644 --- a/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/tspconfig.yaml +++ b/specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring/tspconfig.yaml @@ -12,13 +12,6 @@ options: emitter-output-dir: "{project-root}" examples-dir: "{project-root}/examples" output-file: "{version-status}/{version}/questionanswering-authoring.json" - "@azure-tools/typespec-csharp": - emitter-output-dir: "{output-dir}/{service-dir}/{namespace}" - clear-output-folder: true - model-namespace: false - namespace: "Azure.AI.Language.QuestionAnswering.Authoring" - flavor: azure - generate-sample-project: false "@azure-tools/typespec-python": emitter-output-dir: "{output-dir}/{service-dir}/azure-ai-language-questionanswering-authoring" package-name: "azure-ai-language-questionanswering-authoring"