@@ -229,4 +229,29 @@ public void testHandleComposedSchemasInArrayItems() {
229
229
assertTrue (components .containsKey ("OrderRowType" ));
230
230
}
231
231
232
+ @ Test
233
+ public void testHandleInlineRefsInComposedSchemas () {
234
+ OpenAPIV3Parser openApiParser = new OpenAPIV3Parser ();
235
+ ParseOptions options = new ParseOptions ();
236
+ options .setResolve (true );
237
+ SwaggerParseResult parseResult = openApiParser .readLocation ("issue-2104/openapi.yaml" , null , options );
238
+ OpenAPI openAPI = parseResult .getOpenAPI ();
239
+
240
+ Map <String , Schema > components = openAPI .getComponents ().getSchemas ();
241
+ assertEquals (components .size (), 4 );
242
+ assertTrue (components .containsKey ("ResponseAllOf" ));
243
+ assertTrue (components .containsKey ("ResponseOneOf" ));
244
+ assertTrue (components .containsKey ("ResponseAnyOf" ));
245
+ assertTrue (components .containsKey ("Product" ));
246
+
247
+ Schema allOfInlineProduct = (Schema )((Schema )components .get ("ResponseAllOf" ).getAllOf ().get (1 )).getProperties ().get ("product" );
248
+ assertThat (allOfInlineProduct .get$ref (), is ("#/components/schemas/Product" ));
249
+
250
+ Schema oneOfInlineProduct = (Schema )((Schema )components .get ("ResponseOneOf" ).getOneOf ().get (1 )).getProperties ().get ("product" );
251
+ assertThat (oneOfInlineProduct .get$ref (), is ("#/components/schemas/Product" ));
252
+
253
+ Schema anyOfInlineProduct = (Schema )((Schema )components .get ("ResponseAnyOf" ).getAnyOf ().get (1 )).getProperties ().get ("product" );
254
+ assertThat (anyOfInlineProduct .get$ref (), is ("#/components/schemas/Product" ));
255
+ }
256
+
232
257
}
0 commit comments