use of io.swagger.models.properties.ArrayProperty in project swagger-core by swagger-api.
the class SimpleReaderTest method scanResourceWithInnerClass.
@Test(description = "scan a resource with inner class")
public void scanResourceWithInnerClass() {
Swagger swagger = getSwagger(ResourceWithInnerClass.class);
assertEquals(((RefProperty) ((ArrayProperty) getGetResponses(swagger, "/description").get("200").getSchema()).getItems()).get$ref(), "#/definitions/Description");
assertTrue(swagger.getDefinitions().containsKey("Description"));
}
use of io.swagger.models.properties.ArrayProperty in project swagger-core by swagger-api.
the class AbstractSerializableParameter method setProperty.
public void setProperty(Property property) {
setType(property.getType());
this.format = property.getFormat();
if (property instanceof StringProperty) {
final StringProperty string = (StringProperty) property;
setEnum(string.getEnum());
} else if (property instanceof IntegerProperty) {
setEnumValue(((IntegerProperty) property).getEnum());
} else if (property instanceof LongProperty) {
setEnumValue(((LongProperty) property).getEnum());
} else if (property instanceof FloatProperty) {
setEnumValue(((FloatProperty) property).getEnum());
} else if (property instanceof DoubleProperty) {
setEnumValue(((DoubleProperty) property).getEnum());
} else if (property instanceof ArrayProperty) {
final ArrayProperty array = (ArrayProperty) property;
setItems(array.getItems());
}
}
use of io.swagger.models.properties.ArrayProperty in project swagger-core by swagger-api.
the class ArrayPropertyTest method testEquals.
@Test
public void testEquals() {
final ArrayProperty prop1 = new ArrayProperty();
prop1.setName(PROP_1);
prop1.setRequired(true);
final ArrayProperty prop2 = new ArrayProperty();
prop2.setName(PROP_2);
assertNotEquals(prop1, prop2);
prop2.setName(PROP_1);
prop2.setRequired(true);
assertEquals(prop1, prop2);
}
use of io.swagger.models.properties.ArrayProperty in project swagger-core by swagger-api.
the class ArrayModelTest method testItems.
@Test
public void testItems() {
// given
Property items = new ArrayProperty();
// when
instance.items(items);
// then
assertEquals(items, instance.getItems(), "The got items must be the same as the set one");
}
use of io.swagger.models.properties.ArrayProperty in project swagger-core by swagger-api.
the class ModelImplTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
instance = new ModelImpl();
propertiesAndValues = new Object[] { "additionalProperties", new ArrayProperty(), "description", "description", "discriminator", "discriminator", "example", new Object(), "format", "format", "isSimple", true, "name", "name", "properties", new HashMap<String, Property>(), "required", new ArrayList<String>(), "type", "type", "xml", new Xml(), "defaultValue", "defaultValue" };
}
Aggregations