Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions specification/ai/Azure.AI.Projects/common/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,12 @@ alias AssetBase = {

@doc("The name of the resource")
@visibility("read")
name?: string;
@key
name: string;

@doc("The version of the resource")
@visibility("read")
version?: string;
version: string;

@doc("The asset description text.")
description?: string;
Expand All @@ -250,11 +251,11 @@ alias AssetBase = {
systemData?: SystemData;
};

#suppress "@azure-tools/typespec-providerhub/no-inline-model" "Need to create reponses correctly"
#suppress "@azure-tools/typespec-providerhub/no-inline-model" "Need to create responses correctly"
alias ResourceCreatedResponse<T extends TypeSpec.Reflection.Model> = TypeSpec.Http.Response<201> &
T;

#suppress "@azure-tools/typespec-providerhub/no-inline-model" "Need to create reponses correctly"
#suppress "@azure-tools/typespec-providerhub/no-inline-model" "Need to create responses correctly"
alias OkResponse<T extends TypeSpec.Reflection.Model> = TypeSpec.Http.Response<200> &
T;

Expand Down
14 changes: 1 addition & 13 deletions specification/ai/Azure.AI.Projects/datasets/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ union DatasetType {

#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance"
@doc("DatasetVersion Definition")
@Rest.resource("datasets")
@discriminator("type")
model DatasetVersion {
@doc("[Required] Uri of the data. Example: https://go.microsoft.com/fwlink/?linkid=2202330")
Expand Down Expand Up @@ -61,16 +62,3 @@ model FolderDatasetVersion extends DatasetVersion {
@doc("Dataset type")
type: DatasetType.uri_folder;
}

@doc("PagedDataVersionBase Definition")
@pagedResult
model PagedDatasetVersion {
@doc("The list of DatasetVersions.")
@extension("x-ms-identifiers", [])
@items
value: DatasetVersion[];

@doc("The link to the next page of results, if any.")
@nextLink
nextLink?: string;
}
163 changes: 44 additions & 119 deletions specification/ai/Azure.AI.Projects/datasets/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "../common/models.tsp";
import "./models.tsp";
import "../servicepatterns.tsp";

using TypeSpec.Http;
using TypeSpec.Rest;
Expand All @@ -14,123 +15,47 @@ using Azure.Core.Foundations;

namespace Azure.AI.Projects;

interface Datasets {
#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("List latest version of each dataset in a project.")
@route("/datasets")
@get
listLatestDatasets(
@doc("Continuation token for pagination. This is the nextLink from the previous response.")
@query("$continuationToken")
$continuationToken?: string,

@doc("View type for including/excluding (for example) archived entities.")
@query("listViewType")
listViewType?: ListViewType,
): PagedDatasetVersion;

#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("List dataset versions of a specific dataset")
@route("/datasets/{name}/versions")
@get
listDatasetVersions(
@doc("Container name.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")
@path
name: string,

@doc("Please choose OrderBy value from ['createdtime', 'modifiedtime']")
@query("$orderBy")
$orderBy?: string,

@doc("Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned")
@query("$top")
$top?: int32,

@doc("Continuation token for pagination.")
@query("$skip")
$skip?: string,

@doc("Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2")
@query("$tags")
$tags?: string,

@doc("[ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities.")
@query("listViewType")
listViewType?: ListViewType,
): PagedDatasetVersion;

#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("Delete version.")
@route("/datasets/{name}/versions/{version}")
@delete
deleteVersion(
@doc("Container name.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")
@path
name: string,

@doc("Version identifier.")
@path
version: string,
): void;

#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("Get dataset version.")
@route("/datasets/{name}/versions/{version}")
@get
getVersion(
@doc("Container name.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")
@path
name: string,

@doc("Version identifier.")
@path
version: string,
): DatasetVersion;

#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("Create or update version.")
@route("/datasets/{name}/versions/{version}")
@put
createOrUpdate(
@doc("Container name.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")
@path
name: string,

@doc("Version identifier.")
@path
version: string,

@doc("Version entity to create or update.")
@body
datasetVersion: DatasetVersion,
): DatasetVersion;

#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("Start pending upload.")
@post
@route("/datasets/{name}/versions/{version}/startPendingUpload")
createOrGetStartPendingUpload(
@doc("Container name.")
@pattern("^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,254}$")
@path
name: string,

@doc("Version identifier.")
@path
version: string,

@doc("Pensing upload request.")
@body
pendingUploadRequest: PendingUploadRequest,
): PendingUploadResponse;
alias ListDatasetVersionsParameters = {
@doc("Please choose OrderBy value from ['createdtime', 'modifiedtime']")
@query("$orderBy")
$orderBy?: string;

@doc("Top count of results, top count cannot be greater than the page size. If topCount > page size, results with be default page size count will be returned")
@query("$top")
$top?: int32;

@doc("Continuation token for pagination.")
@query("$skip")
$skip?: string;

@doc("Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2")
@query("$tags")
$tags?: string;

@doc("[ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All] View type for including/excluding (for example) archived entities.")
@query("listViewType")
listViewType?: ListViewType;
};

alias ListLatestDataSetVersionParameters = {
@doc("View type for including/excluding (for example) archived entities.")
@query("listViewType")
listViewType?: ListViewType;
};

#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "We are using service specific operation templates"
interface Datasets
extends ServicePatterns.VersionedOperations<
DatasetVersion,
ListLatestDataSetVersionParameters,
ListDatasetVersionsParameters
> {
/**
* Create or start a pending upload of a dataset
*/
startPendingUpload is ServicePatterns.VersionedResourceAction<
DatasetVersion,
PendingUploadRequest,
PendingUploadResponse
>;
}
2 changes: 1 addition & 1 deletion specification/ai/Azure.AI.Projects/evaluations/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface Evaluations {
@post
createRun is Azure.Core.Foundations.Operation<
{
@doc("Evalution to be run")
@doc("Evaluation to be run")
@body
evaluation: Evaluation;
},
Expand Down
14 changes: 1 addition & 13 deletions specification/ai/Azure.AI.Projects/indexes/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,14 @@ namespace Azure.AI.Projects;

@doc("Index resource Definition")
@discriminator("indexType")
@Rest.resource("indexes")
model Index {
@doc("Type of index")
indexType: IndexType;

...AssetBase;
}

@doc("Paged collection of Index items.")
@pagedResult
model PagedIndex {
@doc("The list of Indexes.")
@extension("x-ms-identifiers", [])
@items
value: Index[];

@doc("The link to the next page of items")
@nextLink
nextLink?: ResourceLocation<Index>;
}

@doc("Azure AI Search Index Definition")
model AzureAISearchIndex extends Index {
@doc("Type of index")
Expand Down
Loading
Loading