Skip to content

Commit 46a7b5a

Browse files
authored
Update document of OAV error definitions (#17206)
* Update document of OAV error definitions * Added reference link in description
1 parent 87c0759 commit 46a7b5a

File tree

1 file changed

+51
-14
lines changed

1 file changed

+51
-14
lines changed

documentation/Semantic-and-Model-Violations-Reference.md

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ This document lists the set of automated rules that can be validated against swa
99
| [CIRCULAR_INHERITANCE](#CIRCULAR_INHERITANCE) | |
1010
| [DUPLICATE_PARAMETER](#DUPLICATE_PARAMETER) | |
1111
| [EMPTY_PATH_PARAMETER_DECLARATION](#EMPTY_PATH_PARAMETER_DECLARATION) | |
12+
| [EQUIVALENT_PATH](#EQUIVALENT_PATH) | |
13+
| [OBJECT_MISSING_REQUIRED_PROPERTY_DEFINITION](#OBJECT_MISSING_REQUIRED_PROPERTY_DEFINITION) | |
14+
| [OBJECT_MISSING_REQUIRED_PROPERTY_SCHEMA](#OBJECT_MISSING_REQUIRED_PROPERTY_SCHEMA) | |
1215
| [DUPLICATE_OPERATIONID](#DUPLICATE_OPERATIONID) | |
1316
| [MULTIPLE_BODY_PARAMETERS](#MULTIPLE_BODY_PARAMETERS) | |
1417
| [INVALID_PARAMETER_COMBINATION](#INVALID_PARAMETER_COMBINATION) | |
@@ -63,6 +66,7 @@ This document lists the set of automated rules that can be validated against swa
6366
| [READONLY_PROPERTY_NOT_ALLOWED_IN_REQUEST](#READONLY_PROPERTY_NOT_ALLOWED_IN_REQUEST) | |
6467
| [SCHEMA_VALIDATION_FAILED](#SCHEMA_VALIDATION_FAILED) | |
6568
| [SECRET_PROPERTY](#SECRET_PROPERTY) | |
69+
| [WRITEONLY_PROPERTY_NOT_ALLOWED_IN_RESPONSE](#WRITEONLY_PROPERTY_NOT_ALLOWED_IN_RESPONSE) | |
6670
| [DISCRIMINATOR_VALUE_NOT_FOUND](#DISCRIMINATOR_VALUE_NOT_FOUND) | |
6771
| [INVALID_XMS_DISCRIMINATOR_VALUE](#INVALID_XMS_DISCRIMINATOR_VALUE) | [OAV133](#INVALID_XMS_DISCRIMINATOR_VALUE) |
6872
| [DISCRIMINATOR_PROPERTY_NOT_FOUND](#DISCRIMINATOR_PROPERTY_NOT_FOUND) | [OAV134](#DISCRIMINATOR_PROPERTY_NOT_FOUND) |
@@ -83,7 +87,7 @@ This document lists the set of automated rules that can be validated against swa
8387
| [RESPONSE_SCHEMA_NOT_IN_SPEC](#RESPONSE_SCHEMA_NOT_IN_SPEC) | [OAV113](#RESPONSE_SCHEMA_NOT_IN_SPEC) |
8488
| [RESPONSE_STATUS_CODE_NOT_IN_SPEC](#RESPONSE_STATUS_CODE_NOT_IN_SPEC) | [OAV112](#RESPONSE_STATUS_CODE_NOT_IN_SPEC) |
8589
| [RESPONSE_VALIDATION_ERROR](#RESPONSE_VALIDATION_ERROR) | [OAV108](#RESPONSE_VALIDATION_ERROR) |
86-
| [X-MS-EXAMPLE_NOTFOUND_ERROR](#X-MS-EXAMPLE_NOTFOUND_ERROR) | [OAV107](#X-MS-EXAMPLE_NOTFOUND_ERROR) |
90+
| [XMS_EXAMPLE_NOTFOUND_ERROR](#XMS_EXAMPLE_NOTFOUND_ERROR) | [OAV107](#XMS_EXAMPLE_NOTFOUND_ERROR) |
8791
| [ERROR_IN_PREPARING_REQUEST](#ERROR_IN_PREPARING_REQUEST) | [OAV106](#ERROR_IN_PREPARING_REQUEST) |
8892
| [REQUIRED_PARAMETER_EXAMPLE_NOT_FOUND](#REQUIRED_PARAMETER_EXAMPLE_NOT_FOUND) | [OAV105](#REQUIRED_PARAMETER_EXAMPLE_NOT_FOUND) |
8993
| [JSON_PARSING_ERROR](#JSON_PARSING_ERROR) | [OAV104](#JSON_PARSING_ERROR) |
@@ -97,6 +101,7 @@ This document lists the set of automated rules that can be validated against swa
97101
| [LRO_RESPONSE_CODE](#LRO_RESPONSE_CODE) | |
98102
| [LRO_RESPONSE_HEADER](#LRO_RESPONSE_HEADER) | |
99103
| [MISSING_RESOURCE_ID](#MISSING_RESOURCE_ID) | |
104+
| [INVALID_RESPONSE_HEADER](#INVALID_RESPONSE_HEADER) | |
100105

101106

102107
### Validation Warnings
@@ -172,6 +177,22 @@ This document lists the set of automated rules that can be validated against swa
172177

173178
**How to fix the violation**: Remove one of the equivalent paths or rename it.
174179

180+
### <a name="OBJECT_MISSING_REQUIRED_PROPERTY_DEFINITION" />OBJECT_MISSING_REQUIRED_PROPERTY_DEFINITION
181+
182+
**Output Message**: Missing required property definition: {0}.
183+
184+
**Description**: Property indicated as required in "required" array for the model is missing its definition.
185+
186+
**How to fix the violation**: Verify that the properties included in the "required" array have all been defined in swagger.
187+
188+
### <a name="OBJECT_MISSING_REQUIRED_PROPERTY_SCHEMA" />OBJECT_MISSING_REQUIRED_PROPERTY_SCHEMA
189+
190+
**Output Message**: Missing required property: {0}.
191+
192+
**Description**: Property indicated as required according to [OpenAPI 2.0 specification](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md) for this schema.
193+
194+
**How to fix the violation**: Adding this property to schema in swagger.
195+
175196
### <a name="EMPTY_PATH_PARAMETER_DECLARATION" />EMPTY_PATH_PARAMETER_DECLARATION
176197

177198
**Output Message**: Path parameter declaration cannot be empty: {0}.
@@ -769,14 +790,6 @@ This document lists the set of automated rules that can be validated against swa
769790

770791
**How to fix the violation**: See inner details for the violations and fix.
771792

772-
### <a name="X-MS-EXAMPLE_NOTFOUND_ERROR" />X-MS-EXAMPLE_NOTFOUND_ERROR
773-
774-
**Output Message**: x-ms-example not found in {0}.
775-
776-
**Description**: Each operation should have example defined.
777-
778-
**How to fix the violation**: Add `x-ms-example` declaration for this operation.
779-
780793
### <a name="ERROR_IN_PREPARING_REQUEST" />ERROR_IN_PREPARING_REQUEST
781794

782795
**Description**: Error when preparing the request for validation.
@@ -818,7 +831,15 @@ This document lists the set of automated rules that can be validated against swa
818831

819832
**Description**: The secret is not allowed to return in response when it's annotated with x-ms-secret:true.
820833

821-
**How to fix the violation**: Remove this secret value from the response.
834+
**How to fix the violation**: Remove this secret value from the response in example or in traffic payload.
835+
836+
### <a name="WRITEONLY_PROPERTY_NOT_ALLOWED_IN_RESPONSE" />WRITEONLY_PROPERTY_NOT_ALLOWED_IN_RESPONSE
837+
838+
**Output Message**: Write-only property {0} is not allowed in the response.
839+
840+
**Description**: Write only property is not allowed to return in response when it's annotated with "x-ms-mutability": ["create", "update"].
841+
842+
**How to fix the violation**: Remove this property from the response in example or in traffic payload.
822843

823844

824845
### <a name="ROUNDTRIP_INCONSISTENT_PROPERTY" />ROUNDTRIP_INCONSISTENT_PROPERTY
@@ -861,22 +882,38 @@ This document lists the set of automated rules that can be validated against swa
861882

862883
**Output Message**: Respond to the initial request of a long running operation, Patch/Post call must return 201 or 202, Delete call must return 202 or 204, Put call must return 202 or 201 or 200, but {statusCode} being returned.
863884

864-
**Description**: Long running operation must return specific response code as per http method type when this operation is annotated with x-ms-long-running-operation:true. See [RPC - Asynchronous Operations](https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations) for more details.
885+
**Description**: Long running operation must return specific response code as per http method type in example or in traffic payload when this operation is annotated with x-ms-long-running-operation:true. See [RPC - Asynchronous Operations](https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations) for more details.
865886

866-
**How to fix the violation**: Correct the response code per the guidance or remove annotation of x-ms-long-running-operation.
887+
**How to fix the violation**: Correct the response code per the guidance or remove annotation of x-ms-long-running-operation in example or in traffic payload.
867888

868889
### <a name="LRO_RESPONSE_HEADER" />LRO_RESPONSE_HEADER
869890

870891
**Output Message**: Long running operation should return {header} in header but not being provided.
871892

872893
**Description**: Long running operation must return location header or azure-AsyncOperation header in response when this operation is annotated with x-ms-long-running-operation:true.
873894

874-
**How to fix the violation**: Adding one of these headers to the response.
895+
**How to fix the violation**: Adding one of these headers to the response in example or in traffic payload.
875896

876897
### <a name="MISSING_RESOURCE_ID" />MISSING_RESOURCE_ID
877898

878899
**Output Message**: id is required to return in response of GET/PUT resource calls but not being provided.
879900

880901
**Description**: `id` is a required field of azure resource to return in response body of each GET or PUT call when this resource is annotated as x-ms-azure-resource: true. This field is important to the platform because it is used as the identifier for references on other objects. e.g. "id": "/subscriptions/{id}/resourceGroups/{group}/providers/{rpns}/{type}/{name}".
881902

882-
**How to fix the violation**: Adding id to the response body.
903+
**How to fix the violation**: Adding id to the response body in example or in traffic payload.
904+
905+
### <a name="XMS_EXAMPLE_NOTFOUND_ERROR" />XMS_EXAMPLE_NOTFOUND_ERROR
906+
907+
**Output Message**: "x-ms-example" not found in {"operationId"} operation.
908+
909+
**Description**: Example is required to provide for each operation and it's annotated by "x-ms-example". Example is important because it is displayed in rest API document. See [x-ms-examples](https://github.com/Azure/azure-rest-api-specs/blob/main/documentation/x-ms-examples.md) for details.
910+
911+
**How to fix the violation**: Adding separated example JSON file and reference it with "x-ms-examples" annotation in swagger.
912+
913+
### <a name="INVALID_RESPONSE_HEADER" />INVALID_RESPONSE_HEADER
914+
915+
**Output Message**: Header {header} is required in response but not provided.
916+
917+
**Description**: {header} is declared in response schema in swagger but it's not provided in response in example or in traffic payload.
918+
919+
**How to fix the violation**: Adding this {header} to the response in example or in traffic payload.

0 commit comments

Comments
 (0)