Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ public Schema resolveSchema(Schema schema) {
combinedModel.setExample(examples);
}

if(schema.getXml()!= null){
combinedModel.setXml(schema.getXml());
}

result = combinedModel;

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ public class OpenAPIV3ParserTest {
protected int serverPort = getDynamicPort();
protected WireMockServer wireMockServer;

@Test
public void testAnonymousModelAllOf() {
ParseOptions options = new ParseOptions();
options.setResolveFully(true);
SwaggerParseResult result = new OpenAPIV3Parser().readLocation("issue203/issue203AllOf.yaml", null, options);
OpenAPI openAPI = result.getOpenAPI();
assertEquals(openAPI.getComponents().getSchemas().get("Supplier").getXml().getName(),"supplierObject");
}

@Test
public void testIssue1518() {
ParseOptions options = new ParseOptions();
Expand All @@ -103,8 +112,6 @@ public void testIssue1518StackOverFlow() {
}catch (StackOverflowError stackOverflowError){
assertTrue(false);
}


}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
openapi: 3.0.0
info:
title: test
version: 1.0.0
paths:
/inventory:
get:
responses:
'200':
description: OK
content:
application/xml:
schema:
$ref: '#/components/schemas/InventoryItem'
components:
schemas:
InventoryItem:
type: object
properties:
suppliersArray:
type: array
items:
$ref: '#/components/schemas/Supplier'
xml:
name: inventoryItem
Manufacturer:
type: object
properties:
name:
type: string
example: ACME Corporation
xml:
name: manufacturer
Supplier:
allOf:
- $ref: '#/components/schemas/Manufacturer'
- type: object
properties:
supplierRef:
type: string
example: REF123
xml:
name: supplierObject