Skip to content

Commit c9557d9

Browse files
committed
solution for issue #913 in OAS3
1 parent 611531f commit c9557d9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/processors/ExternalRefProcessor.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import io.swagger.v3.oas.models.media.ArraySchema;
1111
import io.swagger.v3.oas.models.media.ComposedSchema;
1212
import io.swagger.v3.oas.models.media.MediaType;
13+
import io.swagger.v3.oas.models.media.ObjectSchema;
1314
import io.swagger.v3.oas.models.media.Schema;
1415
import io.swagger.v3.oas.models.parameters.Parameter;
1516
import io.swagger.v3.oas.models.parameters.RequestBody;
@@ -199,6 +200,11 @@ private void processProperties(Map<String,Schema> subProps, String file) {
199200
&& StringUtils.isNotBlank(((ArraySchema) mapProp.getAdditionalProperties()).getItems().get$ref())) {
200201
processRefSchema(((ArraySchema) mapProp.getAdditionalProperties()).getItems(), file);
201202
}
203+
}else if (prop.getValue() instanceof ObjectSchema){
204+
ObjectSchema objProp = (ObjectSchema) prop.getValue();
205+
if(objProp.getProperties() != null ){
206+
processProperties(objProp.getProperties(),file);
207+
}
202208
}
203209
}
204210
}

modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/OpenAPIV3ParserTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ public void testIssue913() {
6363
ParseOptions options = new ParseOptions();
6464
options.setResolve(true);
6565
final OpenAPI openAPI = parser.readLocation("issue-913/BS/ApiSpecification.yaml", null, options).getOpenAPI();
66-
Yaml.prettyPrint(openAPI);
6766
Assert.assertNotNull(openAPI);
68-
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("indicatorType"));
67+
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("indicatorType"));
6968
Assert.assertEquals(openAPI.getComponents().getSchemas().get("indicatorType").getProperties().size(),1);
7069
}
7170

0 commit comments

Comments
 (0)