use of io.swagger.models.apideclaration.ModelProperty in project swagger-parser by swagger-api.
the class ModelPropertyConverterTest method convertStringArrayModelProperty.
@Test
public void convertStringArrayModelProperty() throws Exception {
ModelProperty property = new ModelProperty();
property.setType("array");
Items items = new Items();
items.setType("string");
property.setItems(items);
Property converted = converter.convertProperty(property);
assertEquals(converted.getClass(), ArrayProperty.class);
ArrayProperty prop = (ArrayProperty) converted;
Property innerType = prop.getItems();
assertEquals(innerType.getType(), "string");
}
use of io.swagger.models.apideclaration.ModelProperty in project swagger-parser by swagger-api.
the class ModelPropertyConverterTest method convertDateTimeModelProperty.
@Test
public void convertDateTimeModelProperty() throws Exception {
ModelProperty property = new ModelProperty();
property.setType("string");
property.setFormat(Format.DATE_TIME);
property.setDescription("a simple date-time");
Property converted = converter.convertProperty(property);
assertEquals(converted.getClass(), DateTimeProperty.class);
assertEquals(converted.getDescription(), property.getDescription());
assertEquals(converted.getType(), "string");
assertEquals(converted.getFormat(), "date-time");
}
use of io.swagger.models.apideclaration.ModelProperty in project swagger-parser by swagger-api.
the class ModelPropertyConverterTest method convertIntegerModelProperty.
@Test
public void convertIntegerModelProperty() throws Exception {
ModelProperty property = new ModelProperty();
property.setType("integer");
property.setFormat(Format.INT32);
property.setDescription("a simple int32 property");
property.setMinimum("1");
property.setMaximum("4");
Property converted = converter.convertProperty(property);
assertEquals(converted.getClass(), IntegerProperty.class);
assertEquals(converted.getType(), "integer");
assertEquals(converted.getFormat(), "int32");
IntegerProperty prop = (IntegerProperty) converted;
assertEquals(prop.getMinimum(), new BigDecimal("1"));
assertEquals(prop.getMaximum(), new BigDecimal("4"));
}
use of io.swagger.models.apideclaration.ModelProperty in project swagger-parser by swagger-api.
the class ModelPropertyConverterTest method convertRefModelProperty.
@Test
public void convertRefModelProperty() throws Exception {
ModelProperty property = new ModelProperty();
property.setRef("Pet");
Property converted = converter.convertProperty(property);
assertEquals(converted.getClass(), RefProperty.class);
RefProperty ref = (RefProperty) converted;
assertEquals(ref.getSimpleRef(), "Pet");
}
use of io.swagger.models.apideclaration.ModelProperty in project swagger-parser by swagger-api.
the class ModelPropertyConverterTest method convertStringModelProperty.
@Test
public void convertStringModelProperty() throws Exception {
ModelProperty property = new ModelProperty();
property.setType("string");
property.setDescription("a simple string");
Property converted = converter.convertProperty(property);
assertEquals(converted.getClass(), StringProperty.class);
assertEquals(converted.getType(), "string");
assertEquals(converted.getDescription(), property.getDescription());
}
Aggregations