@@ -38,6 +38,52 @@ const componentSchemas = {
3838        } , 
3939      } , 
4040    } , 
41+     SchemaCircularOne : { 
42+       type : 'object' , 
43+       properties : { 
44+         thing : { 
45+           $ref : '#/components/schemas/SchemaCircularTwo' , 
46+         } , 
47+       } , 
48+     } , 
49+     SchemaCircularTwo : { 
50+       type : 'object' , 
51+       properties : { 
52+         otherThing : { 
53+           $ref : '#/components/schemas/SchemaCircularOne' , 
54+         } , 
55+       } , 
56+     } , 
57+   } , 
58+ } ; 
59+ 
60+ const  animals  =  { 
61+   schemas : { 
62+     Animal : { 
63+       type : 'object' , 
64+       oneOf : [ 
65+         { 
66+           $ref : '#/components/schemas/Dog' , 
67+         } , 
68+         { 
69+           $ref : '#/components/schemas/Cat' , 
70+         } , 
71+       ] , 
72+     } , 
73+     Dog : { 
74+       allOf : [ 
75+         { 
76+           $ref : '#/components/schemas/Animal' , 
77+         } , 
78+       ] , 
79+     } , 
80+     Cat : { 
81+       allOf : [ 
82+         { 
83+           $ref : '#/components/schemas/Animal' , 
84+         } , 
85+       ] , 
86+     } , 
4187  } , 
4288} ; 
4389
@@ -272,6 +318,39 @@ testRule('xgen-IPA-106-create-method-request-body-is-get-method-response', [
272318            } , 
273319          } , 
274320        } , 
321+         '/resourceCircular' : { 
322+           post : { 
323+             requestBody : { 
324+               content : { 
325+                 'application/vnd.atlas.2023-01-01+json' : { 
326+                   schema : { 
327+                     $ref : '#/components/schemas/SchemaCircularOne' , 
328+                   } , 
329+                 } , 
330+                 'application/vnd.atlas.2024-01-01+json' : { 
331+                   schema : { 
332+                     $ref : '#/components/schemas/SchemaCircularOne' , 
333+                   } , 
334+                 } , 
335+               } , 
336+             } , 
337+           } , 
338+         } , 
339+         '/resourceCircular/{id}' : { 
340+           get : { 
341+             responses : { 
342+               200 : { 
343+                 content : { 
344+                   'application/vnd.atlas.2023-01-01+json' : { 
345+                     schema : { 
346+                       $ref : '#/components/schemas/SchemaCircularTwo' , 
347+                     } , 
348+                   } , 
349+                 } , 
350+               } , 
351+             } , 
352+           } , 
353+         } , 
275354      } , 
276355    } , 
277356    errors : [ 
@@ -296,6 +375,63 @@ testRule('xgen-IPA-106-create-method-request-body-is-get-method-response', [
296375        path : [ 'paths' ,  '/resourceThree' ,  'post' ,  'requestBody' ,  'content' ,  'application/vnd.atlas.2023-01-01+json' ] , 
297376        severity : DiagnosticSeverity . Warning , 
298377      } , 
378+       { 
379+         code : 'xgen-IPA-106-create-method-request-body-is-get-method-response' , 
380+         message :
381+           'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa/106' , 
382+         path : [ 'paths' ,  '/resourceCircular' ,  'post' ,  'requestBody' ,  'content' ,  'application/vnd.atlas.2023-01-01+json' ] , 
383+         severity : DiagnosticSeverity . Warning , 
384+       } , 
385+     ] , 
386+   } , 
387+   { 
388+     name : 'invalid oneOf case' , 
389+     document : { 
390+       components : animals , 
391+       paths : { 
392+         '/animalResource' : { 
393+           post : { 
394+             requestBody : { 
395+               content : { 
396+                 'application/vnd.atlas.2023-01-01+json' : { 
397+                   schema : { 
398+                     $ref : '#/components/schemas/Animal' , 
399+                   } , 
400+                 } , 
401+                 'application/vnd.atlas.2024-01-01+json' : { 
402+                   schema : { 
403+                     $ref : '#/components/schemas/Animal' , 
404+                   } , 
405+                 } , 
406+               } , 
407+             } , 
408+           } , 
409+         } , 
410+         '/animalResource/{id}' : { 
411+           get : { 
412+             responses : { 
413+               200 : { 
414+                 content : { 
415+                   'application/vnd.atlas.2023-01-01+json' : { 
416+                     schema : { 
417+                       $ref : '#/components/schemas/Dog' , 
418+                     } , 
419+                   } , 
420+                 } , 
421+               } , 
422+             } , 
423+           } , 
424+         } , 
425+       } , 
426+     } , 
427+     errors : [ 
428+       { 
429+         code : 'xgen-IPA-106-create-method-request-body-is-get-method-response' , 
430+         message :
431+           'The request body schema properties must match the response body schema properties of the Get method. http://go/ipa/106' , 
432+         path : [ 'paths' ,  '/animalResource' ,  'post' ,  'requestBody' ,  'content' ,  'application/vnd.atlas.2023-01-01+json' ] , 
433+         severity : DiagnosticSeverity . Warning , 
434+       } , 
299435    ] , 
300436  } , 
301437  { 
0 commit comments