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 @@ -5,6 +5,7 @@
import io.swagger.models.*;
import io.swagger.models.auth.*;
import io.swagger.models.parameters.*;
import io.swagger.models.properties.ArrayProperty;
import io.swagger.models.properties.Property;
import io.swagger.models.properties.PropertyBuilder;
import io.swagger.models.properties.RefProperty;
Expand Down Expand Up @@ -911,6 +912,9 @@ public Model definition(ObjectNode node, String location, ParseResult result) {
if(propertyNode.getNodeType().equals(JsonNodeType.OBJECT)) {
ObjectNode on = (ObjectNode) propertyNode;
Property property = property(on, location, result);
if("array".equals( property.getType()) && !(property instanceof ArrayProperty && ((ArrayProperty) property).getItems() != null)) {
result.missing(location, "items");
}
impl.property(propertyName, property);
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ public void testIssueRelativeRefs2(){
assertEquals(refProperty.get$ref(),"#/definitions/simpleIDType_v01");
}

@Test
public void testIssue111() {
SwaggerDeserializationResult result = new SwaggerParser().readWithInfo("issue-111.yaml", null, true);
assertTrue(result.getMessages().get(0).equals("attribute definitions.Filter.items is missing"));
assertNotNull(result.getSwagger());
}

@Test
public void testIssueDefinitionWithDots_2() {
Swagger swagger = new SwaggerParser().read("SimpleAPI.yaml");
Expand Down
34 changes: 34 additions & 0 deletions modules/swagger-parser/src/test/resources/issue-111.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
swagger: '2.0'
info:
version: '0.0.2'
title: 'Test'
description:
This is the test API documentation
produces:
- application/json
paths:

'/test':
get:
summary: test
description: Test Endpoint
produces:
- application/json
operationId: getTest
parameters:
- name: query
in: query
description: Query That Tests
required: true
type: string
responses:
200:
description: TestResult
schema:
$ref: '#/definitions/Filter'
definitions:
Filter:
description: Contains the the information for filter presentation
properties:
hints:
type: array