diff --git a/tools/spectral/ipa/rulesets/IPA-106.yaml b/tools/spectral/ipa/rulesets/IPA-106.yaml index 40734d725d..d04cec321d 100644 --- a/tools/spectral/ipa/rulesets/IPA-106.yaml +++ b/tools/spectral/ipa/rulesets/IPA-106.yaml @@ -10,7 +10,9 @@ functions: rules: xgen-IPA-106-create-method-request-body-is-request-suffixed-object: - description: 'The Create method request should be a Request suffixed object. http://go/ipa/106' + description: >- + The Create method request should be a Request suffixed object. http://go/ipa/106 + This rule applies only to POST requests targeting resource collection URIs. message: '{{error}} http://go/ipa/106' severity: warn given: '$.paths[*].post.requestBody.content' @@ -18,16 +20,19 @@ rules: field: '@key' function: 'createMethodRequestBodyIsRequestSuffixedObject' xgen-IPA-106-create-method-should-not-have-query-parameters: - description: 'Create operations should not use query parameters. http://go/ipa/106' + description: >- + Create operations should not use query parameters. http://go/ipa/106 + This rule applies only to POST requests targeting resource collection URIs. message: '{{error}} http://go/ipa/106' severity: warn given: '$.paths[*].post' then: function: 'createMethodShouldNotHaveQueryParameters' xgen-IPA-106-create-method-request-body-is-get-method-response: - description: | - Request body content of the Create method and response content of the Get method should refer to the same resource. - readOnly/writeOnly properties will be ignored. http://go/ipa/106 + description: >- + Request body content of the Create method and response content of the Get method should refer to the same resource. http://go/ipa/106 + readOnly/writeOnly properties will be ignored. + This rule applies only to POST requests targeting resource collection URIs. message: '{{error}} http://go/ipa/106' severity: warn given: '$.paths[*].post.requestBody.content' @@ -37,7 +42,9 @@ rules: functionOptions: ignoredValues: ['readOnly', 'writeOnly'] xgen-IPA-106-create-method-request-has-no-readonly-fields: - description: 'Create method Request object must not include fields with readOnly:true. http://go/ipa/106' + description: >- + Create method Request object must not include fields with readOnly:true. http://go/ipa/106 + This rule applies only to POST requests targeting resource collection URIs. message: '{{error}} http://go/ipa/106' severity: warn given: '$.paths[*].post.requestBody.content' @@ -45,7 +52,9 @@ rules: field: '@key' function: 'createMethodRequestHasNoReadonlyFields' xgen-IPA-106-create-method-response-code-is-201: - description: 'Create methods must return a 201 Created response code. http://go/ipa/106' + description: >- + Create methods must return a 201 Created response code. http://go/ipa/106 + This rule applies only to POST requests targeting resource collection URIs. message: '{{error}} http://go/ipa/106' severity: warn given: '$.paths[*].post' diff --git a/tools/spectral/ipa/rulesets/README.md b/tools/spectral/ipa/rulesets/README.md index 386458bb6d..68dc2e78c1 100644 --- a/tools/spectral/ipa/rulesets/README.md +++ b/tools/spectral/ipa/rulesets/README.md @@ -53,15 +53,13 @@ For rule definitions, see [IPA-105.yaml](https://github.com/mongodb/openapi/blob For rule definitions, see [IPA-106.yaml](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/rulesets/IPA-106.yaml). -| Rule Name | Description | Severity | -| ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -| xgen-IPA-106-create-method-request-body-is-request-suffixed-object | The Create method request should be a Request suffixed object. http://go/ipa/106 | warn | -| xgen-IPA-106-create-method-should-not-have-query-parameters | Create operations should not use query parameters. http://go/ipa/106 | warn | -| xgen-IPA-106-create-method-request-body-is-get-method-response | Request body content of the Create method and response content of the Get method should refer to the same resource. -readOnly/writeOnly properties will be ignored. http://go/ipa/106 - | warn | -| xgen-IPA-106-create-method-request-has-no-readonly-fields | Create method Request object must not include fields with readOnly:true. http://go/ipa/106 | warn | -| xgen-IPA-106-create-method-response-code-is-201 | Create methods must return a 201 Created response code. http://go/ipa/106 | warn | +| Rule Name | Description | Severity | +| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | +| xgen-IPA-106-create-method-request-body-is-request-suffixed-object | The Create method request should be a Request suffixed object. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs. | warn | +| xgen-IPA-106-create-method-should-not-have-query-parameters | Create operations should not use query parameters. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs. | warn | +| xgen-IPA-106-create-method-request-body-is-get-method-response | Request body content of the Create method and response content of the Get method should refer to the same resource. http://go/ipa/106 readOnly/writeOnly properties will be ignored. This rule applies only to POST requests targeting resource collection URIs. | warn | +| xgen-IPA-106-create-method-request-has-no-readonly-fields | Create method Request object must not include fields with readOnly:true. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs. | warn | +| xgen-IPA-106-create-method-response-code-is-201 | Create methods must return a 201 Created response code. http://go/ipa/106 This rule applies only to POST requests targeting resource collection URIs. | warn | ### IPA-108