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));
}
use of io.swagger.models.properties.StringProperty in project swagger-core by swagger-api.
the class PropertySerializationTest method deserializeStringProperty.
@Test(description = "it should deserialize a StringProperty")
public void deserializeStringProperty() throws IOException {
final String json = "{\"type\":\"string\"}";
final Property p = m.readValue(json, Property.class);
assertEquals(p.getType(), "string");
assertEquals(p.getClass(), StringProperty.class);
assertEquals(m.writeValueAsString(p), json);
}
use of io.swagger.models.properties.StringProperty in project swagger-core by swagger-api.
the class ParameterSerializationTest method serializeEnumPathParameter.
@Test(description = "it should serialize a path parameter with enum")
public void serializeEnumPathParameter() {
PathParameter p = new PathParameter().items(new StringProperty())._enum(Arrays.asList("a", "b", "c"));
final String json = "{" + " \"in\":\"path\"," + " \"required\":true," + " \"items\":{" + " \"type\":\"string\"" + " }," + " \"enum\":[\"a\",\"b\",\"c\"]" + "}";
SerializationMatchers.assertEqualsToJson(p, json);
}
use of io.swagger.models.properties.StringProperty in project swagger-core by swagger-api.
the class StringPropertyTest method testEquals.
@Test
public void testEquals() {
final StringProperty prop1 = new StringProperty();
prop1.setName(PROP_1);
prop1.setRequired(true);
final StringProperty prop2 = new StringProperty();
prop2.setName(PROP_2);
assertNotEquals(prop1, prop2);
prop2.setName(PROP_1);
prop2.setRequired(true);
assertEquals(prop1, prop2);
}
Aggregations