-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cognitive Services Form Recognizer v2.0-preview: Copy APIs (#8349)
* Update FormRecognizer v2.0-preview spec with new operations 'CopyCustomModel' and 'GetCustomModelCopyResult'. Added new sample files for the operation - 'CopyModel.json' and 'CopyOperationResult.json'. * Add claimResourceRegion. Remove move option from Copy data contract based on review. Fixed required property issue in AuthorizationClaim contract * Address PR comments * Remove authorizationClaim from CopyRequest contract. Updated reference for targetResourceRegion. Added pattern for targetResourceId * Fixed typo in CopyRequest required attribute * Add AuthorizationClaim contract and include it with CopyRequest * AuthorizationClaim - typo in required attrib * Rename AuthorizationClaim to Authorization * Rename modelResourceId to modelId in the 'Authorization' contract. Fixed copy sample * Adding source query string parameter to the POST copy request * Set 'application/json' consumes option for POST copy * Introduce models/copyAuthorization route. Added sample for the new route. Updated existing samples for correctness. * Change expirationDateTime to expirationDateTimeTicks in the CopyAuthorizationResult contract. Follows the 'expires_on' convention in the AAD token. * Remove enum reference for targetResourceRegion. Update to a loose pattern and length specification * Address ModelValidation and Sample validation errors * Fix copy samples JSON validation issues * Run prettier on FormRecognizer.json swagger and example files * Add sample for COpy operation result with errors. Fix description for copy operations * Prettier fix for CopyOperationResultWithErrors.json * Add LRO annotation to copy API
- Loading branch information
Showing
5 changed files
with
344 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...fication/cognitiveservices/data-plane/FormRecognizer/preview/v2.0/examples/CopyModel.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"parameters": { | ||
"endpoint": "{endpoint}", | ||
"Content-Type": "application/json", | ||
"Ocp-Apim-Subscription-Key": "{API key}", | ||
"modelId": "{modelId}", | ||
"body": {}, | ||
"copyRequest": { | ||
"targetResourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{resourceName}", | ||
"targetResourceRegion": "westus2", | ||
"copyAuthorization": { | ||
"modelId": "{modelId}", | ||
"accessToken": "{accessToken}", | ||
"expirationDateTimeTicks": 637190189980000000 | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"202": { | ||
"headers": { | ||
"Operation-Location": "{endpoint}/formrecognizer/v2.0-preview/custom/models/{modelId}/copyResults/{resultId}" | ||
} | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...itiveservices/data-plane/FormRecognizer/preview/v2.0/examples/CopyModelAuthorization.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"parameters": { | ||
"endpoint": "{endpoint}", | ||
"Content-Type": "application/json", | ||
"Ocp-Apim-Subscription-Key": "{API key}", | ||
"body": {} | ||
}, | ||
"responses": { | ||
"201": { | ||
"headers": { | ||
"Location": "{endpoint}/formrecognizer/v2.0-preview/custom/models/{modelId}" | ||
}, | ||
"body": { | ||
"modelId": "{modelId}", | ||
"accessToken": "{accessToken}", | ||
"expirationDateTimeTicks": 637190189980000000 | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...ognitiveservices/data-plane/FormRecognizer/preview/v2.0/examples/CopyOperationResult.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"parameters": { | ||
"endpoint": "{endpoint}", | ||
"Content-Type": "application/json", | ||
"Ocp-Apim-Subscription-Key": "{API key}", | ||
"modelId": "{modelId}", | ||
"resultId": "{resultId}", | ||
"body": {} | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"status": "succeeded", | ||
"createdDateTime": "2020-01-01T00:00:00Z", | ||
"lastUpdatedDateTime": "2020-01-01T00:01:00Z", | ||
"copyResult": { | ||
"modelId": "{modelId}", | ||
"errors": [] | ||
} | ||
} | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...rvices/data-plane/FormRecognizer/preview/v2.0/examples/CopyOperationResultWithErrors.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"parameters": { | ||
"endpoint": "{endpoint}", | ||
"Content-Type": "application/json", | ||
"Ocp-Apim-Subscription-Key": "{API key}", | ||
"modelId": "{modelId}", | ||
"resultId": "{resultId}", | ||
"body": {} | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"status": "failed", | ||
"createdDateTime": "2020-01-01T00:00:00Z", | ||
"lastUpdatedDateTime": "2020-01-01T00:01:00Z", | ||
"copyResult": { | ||
"modelId": "{modelId}", | ||
"errors": [ | ||
{ | ||
"code": "ResourceResolverError", | ||
"message": "{ErrorMessage}" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |