@@ -11,25 +11,30 @@ functions:
1111
1212rules :
1313 xgen-IPA-106-create-method-request-body-is-request-suffixed-object :
14- description : >-
14+ description : |
1515 The Create method request should be a Request suffixed object.
1616
1717 ##### Implementation details
18-
19- Validation checks the POST method for resource collection paths.
18+ Rule checks for the following conditions:
19+ - Applies only to POST methods on resource collection paths (non-singleton resources)
20+ - Applies only to JSON content types
21+ - Verifies the schema references a predefined schema (not inline)
22+ - Confirms the referenced schema name ends with "Request" suffix
2023 message : ' {{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-106-create-method-request-body-is-request-suffixed-object'
2124 severity : warn
2225 given : ' $.paths[*].post.requestBody.content'
2326 then :
2427 field : ' @key'
2528 function : ' IPA106CreateMethodRequestBodyIsRequestSuffixedObject'
2629 xgen-IPA-106-create-method-should-not-have-query-parameters :
27- description : >-
30+ description : |
2831 Create operations should not use query parameters.
2932
3033 ##### Implementation details
31-
32- Validation checks the POST method for resource collection paths.
34+ Rule checks for the following conditions:
35+ - Applies only to POST methods on resource collection paths (non-singleton resources)
36+ - Verifies the operation does not contain query parameters
37+ - Ignores specified parameters like 'pretty' and 'envelope' via configuration
3338 message : ' {{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-106-create-method-should-not-have-query-parameters'
3439 severity : warn
3540 given : ' $.paths[*].post'
3843 functionOptions :
3944 ignoredValues : ['pretty', 'envelope']
4045 xgen-IPA-106-create-method-request-body-is-get-method-response :
41- description : >-
46+ description : |
4247 Request body content of the Create method and response content of the Get method should refer to the same resource.
4348
4449 ##### Implementation details
@@ -56,42 +61,46 @@ rules:
5661 field : ' @key'
5762 function : ' IPA106CreateMethodRequestBodyIsGetResponse'
5863 xgen-IPA-106-create-method-request-has-no-readonly-fields :
59- description : >-
64+ description : |
6065 Create method Request object must not include fields with readOnly:true.
6166
6267 ##### Implementation details
63-
64- Validation checks the POST method for resource collection paths.
68+ Rule checks for the following conditions:
69+ - Applies only to POST methods on resource collection paths (non-singleton resources)
70+ - Applies only to JSON content types
71+ - Searches through the request schema to find any properties marked with readOnly attribute
72+ - Fails if any readOnly properties are found in the request schema
6573 message : ' {{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-106-create-method-request-has-no-readonly-fields'
6674 severity : warn
6775 given : ' $.paths[*].post.requestBody.content'
6876 then :
6977 field : ' @key'
7078 function : ' IPA106CreateMethodRequestHasNoReadonlyFields'
7179 xgen-IPA-106-create-method-response-code-is-201 :
72- description : >-
80+ description : |
7381 Create methods must return a 201 Created response code.
7482
7583 ##### Implementation details
76-
77- Validation checks the POST method for resource collection paths.
84+ Rule checks for the following conditions:
85+ - Applies only to POST methods on resource collection paths (non-singleton resources)
86+ - Verifies the 201 Created response code is present
87+ - Fails if the method lacks a 201 Created response or defines a different 2xx status code
7888 message : ' {{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-106-create-method-response-code-is-201'
7989 severity : warn
8090 given : ' $.paths[*].post'
8191 then :
8292 function : ' IPA106CreateMethodResponseCodeIs201Created'
8393 xgen-IPA-106-create-method-response-is-get-method-response :
84- description : >-
94+ description : |
8595 The response body of the Create method should consist of the same resource object returned by the Get method.
8696
8797 ##### Implementation details
88-
89- Validation checks that the Create method 201 Created response contains reference to the same schema as the Get method response.
90-
91- - Validation applies to Create methods for resource collections only
92- - Validation applies to json response content only
93- - Validation ignores responses without schema
94- - Validation ignores resources without a Get method
98+ Rule checks for the following conditions:
99+ - Applies only to POST methods on resource collection paths
100+ - Applies only to JSON response content types
101+ - Verifies that both Create and Get methods have schema references
102+ - Confirms that the Create method 201 response schema reference matches the Get method response schema reference
103+ - Ignores resources without a Get method
95104 - Paths with `x-xgen-IPA-exception` for this rule are excluded from validation
96105 message : ' {{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-106-create-method-response-is-get-method-response'
97106 severity : warn
0 commit comments