Skip to content

Commit

Permalink
Merge pull request #1416 from dylanowen/master
Browse files Browse the repository at this point in the history
Add vendor extensions to ArrayProperty. [241]
  • Loading branch information
webron committed Sep 7, 2015
2 parents 0d59e55 + 6c0acd3 commit 0567e01
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ Property propertyFromNode(JsonNode node) {
detailNode = node.get("items");
if (detailNode != null) {
Property subProperty = propertyFromNode(detailNode);
return new ArrayProperty().items(subProperty).description(description);
ArrayProperty arrayProperty = new ArrayProperty().items(subProperty).description(description);
arrayProperty.setVendorExtensionMap(getVendorExtensions(node));
return arrayProperty;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import io.swagger.models.*;
import org.testng.annotations.Test;

import java.io.File;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -122,5 +121,12 @@ public void testDeserializePropertyWithVendorExtensions() throws Exception {
assertTrue(xBooleanValue);

assertFalse(vendorExtensions.containsKey("not-an-extension"));

//check for vendor extensions in array property types
vendorExtensions = swagger.getDefinitions().get("Health").getProperties().get("array").getVendorExtensions();

xStringValue = (String) vendorExtensions.get("x-string-value");
assertNotNull(xStringValue);
assertEquals(xStringValue, "string_value");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,15 @@
"x-number-value": 123,
"x-boolean-value": true,
"not-an-extension": "foobar"
},
"array": {
"type": "array",
"items": {
"$ref": "#/definitions/Health"
},
"x-string-value": "string_value"
}
}
}
}
}
}

0 comments on commit 0567e01

Please sign in to comment.