Skip to content

Commit

Permalink
Adds errorCode and explanation; Replaces pagination with continuation…
Browse files Browse the repository at this point in the history
…Token (Azure#28061)

* Adds errorCode and explanation; Replaces pagination with continuationToken

* Updates to use standard Azure Foundation Error

---------

Co-authored-by: Graham Thomas <[email protected]>
  • Loading branch information
GrahamMThomas and Graham Thomas committed May 8, 2024
1 parent 188032c commit fda21b2
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ interface Jobs {
@summary("List DeID Jobs")
list is DeidOperations.ResourceList<
Job,
ListQueryParametersTrait<StandardListQueryParameters>
ListQueryParametersTrait<PaginationByTokenQueryParameters>
>;

@summary("List processed files within a Job")
listFiles is DeidOperations.ResourceList<
File,
ListQueryParametersTrait<StandardListQueryParameters>
ListQueryParametersTrait<PaginationByTokenQueryParameters>
>;

@summary("Cancel a DeID Job")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
}
],
Expand Down

0 comments on commit fda21b2

Please sign in to comment.