Skip to content

Commit

Permalink
Fixes for FaceAPI (Azure#14556)
Browse files Browse the repository at this point in the history
* Fixes for FaceAPI

Added header definitions on PersonDirectory related 202 responses and fixed async operation
status names.
Fixed required name parameter being optional issue on FaceList/PersonGroup creation.

* Prettier fixes

* Rename contract

Co-authored-by: Yang Chen <yachen4@microsoft.com>
  • Loading branch information
msyache and Yang Chen authored Jun 8, 2021
1 parent f4a4da1 commit 1f26e64
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2492,7 +2492,7 @@
"200": {
"description": "A successful call returns the operation's status.",
"schema": {
"$ref": "#/definitions/AsyncStatus"
"$ref": "#/definitions/OperationStatus"
}
},
"default": {
Expand Down Expand Up @@ -2582,6 +2582,12 @@
"responses": {
"202": {
"description": "Success",
"headers": {
"Operation-Location": {
"description": "Operation location with an operation id used to track the progress of person creation.",
"type": "string"
}
},
"schema": {
"$ref": "#/definitions/PersonCreationResponse"
}
Expand Down Expand Up @@ -2665,7 +2671,13 @@
],
"responses": {
"202": {
"description": "Success"
"description": "Success",
"headers": {
"Operation-Location": {
"description": "Operation location with an operation id used to track the progress of person creation.",
"type": "string"
}
}
},
"default": {
"description": "Response entity accompanying non-successful responses containing additional details about the error.",
Expand Down Expand Up @@ -2766,6 +2778,12 @@
"responses": {
"202": {
"description": "Success",
"headers": {
"Operation-Location": {
"description": "Operation location with an operation id used to track the progress of person creation.",
"type": "string"
}
},
"schema": {
"$ref": "#/definitions/EnrollmentPrintResponse"
}
Expand Down Expand Up @@ -2864,7 +2882,13 @@
],
"responses": {
"202": {
"description": "Success"
"description": "Success",
"headers": {
"Operation-Location": {
"description": "Operation location with an operation id used to track the progress of person creation.",
"type": "string"
}
}
},
"default": {
"description": "Response entity accompanying non-successful responses containing additional details about the error.",
Expand Down Expand Up @@ -3029,7 +3053,13 @@
"description": "Success"
},
"202": {
"description": "Success"
"description": "Success",
"headers": {
"Operation-Location": {
"description": "Operation location with an operation id used to track the progress of person creation.",
"type": "string"
}
}
},
"default": {
"description": "Response entity accompanying non-successful responses containing additional details about the error.",
Expand Down Expand Up @@ -3076,7 +3106,13 @@
],
"responses": {
"202": {
"description": "Success"
"description": "Success",
"headers": {
"Operation-Location": {
"description": "Operation location with an operation id used to track the progress of person creation.",
"type": "string"
}
}
},
"default": {
"description": "Response entity accompanying non-successful responses containing additional details about the error.",
Expand Down Expand Up @@ -3149,7 +3185,13 @@
],
"responses": {
"202": {
"description": "Success"
"description": "Success",
"headers": {
"Operation-Location": {
"description": "Operation location with an operation id used to track the progress of person creation.",
"type": "string"
}
}
},
"default": {
"description": "Response entity accompanying non-successful responses containing additional details about the error.",
Expand Down Expand Up @@ -3670,6 +3712,12 @@
"responses": {
"202": {
"description": "Success",
"headers": {
"Operation-Location": {
"description": "Operation location with an operation id used to track the progress of person creation.",
"type": "string"
}
},
"schema": {
"$ref": "#/definitions/EnrollmentPrintResponse"
}
Expand Down Expand Up @@ -4813,6 +4861,26 @@
"minimum": 0,
"maximum": 1
},
"NameAndUserDataContractForCreation": {
"type": "object",
"description": "A combination of user defined name and user specified data for the person, largePersonGroup/personGroup, and largeFaceList/faceList.",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"description": "User defined name, maximum length is 128.",
"maxLength": 128,
"minLength": 1
},
"userData": {
"type": "string",
"description": "User specified data. Length should not exceed 16KB.",
"maxLength": 16384
}
}
},
"NameAndUserDataContract": {
"type": "object",
"description": "A combination of user defined name and user specified data for the person, largePersonGroup/personGroup, and largeFaceList/faceList.",
Expand All @@ -4839,7 +4907,7 @@
},
"allOf": [
{
"$ref": "#/definitions/NameAndUserDataContract"
"$ref": "#/definitions/NameAndUserDataContractForCreation"
}
]
},
Expand Down Expand Up @@ -5014,48 +5082,6 @@
}
}
},
"OperationStatus": {
"type": "object",
"required": [
"status",
"createdTime"
],
"description": "Operation status object. Operation refers to the asynchronous backend task including taking a snapshot and applying a snapshot.",
"properties": {
"status": {
"type": "string",
"description": "Operation status: notstarted, running, succeeded, failed. If the operation is requested and waiting to perform, the status is notstarted. If the operation is ongoing in backend, the status is running. Status succeeded means the operation is completed successfully, specifically for snapshot taking operation, it illustrates the snapshot is well taken and ready to apply, and for snapshot applying operation, it presents the target object has finished creating by the snapshot and ready to be used. Status failed is often caused by editing the source object while taking the snapshot or editing the target object while applying the snapshot before completion, see the field \"message\" to check the failure reason.",
"x-ms-enum": {
"name": "OperationStatusType",
"modelAsString": false
},
"enum": [
"notstarted",
"running",
"succeeded",
"failed"
]
},
"createdTime": {
"type": "string",
"format": "date-time",
"description": "A combined UTC date and time string that describes the time when the operation (take or apply a snapshot) is requested. E.g. 2018-12-25T11:41:02.2331413Z."
},
"lastActionTime": {
"type": "string",
"format": "date-time",
"description": "A combined UTC date and time string that describes the last time the operation (take or apply a snapshot) is actively migrating data. The lastActionTime will keep increasing until the operation finishes. E.g. 2018-12-25T11:51:27.8705696Z."
},
"resourceLocation": {
"type": "string",
"description": "When the operation succeeds successfully, for snapshot taking operation the snapshot id will be included in this field, and for snapshot applying operation, the path to get the target object will be returned in this field."
},
"message": {
"type": "string",
"description": "Show failure message when operation fails (omitted when operation succeeds)."
}
}
},
"PersistedFaceResponse": {
"type": "object",
"properties": {
Expand All @@ -5075,31 +5101,46 @@
"succeeded",
"failed"
],
"type": "string"
"type": "string",
"description": "Operation status: notstarted, running, succeeded, failed. If the operation is requested and waiting to perform, the status is notstarted. If the operation is ongoing in backend, the status is running. Status succeeded means the operation is completed successfully, specifically for snapshot taking operation, it illustrates the snapshot is well taken and ready to apply, and for snapshot applying operation, it presents the target object has finished creating by the snapshot and ready to be used. Status failed is often caused by editing the source object while taking the snapshot or editing the target object while applying the snapshot before completion, see the field \"message\" to check the failure reason.",
"x-ms-enum": {
"name": "OperationStatusType",
"modelAsString": false
}
},
"AsyncStatus": {
"OperationStatus": {
"type": "object",
"required": [
"status",
"createdTime"
],
"description": "Operation status object. Operation refers to an asynchronous backend task.",
"properties": {
"status": {
"$ref": "#/definitions/AsyncOperationStatus"
},
"createdTime": {
"format": "date-time",
"type": "string"
"type": "string",
"description": "A combined UTC date and time string that describes the time when the operation is requested. E.g. 2018-12-25T11:41:02.2331413Z."
},
"lastActionTime": {
"format": "date-time",
"type": "string"
"type": "string",
"description": "A combined UTC date and time string that describes the last time the operation is actively running. The lastActionTime will keep increasing until the operation finishes. E.g. 2018-12-25T11:51:27.8705696Z."
},
"finishedTime": {
"format": "date-time",
"type": "string"
"type": "string",
"description": "A combined UTC date and time string that describes the time when the operation finished. E.g. 2018-12-25T11:41:02.2331413Z."
},
"resourceLocation": {
"type": "string"
"type": "string",
"description": "When the operation succeeds successfully, for snapshot taking operation the snapshot id will be included in this field, and for snapshot applying operation, the path to get the target object will be returned in this field."
},
"message": {
"type": "string"
"type": "string",
"description": "Show failure message when operation fails (omitted when operation succeeds)."
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
},
"responses": {
"202": {
"header": {
"Operation-Location": "/operations/a63a3bdd-a1db-4d05-87b8-dbad6850062a"
},
"body": {
"persistedFaceId": "6e04c175-219e-42a2-9d26-0e7b790e1ef4",
"recognitionModel": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
},
"responses": {
"202": {
"header": {
"Operation-Location": "/operations/a63a3bdd-a1db-4d05-87b8-dbad6850062a"
},
"body": {
"persistedFaceId": "6e04c175-219e-42a2-9d26-0e7b790e1ef4",
"recognitionModel": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
},
"responses": {
"200": {},
"202": {}
"202": {
"header": {
"Operation-Location": "/operations/a63a3bdd-a1db-4d05-87b8-dbad6850062a"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
},
"responses": {
"202": {
"header": {
"Operation-Location": "/operations/a63a3bdd-a1db-4d05-87b8-dbad6850062a"
},
"body": {
"personId": "4caa25ee-3bc6-4e88-adf8-12455ce7aab0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"dynamicPersonGroupId": "abc"
},
"responses": {
"202": {}
"202": {
"header": {
"Operation-Location": "/operations/a63a3bdd-a1db-4d05-87b8-dbad6850062a"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"personId": "25985303-c537-4467-b41d-bdb45cd95ca1"
},
"responses": {
"202": {}
"202": {
"header": {
"Operation-Location": "/operations/a63a3bdd-a1db-4d05-87b8-dbad6850062a"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"persistedFaceId": "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68"
},
"responses": {
"202": {}
"202": {
"header": {
"Operation-Location": "/operations/a63a3bdd-a1db-4d05-87b8-dbad6850062a"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
}
},
"responses": {
"202": {}
"202": {
"header": {
"Operation-Location": "/operations/a63a3bdd-a1db-4d05-87b8-dbad6850062a"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3922,6 +3922,26 @@
"minimum": 0,
"maximum": 1
},
"NonNullableNameAndNullableUserDataContract": {
"type": "object",
"description": "A combination of user defined name and user specified data for the person, largePersonGroup/personGroup, and largeFaceList/faceList.",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"description": "User defined name, maximum length is 128.",
"maxLength": 128,
"minLength": 1
},
"userData": {
"type": "string",
"description": "User specified data. Length should not exceed 16KB.",
"maxLength": 16384
}
}
},
"NameAndUserDataContract": {
"type": "object",
"description": "A combination of user defined name and user specified data for the person, largePersonGroup/personGroup, and largeFaceList/faceList.",
Expand All @@ -3948,7 +3968,7 @@
},
"allOf": [
{
"$ref": "#/definitions/NameAndUserDataContract"
"$ref": "#/definitions/NonNullableNameAndNullableUserDataContract"
}
]
},
Expand Down

0 comments on commit 1f26e64

Please sign in to comment.