From fda21b260fd4ba8f30e38f98464a2ff873e2b143 Mon Sep 17 00:00:00 2001 From: Graham Thomas Date: Thu, 7 Mar 2024 10:39:19 -0800 Subject: [PATCH] Adds errorCode and explanation; Replaces pagination with continuationToken (#28061) * Adds errorCode and explanation; Replaces pagination with continuationToken * Updates to use standard Azure Foundation Error --------- Co-authored-by: Graham Thomas --- .../2024-01-31-preview/Jobs_List.json | 3 +- .../2024-01-31-preview/Jobs_ListFiles.json | 10 +++-- .../models.tsp | 18 ++++++-- .../routes.tsp | 4 +- ...HealthDataAIServices.Deidentification.json | 44 +++++++------------ .../examples/Jobs_List.json | 3 +- .../examples/Jobs_ListFiles.json | 10 +++-- 7 files changed, 49 insertions(+), 43 deletions(-) diff --git a/specification/healthdataaiservices/HealthDataAIServices.Deidentification/examples/2024-01-31-preview/Jobs_List.json b/specification/healthdataaiservices/HealthDataAIServices.Deidentification/examples/2024-01-31-preview/Jobs_List.json index 6cd2cc52e1ae..4bb3ca01a6d9 100644 --- a/specification/healthdataaiservices/HealthDataAIServices.Deidentification/examples/2024-01-31-preview/Jobs_List.json +++ b/specification/healthdataaiservices/HealthDataAIServices.Deidentification/examples/2024-01-31-preview/Jobs_List.json @@ -3,9 +3,8 @@ "operationId": "Jobs_List", "parameters": { "api-version": "2024-01-31-preview", - "top": 10, - "skip": 10, "maxpagesize": 10, + "continuationToken": "K1JJRDpzOEtaQWZabUQrQUNBQUFBQUFBQUFBQT09I1JUOjEjVFJDOjEwI0ZQQzpBZ0VBQUFBTUFDUUFBQUFBQUE9PQ==", "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000" }, "responses": { diff --git a/specification/healthdataaiservices/HealthDataAIServices.Deidentification/examples/2024-01-31-preview/Jobs_ListFiles.json b/specification/healthdataaiservices/HealthDataAIServices.Deidentification/examples/2024-01-31-preview/Jobs_ListFiles.json index e1966a2f2cc1..d63577611ce2 100644 --- a/specification/healthdataaiservices/HealthDataAIServices.Deidentification/examples/2024-01-31-preview/Jobs_ListFiles.json +++ b/specification/healthdataaiservices/HealthDataAIServices.Deidentification/examples/2024-01-31-preview/Jobs_ListFiles.json @@ -4,9 +4,8 @@ "parameters": { "api-version": "2024-01-31-preview", "name": "documents_smith_1", - "top": 10, - "skip": 10, "maxpagesize": 10, + "continuationToken": "K1JJRDpzOEtaQWZabUQrQUNBQUFBQUFBQUFBQT09I1JUOjEjVFJDOjEwI0ZQQzpBZ0VBQUFBTUFDUUFBQUFBQUE9PQ==", "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000" }, "responses": { @@ -16,7 +15,12 @@ { "path": "/documents/patient_doc_1", "status": "Failed", - "explanation": "File was moved after job started.", + "error": { + "code": "FileNotFound", + "message": "File was moved after job started.", + "target": "SourceFile", + "details": [] + }, "etag": "0x8DB638EEA0CC717" } ], diff --git a/specification/healthdataaiservices/HealthDataAIServices.Deidentification/models.tsp b/specification/healthdataaiservices/HealthDataAIServices.Deidentification/models.tsp index 8f78fab2412f..574de3592ff0 100644 --- a/specification/healthdataaiservices/HealthDataAIServices.Deidentification/models.tsp +++ b/specification/healthdataaiservices/HealthDataAIServices.Deidentification/models.tsp @@ -46,6 +46,10 @@ model Job { @visibility("read") createdAt: utcDateTime; + @doc("Error when job fails in it's entirety.") + @visibility("read") + error?: Azure.Core.Foundations.Error; + @doc("Date and time when the job was started.") @visibility("read") startedAt?: utcDateTime; @@ -78,9 +82,8 @@ model File { @doc("Status of the file.") status: Azure.Core.Foundations.OperationState; - // TODO: Maybe this should be called reason? - @doc("Explanation of current status. If needed.") - explanation?: string; + @doc("Error when file fails.") + error?: Azure.Core.Foundations.Error; ...EtagProperty; } @@ -326,3 +329,12 @@ model PhiEntity { @doc("Confidence score of the text/type pairing.") confidenceScore?: float64; } + +@doc("Query parameters for listing jobs.") +model PaginationByTokenQueryParameters { + ...MaxPageSizeQueryParameter; + + @query + @doc("Token to continue a previous query.") + continuationToken?: string; +} diff --git a/specification/healthdataaiservices/HealthDataAIServices.Deidentification/routes.tsp b/specification/healthdataaiservices/HealthDataAIServices.Deidentification/routes.tsp index d4d2bb65ebff..57c6e0cf1b7e 100644 --- a/specification/healthdataaiservices/HealthDataAIServices.Deidentification/routes.tsp +++ b/specification/healthdataaiservices/HealthDataAIServices.Deidentification/routes.tsp @@ -31,13 +31,13 @@ interface Jobs { @summary("List DeID Jobs") list is DeidOperations.ResourceList< Job, - ListQueryParametersTrait + ListQueryParametersTrait >; @summary("List processed files within a Job") listFiles is DeidOperations.ResourceList< File, - ListQueryParametersTrait + ListQueryParametersTrait >; @summary("Cancel a DeID Job") diff --git a/specification/healthdataaiservices/data-plane/HealthDataAIServices.Deidentification/preview/2024-01-31-preview/HealthDataAIServices.Deidentification.json b/specification/healthdataaiservices/data-plane/HealthDataAIServices.Deidentification/preview/2024-01-31-preview/HealthDataAIServices.Deidentification.json index 9b166b84acda..13e5b78fc605 100644 --- a/specification/healthdataaiservices/data-plane/HealthDataAIServices.Deidentification/preview/2024-01-31-preview/HealthDataAIServices.Deidentification.json +++ b/specification/healthdataaiservices/data-plane/HealthDataAIServices.Deidentification/preview/2024-01-31-preview/HealthDataAIServices.Deidentification.json @@ -108,13 +108,10 @@ "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { - "$ref": "#/parameters/Azure.Core.TopQueryParameter" - }, - { - "$ref": "#/parameters/Azure.Core.SkipQueryParameter" + "$ref": "#/parameters/Azure.Core.MaxPageSizeQueryParameter" }, { - "$ref": "#/parameters/Azure.Core.MaxPageSizeQueryParameter" + "$ref": "#/parameters/PaginationByTokenQueryParameters.continuationToken" }, { "$ref": "#/parameters/Azure.Core.ClientRequestIdHeader" @@ -431,13 +428,10 @@ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-_]+[a-zA-Z0-9]$" }, { - "$ref": "#/parameters/Azure.Core.TopQueryParameter" - }, - { - "$ref": "#/parameters/Azure.Core.SkipQueryParameter" + "$ref": "#/parameters/Azure.Core.MaxPageSizeQueryParameter" }, { - "$ref": "#/parameters/Azure.Core.MaxPageSizeQueryParameter" + "$ref": "#/parameters/PaginationByTokenQueryParameters.continuationToken" }, { "$ref": "#/parameters/Azure.Core.ClientRequestIdHeader" @@ -676,9 +670,9 @@ "$ref": "#/definitions/Azure.Core.Foundations.OperationState", "description": "Status of the file." }, - "explanation": { - "type": "string", - "description": "Explanation of current status. If needed." + "error": { + "$ref": "#/definitions/Azure.Core.Foundations.Error", + "description": "Error when file fails." }, "etag": { "$ref": "#/definitions/Azure.Core.eTag", @@ -739,6 +733,11 @@ "description": "Date and time when the job was created.", "readOnly": true }, + "error": { + "$ref": "#/definitions/Azure.Core.Foundations.Error", + "description": "Error when job fails in it's entirety.", + "readOnly": true + }, "startedAt": { "type": "string", "format": "date-time", @@ -1325,23 +1324,12 @@ "format": "int32", "x-ms-parameter-location": "method" }, - "Azure.Core.SkipQueryParameter": { - "name": "skip", - "in": "query", - "description": "The number of result items to skip.", - "required": false, - "type": "integer", - "format": "int32", - "default": 0, - "x-ms-parameter-location": "method" - }, - "Azure.Core.TopQueryParameter": { - "name": "top", + "PaginationByTokenQueryParameters.continuationToken": { + "name": "continuationToken", "in": "query", - "description": "The number of result items to return.", + "description": "Token to continue a previous query.", "required": false, - "type": "integer", - "format": "int32", + "type": "string", "x-ms-parameter-location": "method" } } diff --git a/specification/healthdataaiservices/data-plane/HealthDataAIServices.Deidentification/preview/2024-01-31-preview/examples/Jobs_List.json b/specification/healthdataaiservices/data-plane/HealthDataAIServices.Deidentification/preview/2024-01-31-preview/examples/Jobs_List.json index 6cd2cc52e1ae..4bb3ca01a6d9 100644 --- a/specification/healthdataaiservices/data-plane/HealthDataAIServices.Deidentification/preview/2024-01-31-preview/examples/Jobs_List.json +++ b/specification/healthdataaiservices/data-plane/HealthDataAIServices.Deidentification/preview/2024-01-31-preview/examples/Jobs_List.json @@ -3,9 +3,8 @@ "operationId": "Jobs_List", "parameters": { "api-version": "2024-01-31-preview", - "top": 10, - "skip": 10, "maxpagesize": 10, + "continuationToken": "K1JJRDpzOEtaQWZabUQrQUNBQUFBQUFBQUFBQT09I1JUOjEjVFJDOjEwI0ZQQzpBZ0VBQUFBTUFDUUFBQUFBQUE9PQ==", "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000" }, "responses": { diff --git a/specification/healthdataaiservices/data-plane/HealthDataAIServices.Deidentification/preview/2024-01-31-preview/examples/Jobs_ListFiles.json b/specification/healthdataaiservices/data-plane/HealthDataAIServices.Deidentification/preview/2024-01-31-preview/examples/Jobs_ListFiles.json index e1966a2f2cc1..d63577611ce2 100644 --- a/specification/healthdataaiservices/data-plane/HealthDataAIServices.Deidentification/preview/2024-01-31-preview/examples/Jobs_ListFiles.json +++ b/specification/healthdataaiservices/data-plane/HealthDataAIServices.Deidentification/preview/2024-01-31-preview/examples/Jobs_ListFiles.json @@ -4,9 +4,8 @@ "parameters": { "api-version": "2024-01-31-preview", "name": "documents_smith_1", - "top": 10, - "skip": 10, "maxpagesize": 10, + "continuationToken": "K1JJRDpzOEtaQWZabUQrQUNBQUFBQUFBQUFBQT09I1JUOjEjVFJDOjEwI0ZQQzpBZ0VBQUFBTUFDUUFBQUFBQUE9PQ==", "x-ms-client-request-id": "00000000-0000-0000-0000-000000000000" }, "responses": { @@ -16,7 +15,12 @@ { "path": "/documents/patient_doc_1", "status": "Failed", - "explanation": "File was moved after job started.", + "error": { + "code": "FileNotFound", + "message": "File was moved after job started.", + "target": "SourceFile", + "details": [] + }, "etag": "0x8DB638EEA0CC717" } ],