File tree Expand file tree Collapse file tree 2 files changed +5
-18
lines changed
tools/spectral/ipa/rulesets Expand file tree Collapse file tree 2 files changed +5
-18
lines changed Original file line number Diff line number Diff line change @@ -26,16 +26,7 @@ rules:
2626 then :
2727 function : deleteMethod404Response
2828
29- xgen-IPA-108-delete-request-no-body :
30- description : DELETE method must not have request body
31- message : ' {{error}} http://go/ipa/108'
32- severity : warn
33- given : $.paths[*].delete
34- then :
35- function : deleteMethodNoRequestBody
36-
3729functions :
3830 - deleteMethodResponseShouldNotHaveSchema
3931 - deleteMethod204Response
40- - deleteMethodNoRequestBody
4132 - deleteMethod404Response
Original file line number Diff line number Diff line change @@ -12,18 +12,14 @@ const ERROR_MESSAGE = 'DELETE method should include 404 status code for not foun
1212 * @param {object } context - The context object containing the path
1313 */
1414export default ( input , _ , { path } ) => {
15- const deleteOp = input ;
16- if ( ! deleteOp ) return ;
17-
18- if ( hasException ( deleteOp , RULE_NAME ) ) {
19- collectException ( deleteOp , RULE_NAME , path ) ;
15+ const responses = input . responses ;
16+ if ( hasException ( input , RULE_NAME ) ) {
17+ collectException ( input , RULE_NAME , path ) ;
2018 return ;
2119 }
2220
23- const responses = deleteOp . responses || { } ;
24- if ( ! responses [ '404' ] ) {
21+ if ( ! responses || ! responses [ '404' ] ) {
2522 return collectAndReturnViolation ( path , RULE_NAME , ERROR_MESSAGE ) ;
2623 }
27-
28- collectAdoption ( path , RULE_NAME ) ;
24+ return collectAdoption ( path , RULE_NAME ) ;
2925} ;
You can’t perform that action at this time.
0 commit comments