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 @@ -149,8 +149,8 @@ public String processRefToExternalSchema(String $ref, RefFormat refFormat) {
for(Schema item : composedSchema.getAllOf()){
if (item.get$ref() != null){
processRefSchema(item,file);
} else if (item.getProperties() != null) {
processProperties(item.getProperties(), file);
} else{
processSchema(item, file);
}
}

Expand All @@ -159,6 +159,8 @@ public String processRefToExternalSchema(String $ref, RefFormat refFormat) {
if (item.get$ref() != null){
if (item.get$ref() != null){
processRefSchema(item,file);
}else{
processSchema(item, file);
}
}
}
Expand All @@ -167,10 +169,11 @@ public String processRefToExternalSchema(String $ref, RefFormat refFormat) {
if (item.get$ref() != null){
if (item.get$ref() != null){
processRefSchema(item,file);
}else{
processSchema(item, file);
}
}
}

}
}
//Loop the properties and recursively call this method;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ public class OpenAPIV3ParserTest {
protected int serverPort = getDynamicPort();
protected WireMockServer wireMockServer;


@Test
public void testIssueDereferencingComposedSchemaOneOf() {
OpenAPIV3Parser openApiParser = new OpenAPIV3Parser();
ParseOptions options = new ParseOptions();
options.setResolve(true);
SwaggerParseResult parseResult = openApiParser.readLocation("resolverIssue/Beta-1-swagger.yaml", null, options);
OpenAPI openAPI = parseResult.getOpenAPI();
assertNotNull(openAPI.getComponents().getSchemas().get("naNumber"));
assertNotNull(openAPI.getComponents().getSchemas().get("unNumber"));
}

@Test
public void testIssue1621() {
final ParseOptions parseOptions = new ParseOptions();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
openapi: 3.0.3
paths:
/v2/bookings:
post:
tags:
- Booking Request
summary: Post a booking request
description: |
Creates a new booking request
requestBody:
description: Parameters used to create a booking request
required: true
content:
application/json:
schema:
allOf:
- $ref: 'DOCUMENTATION_DOMAIN-3.0.0-domain.yaml#/components/schemas/dangerousGood'
components:
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
openapi: 3.0.3
paths:
components:
schemas:
dangerousGood:
type: object
description: 'Specification for Dangerous Goods'
allOf:
- type: object
oneOf:
- type: object
properties:
unNumber:
"$ref": "#/components/schemas/unNumber"
- type: object
properties:
naNumber:
"$ref": "#/components/schemas/naNumber"
naNumber:
type: string
pattern: "\\d{4}"
description: 'Four-digit number that is assigned to dangerous, hazardous, and
harmful substances. Used for `US`/ `CFR` regularted shipments this is used
instead of `unNumber`'
unNumber:
type: string
pattern: "\\d{4}"
description: 'Four-digit number that is assigned to dangerous, hazardous, and
harmful substances by United Nations'