Skip to content
Prev Previous commit
Next Next commit
Add test case : arbitraryObjectResponseWithAdditionalProperty
  • Loading branch information
ackintosh committed Dec 31, 2018
commit 76cc87fc24a1f95eaba17225671491930cedd7b5
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,27 @@ public void arbitraryObjectResponseArrayInline() {
assertNull(arbitaryObject.getProperties());
}

@Test
public void arbitraryObjectResponseWithAdditionalProperty() {
OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/3_0/inline_model_resolver.yaml", null, new ParseOptions()).getOpenAPI();
new InlineModelResolver().flatten(openAPI);

MediaType mediaType = openAPI
.getPaths()
.get("/arbitrary_object_response_with_additional_property")
.getGet()
.getResponses()
.get("200")
.getContent()
.get("application/json");

assertTrue(mediaType.getSchema() instanceof ObjectSchema);
assertTrue(mediaType.getSchema().getAdditionalProperties() instanceof ObjectSchema);

ObjectSchema additionalProperty = (ObjectSchema) mediaType.getSchema().getAdditionalProperties();
assertNull(additionalProperty.getProperties());
}

/*
@Test
public void testArbitraryObjectResponseMapInline() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,18 @@ paths:
properties:
arbitrary_object_response_array_inline:
type: object
/arbitrary_object_response_with_additional_property:
get:
operationId: arbitraryObjectResponseWithAdditionalProperty
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
additionalProperties:
type: object
components:
schemas:
Users:
Expand Down