11import testRule from './__helpers__/testRule' ;
22import { DiagnosticSeverity } from '@stoplight/types' ;
33
4- testRule ( 'xgen-IPA-104-get-method-response-code-is-200-OK ' , [
4+ testRule ( 'xgen-IPA-104-get-method-response-code-is-200' , [
55 {
66 name : 'valid methods' ,
77 document : {
88 paths : {
99 '/resource' : {
1010 get : {
1111 responses : {
12- 200 : { } ,
1312 400 : { } ,
1413 500 : { } ,
1514 } ,
@@ -27,7 +26,6 @@ testRule('xgen-IPA-104-get-method-response-code-is-200-OK', [
2726 '/resource/{id}:customMethod' : {
2827 get : {
2928 responses : {
30- 200 : { } ,
3129 400 : { } ,
3230 500 : { } ,
3331 } ,
@@ -36,7 +34,6 @@ testRule('xgen-IPA-104-get-method-response-code-is-200-OK', [
3634 '/singleton' : {
3735 get : {
3836 responses : {
39- 200 : { } ,
4037 400 : { } ,
4138 500 : { } ,
4239 } ,
@@ -50,6 +47,7 @@ testRule('xgen-IPA-104-get-method-response-code-is-200-OK', [
5047 name : 'invalid methods' ,
5148 document : {
5249 paths : {
50+ '/resource1' : { get : { responses : { } } } ,
5351 '/resource1/{id}' : {
5452 get : {
5553 responses : {
@@ -59,6 +57,7 @@ testRule('xgen-IPA-104-get-method-response-code-is-200-OK', [
5957 } ,
6058 } ,
6159 } ,
60+ '/resource2' : { get : { responses : { } } } ,
6261 '/resource2/{id}' : {
6362 get : {
6463 responses : {
@@ -67,6 +66,7 @@ testRule('xgen-IPA-104-get-method-response-code-is-200-OK', [
6766 } ,
6867 } ,
6968 } ,
69+ '/resource3' : { get : { responses : { } } } ,
7070 '/resource3/{id}' : {
7171 get : {
7272 responses : {
@@ -81,21 +81,21 @@ testRule('xgen-IPA-104-get-method-response-code-is-200-OK', [
8181 } ,
8282 errors : [
8383 {
84- code : 'xgen-IPA-104-get-method-response-code-is-200-OK ' ,
84+ code : 'xgen-IPA-104-get-method-response-code-is-200' ,
8585 message :
8686 'The Get method must return a 200 OK response. This method either lacks a 200 OK response or defines a different 2xx status code. http://go/ipa/104' ,
8787 path : [ 'paths' , '/resource1/{id}' , 'get' ] ,
8888 severity : DiagnosticSeverity . Warning ,
8989 } ,
9090 {
91- code : 'xgen-IPA-104-get-method-response-code-is-200-OK ' ,
91+ code : 'xgen-IPA-104-get-method-response-code-is-200' ,
9292 message :
9393 'The Get method must return a 200 OK response. This method either lacks a 200 OK response or defines a different 2xx status code. http://go/ipa/104' ,
9494 path : [ 'paths' , '/resource2/{id}' , 'get' ] ,
9595 severity : DiagnosticSeverity . Warning ,
9696 } ,
9797 {
98- code : 'xgen-IPA-104-get-method-response-code-is-200-OK ' ,
98+ code : 'xgen-IPA-104-get-method-response-code-is-200' ,
9999 message :
100100 'The Get method must return a 200 OK response. This method either lacks a 200 OK response or defines a different 2xx status code. http://go/ipa/104' ,
101101 path : [ 'paths' , '/resource3/{id}' , 'get' ] ,
@@ -107,6 +107,7 @@ testRule('xgen-IPA-104-get-method-response-code-is-200-OK', [
107107 name : 'invalid method with exception' ,
108108 document : {
109109 paths : {
110+ '/resource1' : { get : { responses : { } } } ,
110111 '/resource1/{id}' : {
111112 get : {
112113 responses : {
@@ -115,18 +116,19 @@ testRule('xgen-IPA-104-get-method-response-code-is-200-OK', [
115116 500 : { } ,
116117 } ,
117118 'x-xgen-IPA-exception' : {
118- 'xgen-IPA-104-get-method-response-code-is-200-OK ' : 'reason' ,
119+ 'xgen-IPA-104-get-method-response-code-is-200' : 'reason' ,
119120 } ,
120121 } ,
121122 } ,
123+ '/resource2' : { get : { responses : { } } } ,
122124 '/resource2/{id}' : {
123125 get : {
124126 responses : {
125127 400 : { } ,
126128 500 : { } ,
127129 } ,
128130 'x-xgen-IPA-exception' : {
129- 'xgen-IPA-104-get-method-response-code-is-200-OK ' : 'reason' ,
131+ 'xgen-IPA-104-get-method-response-code-is-200' : 'reason' ,
130132 } ,
131133 } ,
132134 } ,
0 commit comments