Skip to content

Commit 6eb8950

Browse files
refactor fixes
1 parent f67ad50 commit 6eb8950

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

tools/spectral/ipa/__tests__/createResponseCodeShouldBe201Created.test.js renamed to tools/spectral/ipa/__tests__/createMethodResponseCodeIs201Created.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,4 @@ testRule('xgen-IPA-106-create-method-response-code-is-201', [
114114
},
115115
errors: [],
116116
},
117-
]);
117+
]);

tools/spectral/ipa/rulesets/IPA-106.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ functions:
55
- createMethodRequestBodyIsRequestSuffixedObject
66
- createMethodShouldNotHaveQueryParameters
77
- createMethodRequestBodyIsGetResponse
8+
- createMethodResponseCodeIs201Created
89

910
rules:
1011
xgen-IPA-106-create-method-request-body-is-request-suffixed-object:

tools/spectral/ipa/rulesets/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ For rule definitions, see [IPA-106.yaml](https://github.com/mongodb/openapi/blob
6060
| 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.
6161
readOnly/writeOnly properties will be ignored. http://go/ipa/106
6262
| warn |
63+
| xgen-IPA-106-create-method-response-code-is-201 | Create methods must return a 201 Created response code. http://go/ipa/106 | warn |
6364

6465
### IPA-108
6566

tools/spectral/ipa/rulesets/functions/createResponseCodeShouldBe201Created.js renamed to tools/spectral/ipa/rulesets/functions/createMethodResponseCodeIs201Created.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const RULE_NAME = 'xgen-IPA-106-create-method-response-code-is-201';
1111
const ERROR_MESSAGE =
1212
'The Create method must return a 201 Created response. This method either lacks a 201 Created response or defines a different 2xx status code.';
1313

14-
export default (input, _, { path}) => {
14+
export default (input, _, { path }) => {
1515
const resourcePath = path[1];
1616

1717
// Skip custom methods
@@ -49,4 +49,4 @@ function checkViolationsAndReturnErrors(input, path) {
4949
} catch (e) {
5050
handleInternalError(RULE_NAME, path, e);
5151
}
52-
}
52+
}

0 commit comments

Comments
 (0)