use of io.swagger.models.properties.StringProperty in project swagger-core by swagger-api.
the class PropertySerializationTest method deserializeNotReadOnlyStringProperty.
@Test(description = "it should serialize a string property with readOnly unset")
public void deserializeNotReadOnlyStringProperty() throws IOException {
final StringProperty p = new StringProperty();
p.setReadOnly(false);
final String json = "{\"type\":\"string\"}";
assertEquals(m.writeValueAsString(p), json);
}
use of io.swagger.models.properties.StringProperty in project swagger-core by swagger-api.
the class DefaultParameterExtension method enforcePrimitive.
private Property enforcePrimitive(Property in, int level) {
if (in instanceof RefProperty) {
return new StringProperty();
}
if (in instanceof ArrayProperty) {
if (level == 0) {
final ArrayProperty array = (ArrayProperty) in;
array.setItems(enforcePrimitive(array.getItems(), level + 1));
} else {
return new StringProperty();
}
}
return in;
}
use of io.swagger.models.properties.StringProperty in project swagger-core by swagger-api.
the class GenericsTest method testEnumCollection.
private void testEnumCollection(QueryParameter p, String name) {
testCollection(p, name, "string", null);
StringProperty schema = (StringProperty) p.getItems();
assertEquals(schema.getEnum(), enumValues);
}
use of io.swagger.models.properties.StringProperty in project swagger-core by swagger-api.
the class PropertySerializationTest method serializeArrayStringProperty.
@Test(description = "it should serialize a string array property")
public void serializeArrayStringProperty() throws IOException {
final ArrayProperty p = new ArrayProperty().items(new StringProperty());
final String json = "{\"type\":\"array\",\"items\":{\"type\":\"string\"}}";
assertEquals(m.writeValueAsString(p), json);
}
use of io.swagger.models.properties.StringProperty in project swagger-core by swagger-api.
the class PropertySerializationTest method deserializeObjectPropertyWithRequiredProperties.
@Test(description = "it should deserialize an object property with required set")
public void deserializeObjectPropertyWithRequiredProperties() throws IOException {
final ObjectProperty p = new ObjectProperty().property("stringProperty", new StringProperty().required(true));
final String json = "{\"type\":\"object\",\"properties\":{\"stringProperty\":{\"type\":\"string\"}},\"required\":[\"stringProperty\"]}";
assertEquals(p, m.readValue(json, ObjectProperty.class));
}
Aggregations