diff --git a/specification/ai/Azure.AI.Projects/client.tsp b/specification/ai/Azure.AI.Projects/client.tsp index f90a88b505a4..824baab5664e 100644 --- a/specification/ai/Azure.AI.Projects/client.tsp +++ b/specification/ai/Azure.AI.Projects/client.tsp @@ -33,7 +33,3 @@ using Azure.ClientGenerator.Core; // input parameter that calls either on these two. @@access(Azure.AI.Projects.Connections.get, Access.internal); @@access(Azure.AI.Projects.Connections.getWithCredentials, Access.internal); - -// For some reason for Python the emitter creates an empty ServicePatternsOperations operation -// class. Mark it as internal here. Apply to all languages just in case. -//@@access(Azure.AI.Projects.ServicePatterns, Access.internal); <== this did not work. It makes all methods internal. diff --git a/specification/ai/Azure.AI.Projects/datasets/routes.tsp b/specification/ai/Azure.AI.Projects/datasets/routes.tsp index d899cfad1df5..a5e70a86c074 100644 --- a/specification/ai/Azure.AI.Projects/datasets/routes.tsp +++ b/specification/ai/Azure.AI.Projects/datasets/routes.tsp @@ -17,14 +17,14 @@ alias ListDatasetVersionsParameters = {}; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "We are using service specific operation templates" @added(Versions.v2025_05_01) interface Datasets - extends ServicePatterns.VersionedOperations< + extends VersionedOperations< DatasetVersion, ListDatasetVersionsParameters, ListDatasetVersionsParameters > { @doc("Start a new or get an existing pending upload of a dataset for a specific version.") @Rest.action("startPendingUpload") - startPendingUploadVersion is ServicePatterns.VersionedResourceActionWithBody< + startPendingUploadVersion is VersionedResourceActionWithBody< DatasetVersion, PendingUploadRequest, PendingUploadResponse @@ -35,7 +35,7 @@ interface Datasets @Rest.actionSeparator("/") @Rest.action("startPendingUpload") @Http.post - startPendingUpload is ServicePatterns.UnversionedResourceAction< + startPendingUpload is UnversionedResourceAction< DatasetVersion, PendingUploadRequest, PendingUploadResponse @@ -48,7 +48,7 @@ interface Datasets @post @Rest.action("credentials") @Rest.actionSeparator("/") - getCredentials is ServicePatterns.VersionedResourceActionNoBody< + getCredentials is VersionedResourceActionNoBody< DatasetVersion, AssetCredentialResponse >; diff --git a/specification/ai/Azure.AI.Projects/indexes/routes.tsp b/specification/ai/Azure.AI.Projects/indexes/routes.tsp index 0ff537f47c20..e962747d2d10 100644 --- a/specification/ai/Azure.AI.Projects/indexes/routes.tsp +++ b/specification/ai/Azure.AI.Projects/indexes/routes.tsp @@ -15,7 +15,7 @@ alias ListIndexVersionParameters = {}; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "We are using service specific operation templates" @added(Versions.v2025_05_01) interface Indexes - extends ServicePatterns.VersionedOperations< + extends VersionedOperations< Index, ListIndexVersionParameters, ListIndexVersionParameters diff --git a/specification/ai/Azure.AI.Projects/servicepatterns.tsp b/specification/ai/Azure.AI.Projects/servicepatterns.tsp index 2dd4c36f9910..5f4d87d83196 100644 --- a/specification/ai/Azure.AI.Projects/servicepatterns.tsp +++ b/specification/ai/Azure.AI.Projects/servicepatterns.tsp @@ -2,162 +2,165 @@ import "@typespec/http"; import "@typespec/rest"; import "@azure-tools/typespec-azure-core"; -namespace Azure.AI.Projects.ServicePatterns { - @Rest.autoRoute - interface VersionedOperations< - TEntityType extends Reflection.Model, - TListLatestParameters extends Reflection.Model = {}, - TListVersionsParameters extends Reflection.Model = {} - > { - #suppress "@azure-tools/typespec-azure-core/verb-conflict" "We are using the resource action as a building block." - @doc("List all versions of the given {name}", TEntityType) - @Rest.action("versions") - @Rest.actionSeparator("/") - @Http.get - listVersions is BuildingBlocks.CoreOps.ResourceAction< - TEntityType, - TListVersionsParameters, - Azure.Core.Page - >; +namespace Azure.AI.Projects; - @doc("List the latest version of each {name}", TEntityType) - @Rest.listsResource(TEntityType) - listLatest is Azure.Core.Foundations.ResourceList< - TEntityType, - TListLatestParameters, - Azure.Core.Page - >; +alias CoreOps = Azure.Core.StandardResourceOperations; - @doc("Get the specific version of the {name}", TEntityType) - getVersion is Azure.Core.Foundations.ResourceOperation< - TEntityType, - { - @doc("The specific version id of the {name} to retrieve.", TEntityType) - @Rest.segment("versions") - @Http.path - version: string; - }, - Azure.Core.Foundations.ResourceOkResponse - >; +/* +alias RepeatableCoreOps = Azure.Core.ResourceOperations; +*/ - @doc("Delete the specific version of the {name}", TEntityType) - @Http.delete - deleteVersion is Azure.Core.Foundations.ResourceOperation< - TEntityType, - { - @doc("The version of the {name} to delete.", TEntityType) - @Rest.segment("versions") - @Http.path - version: string; - }, - Http.NoContentResponse - >; - - /* Reenable this once the service supports "unversioned" operations - @doc( - "Create a new {name}. The version id will be generated by the service.", - TEntityType - ) - @Rest.actionSeparator("/") - @Rest.action("versions") - @Http.post - create is BuildingBlocks.RepeatableCoreOps.ResourceAction< - TEntityType, - { - @doc("The definition of the {name} to create", TEntityType) - @Http.bodyRoot - body: TEntityType; - }, - TEntityType - >; - */ - - @doc( - "Create a new or update an existing {name} with the given version id", - TEntityType - ) - @Http.patch - createOrUpdateVersion is Azure.Core.Foundations.ResourceOperation< - TEntityType, - { - @doc("The definition of the {name} to create or update", TEntityType) - @Http.bodyRoot - body: TEntityType; - - @doc("Content type for patch") - @Http.header("Content-Type") - contentType: "application/merge-patch+json"; +@Rest.autoRoute +interface VersionedOperations< + TEntityType extends Reflection.Model, + TListLatestParameters extends Reflection.Model = {}, + TListVersionsParameters extends Reflection.Model = {} +> { + #suppress "@azure-tools/typespec-azure-core/verb-conflict" "We are using the resource action as a building block." + @doc("List all versions of the given {name}", TEntityType) + @Rest.action("versions") + @Rest.actionSeparator("/") + @Http.get + listVersions is CoreOps.ResourceAction< + TEntityType, + TListVersionsParameters, + Azure.Core.Page + >; - @doc( - "The specific version id of the {name} to create or replace.", - TEntityType - ) - @Rest.segment("versions") - @Http.path - version: string; - }, - Azure.Core.Foundations.ResourceCreatedOrOkResponse - >; - } + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Suppress `Operation should be defined using a signature from the Azure.Core namespace.`" + @doc("List the latest version of each {name}", TEntityType) + @Rest.listsResource(TEntityType) + listLatest is Azure.Core.Foundations.ResourceList< + TEntityType, + TListLatestParameters, + Azure.Core.Page + >; - @Rest.action - op VersionedResourceActionWithBody< - TEntityType extends Reflection.Model, - TParams, - TResponse - > is Azure.Core.Foundations.ResourceOperation< + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Suppress `Operation should be defined using a signature from the Azure.Core namespace.`" + @doc("Get the specific version of the {name}", TEntityType) + getVersion is Azure.Core.Foundations.ResourceOperation< TEntityType, { - @doc("Parameters for the action") - @Http.bodyRoot - body: TParams; - - @doc("The specific version id of the {name} to operate on.", TEntityType) + @doc("The specific version id of the {name} to retrieve.", TEntityType) @Rest.segment("versions") @Http.path version: string; }, - TResponse + Azure.Core.Foundations.ResourceOkResponse >; - @Rest.action - op VersionedResourceActionNoBody< - TEntityType extends Reflection.Model, - TResponse - > is Azure.Core.Foundations.ResourceOperation< + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Suppress `Operation should be defined using a signature from the Azure.Core namespace.`" + @doc("Delete the specific version of the {name}", TEntityType) + @Http.delete + deleteVersion is Azure.Core.Foundations.ResourceOperation< TEntityType, { - @doc("The specific version id of the {name} to operate on.", TEntityType) + @doc("The version of the {name} to delete.", TEntityType) @Rest.segment("versions") @Http.path version: string; }, - TResponse + Http.NoContentResponse >; /* Reenable this once the service supports "unversioned" operations - @Rest.action - op UnversionedResourceAction< - TEntityType extends Reflection.Model, - TParams, - TResponse - > is Azure.Core.Foundations.ResourceOperation< + @doc( + "Create a new {name}. The version id will be generated by the service.", + TEntityType + ) + @Rest.actionSeparator("/") + @Rest.action("versions") + @Http.post + create is RepeatableCoreOps.ResourceAction< TEntityType, { - @doc("Parameters for the action") + @doc("The definition of the {name} to create", TEntityType) @Http.bodyRoot - body: TParams; + body: TEntityType; }, - TResponse + TEntityType >; */ - namespace BuildingBlocks { - alias CoreOps = Azure.Core.StandardResourceOperations; - /* - alias RepeatableCoreOps = Azure.Core.ResourceOperations; - */ - } + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Suppress `Operation should be defined using a signature from the Azure.Core namespace.`" + @doc( + "Create a new or update an existing {name} with the given version id", + TEntityType + ) + @Http.patch + createOrUpdateVersion is Azure.Core.Foundations.ResourceOperation< + TEntityType, + { + @doc("The definition of the {name} to create or update", TEntityType) + @Http.bodyRoot + body: TEntityType; + + @doc("Content type for patch") + @Http.header("Content-Type") + contentType: "application/merge-patch+json"; + + @doc( + "The specific version id of the {name} to create or replace.", + TEntityType + ) + @Rest.segment("versions") + @Http.path + version: string; + }, + Azure.Core.Foundations.ResourceCreatedOrOkResponse + >; } + +@Rest.action +op VersionedResourceActionWithBody< + TEntityType extends Reflection.Model, + TParams, + TResponse +> is Azure.Core.Foundations.ResourceOperation< + TEntityType, + { + @doc("Parameters for the action") + @Http.bodyRoot + body: TParams; + + @doc("The specific version id of the {name} to operate on.", TEntityType) + @Rest.segment("versions") + @Http.path + version: string; + }, + TResponse +>; + +@Rest.action +op VersionedResourceActionNoBody< + TEntityType extends Reflection.Model, + TResponse +> is Azure.Core.Foundations.ResourceOperation< + TEntityType, + { + @doc("The specific version id of the {name} to operate on.", TEntityType) + @Rest.segment("versions") + @Http.path + version: string; + }, + TResponse +>; + +/* Reenable this once the service supports "unversioned" operations +@Rest.action +op UnversionedResourceAction< + TEntityType extends Reflection.Model, + TParams, + TResponse +> is Azure.Core.Foundations.ResourceOperation< + TEntityType, + { + @doc("Parameters for the action") + @Http.bodyRoot + body: TParams; + }, + TResponse +>; +*/