From b7a423d0a7598925fb8fd233c93b2bfcd4202e40 Mon Sep 17 00:00:00 2001 From: Mark Cowlishaw Date: Fri, 12 May 2023 15:06:13 -0700 Subject: [PATCH 1/3] Content-safety changes --- .../ContentSafety/routes.tsp | 24 +++++++++++-------- .../ContentSafety/tspconfig.yaml | 5 ++-- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index a8736c4483e4..2ca98ad2dc76 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -1,5 +1,5 @@ import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-client-generator-core"; +//import "@azure-tools/typespec-client-generator-core"; import "@typespec/http"; import "@typespec/rest"; import "./models.tsp"; @@ -9,7 +9,7 @@ using TypeSpec.Rest; using TypeSpec.Versioning; using Azure.Core; using Azure.Core.Traits; -using Azure.ClientGenerator.Core; +//using Azure.ClientGenerator.Core; namespace ContentSafety; @@ -43,26 +43,30 @@ interface ImageOperations { >; } +interface BlockOps + extends Azure.Core.ResourceOperations {} interface TextBlocklists { @summary("Get Text Blocklist By blocklistName") @doc("Returns text blocklist details.") - getTextBlocklist is Azure.Core.ResourceRead; + getTextBlocklist is BlockOps.ResourceRead; @summary("Create Or Update Text Blocklist") @doc("Updates a text blocklist, if blocklistName does not exist, create a new blocklist.") - createOrUpdateTextBlocklist is Azure.Core.ResourceCreateOrUpdate; + createOrUpdateTextBlocklist is BlockOps.ResourceCreateOrUpdate; @summary("Delete Text Blocklist By blocklistName") @doc("Deletes a text blocklist.") - deleteTextBlocklist is Azure.Core.ResourceDelete; + deleteTextBlocklist is BlockOps.ResourceDelete; @summary("Get All Text Blocklists") @doc("Get all text blocklists details.") - listTextBlocklists is Azure.Core.ResourceList; + listTextBlocklists is BlockOps.ResourceList; @summary("Add BlockItems To Text Blocklist") @doc("Add blockItems to a text blocklist. You can add at most 100 BlockItems in one request.") - addBlockItems is ResourceAction< + addBlockItems is BlockOps.ResourceAction< TextBlocklist, AddBlockItemsOptions, AddBlockItemsResult @@ -70,7 +74,7 @@ interface TextBlocklists { @summary("Remove BlockItems From Text Blocklist") @doc("Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request.") - removeBlockItems is ResourceAction< + removeBlockItems is BlockOps.ResourceAction< TextBlocklist, RemoveBlockItemsOptions, NoContentResponse @@ -78,11 +82,11 @@ interface TextBlocklists { @summary("Get BlockItem By blocklistName And blockItemId") @doc("Get blockItem By blockItemId from a text blocklist.") - getTextBlocklistItem is Azure.Core.ResourceRead; + getTextBlocklistItem is BlockOps.ResourceRead; @summary("Get All BlockItems By blocklistName") @doc("Get all blockItems in a text blocklist") - listTextBlocklistItems is Azure.Core.ResourceList< + listTextBlocklistItems is BlockOps.ResourceList< TextBlockItem, ListQueryParametersTrait >; diff --git a/specification/cognitiveservices/ContentSafety/tspconfig.yaml b/specification/cognitiveservices/ContentSafety/tspconfig.yaml index 976e4bb86aa4..adf734570bd8 100644 --- a/specification/cognitiveservices/ContentSafety/tspconfig.yaml +++ b/specification/cognitiveservices/ContentSafety/tspconfig.yaml @@ -13,8 +13,9 @@ emit: - "@azure-tools/typespec-autorest" options: "@azure-tools/typespec-autorest": - output-file: "contentsafety.json" - azure-resource-provider-folder: ../../../../data-plane + emitter-output-dir: "{project-root}/../" + output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/contentsafety.json" + azure-resource-provider-folder: "data-plane" examples-directory: ./examples "@azure-tools/typespec-python": package-name: "azure-ai-contentsafety" From b703e70f9b77fdf007100ac4baf2fa1dc5a9e1c7 Mon Sep 17 00:00:00 2001 From: Mark Cowlishaw Date: Fri, 12 May 2023 15:15:20 -0700 Subject: [PATCH 2/3] Include swagger --- .../preview/2023-04-30-preview/contentsafety.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-04-30-preview/contentsafety.json b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-04-30-preview/contentsafety.json index c365ee78d707..cfddf992ac58 100644 --- a/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-04-30-preview/contentsafety.json +++ b/specification/cognitiveservices/data-plane/ContentSafety/preview/2023-04-30-preview/contentsafety.json @@ -121,7 +121,7 @@ "type": "string", "format": "uri", "description": "The link to the next page of items", - "x-typespec-name": "Rest.ResourceLocation" + "x-typespec-name": "TypeSpec.Rest.ResourceLocation" } }, "description": "Paged collection of TextBlocklist items", @@ -453,7 +453,7 @@ "type": "string", "format": "uri", "description": "The link to the next page of items", - "x-typespec-name": "Rest.ResourceLocation" + "x-typespec-name": "TypeSpec.Rest.ResourceLocation" } }, "description": "Paged collection of TextBlockItem items", From 4d503fe0b0e0abf077e39af54f86a4cba3749aa6 Mon Sep 17 00:00:00 2001 From: Mark Cowlishaw Date: Fri, 12 May 2023 15:18:22 -0700 Subject: [PATCH 3/3] Responding to review comments --- specification/cognitiveservices/ContentSafety/routes.tsp | 2 -- 1 file changed, 2 deletions(-) diff --git a/specification/cognitiveservices/ContentSafety/routes.tsp b/specification/cognitiveservices/ContentSafety/routes.tsp index 2ca98ad2dc76..ed7eefc5212e 100644 --- a/specification/cognitiveservices/ContentSafety/routes.tsp +++ b/specification/cognitiveservices/ContentSafety/routes.tsp @@ -1,5 +1,4 @@ import "@azure-tools/typespec-azure-core"; -//import "@azure-tools/typespec-client-generator-core"; import "@typespec/http"; import "@typespec/rest"; import "./models.tsp"; @@ -9,7 +8,6 @@ using TypeSpec.Rest; using TypeSpec.Versioning; using Azure.Core; using Azure.Core.Traits; -//using Azure.ClientGenerator.Core; namespace ContentSafety;