use of io.swagger.models.properties.IntegerProperty in project swagger-core by swagger-api.
the class SimpleReaderTest method scanResourceWithParamRange.
@Test(description = "scan a resource with param range")
public void scanResourceWithParamRange() {
Swagger swagger = getSwagger(ResourceWithRanges.class);
List<Parameter> params = getGetParameters(swagger, "/{id}");
PathParameter param0 = (PathParameter) params.get(0);
assertEquals(param0.getName(), "id");
assertEquals(param0.getDefaultValue(), 5);
assertEquals(param0.getMinimum(), new BigDecimal(0.0));
assertEquals(param0.getMaximum(), new BigDecimal(10.0));
PathParameter param1 = (PathParameter) params.get(1);
assertEquals(param1.getName(), "minValue");
assertEquals(param1.getMinimum(), new BigDecimal(0.0));
assertNull(param1.getMaximum(), null);
PathParameter param2 = (PathParameter) params.get(2);
assertEquals(param2.getName(), "maxValue");
assertNull(param2.getMinimum());
assertEquals(param2.getMaximum(), new BigDecimal(100.0));
PathParameter param3 = (PathParameter) params.get(3);
assertEquals(param3.getName(), "values");
IntegerProperty items = (IntegerProperty) param3.getItems();
assertEquals(items.getMinimum(), new BigDecimal(0.0));
assertEquals(items.getMaximum(), new BigDecimal(5.0));
assertEquals(items.getExclusiveMinimum(), Boolean.TRUE);
assertEquals(items.getExclusiveMaximum(), Boolean.TRUE);
}
use of io.swagger.models.properties.IntegerProperty 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.IntegerProperty in project swagger-core by swagger-api.
the class IntegerPropertyTest method testEquals.
@Test
public void testEquals() {
final IntegerProperty prop1 = new IntegerProperty();
prop1.setName(PROP_1);
prop1.setRequired(true);
final IntegerProperty prop2 = new IntegerProperty();
prop2.setName(PROP_2);
assertNotEquals(prop1, prop2);
prop2.setName(PROP_1);
prop2.setRequired(true);
assertEquals(prop1, prop2);
}
Aggregations