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 @@ -182,7 +182,7 @@ public String processRefToExternalSchema(String $ref, RefFormat refFormat) {
return newRef;
}

private void processProperty(Schema property, String file) {
private void processSchema(Schema property, String file) {
if (property != null) {
if (StringUtils.isNotBlank(property.get$ref())) {
processRefSchema(property, file);
Expand All @@ -191,10 +191,10 @@ private void processProperty(Schema property, String file) {
processProperties(property.getProperties(), file);
}
if (property instanceof ArraySchema) {
processProperty(((ArraySchema) property).getItems(), file);
processSchema(((ArraySchema) property).getItems(), file);
}
if (property.getAdditionalProperties() instanceof Schema) {
processProperty(((Schema) property.getAdditionalProperties()), file);
processSchema(((Schema) property.getAdditionalProperties()), file);
}
if (property instanceof ComposedSchema) {
ComposedSchema composed = (ComposedSchema) property;
Expand All @@ -208,7 +208,7 @@ private void processProperty(Schema property, String file) {
private void processProperties(Collection<Schema> properties, String file) {
if (properties != null) {
for (Schema property : properties) {
processProperty(property, file);
processSchema(property, file);
}
}
}
Expand Down Expand Up @@ -269,6 +269,8 @@ public String processRefToExternalResponse(String $ref, RefFormat refFormat) {
} else {
processRefToExternalSchema(file + schema.get$ref(), RefFormat.RELATIVE);
}
}else{
processSchema(schema,file);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,6 @@ public void testInlineModelResolver(@Injectable final List<AuthorizationValue> a
@Test
public void test30NoOptions(@Injectable final List<AuthorizationValue> auths) throws Exception{



String pathFile = FileUtils.readFileToString(new File("src/test/resources/oas3.yaml.template"));
pathFile = pathFile.replace("${dynamicPort}", String.valueOf(this.serverPort));

Expand Down Expand Up @@ -610,6 +608,13 @@ public void testInlineModelResolverByUrl(){
assertNotNull(userAddress.getProperties().get("street"));
}

@Test
public void testIssue1105() throws Exception {
OpenAPI openAPI = new OpenAPIV3Parser().read("issue-1105/swagger-api.yaml");
Assert.assertNotNull(openAPI);
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("ErrorCodeDescription"));
}

@Test
public void testRefAdditionalProperties() throws Exception {
OpenAPI openAPI = new OpenAPIV3Parser().read("src/test/resources/relative/additionalProperties.yaml");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
openapi: 3.0.2
info:
title: API Components
description: Common components
version: '1.0'
components:
schemas:
ErrorCodeDescription:
type: object
properties:
code:
format: int32
type: integer
description: HTTP error code.
description:
type: string
description: Brief description of the error.
details:
type: string
description: Details about the error.
responses:
401:
description: User is not authorized for this action
content:
application/json:
schema:
uniqueItems: false
type: array
items:
$ref: "#/components/schemas/ErrorCodeDescription"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
openapi: "3.0.2"
info:
title: User and Session
description: Admin API endpoints.
version: "0.1"
paths:
/users:
get:
responses:
"401":
$ref: "./domain.yaml#/components/responses/401"
components: {
schemas: {}
}