use of io.swagger.v3.oas.models.media.NumberSchema in project swagger-core by swagger-api.
the class ParameterSerializationTest method testDoubleValue.
@Test(description = "should serialize double value")
public void testDoubleValue() {
final QueryParameter param = new QueryParameter();
param.setSchema(new NumberSchema()._default(new BigDecimal("12.34")).format("double"));
final String json = "{\"in\":\"query\",\"schema\":{\"type\":\"number\",\"format\":\"double\",\"default\":12.34}}";
SerializationMatchers.assertEqualsToJson(param, json);
}
use of io.swagger.v3.oas.models.media.NumberSchema in project swagger-core by swagger-api.
the class PropertySerializationTest method serializeFloatProperty.
@Test(description = "it should serialize a FloatProperty")
public void serializeFloatProperty() throws IOException {
final NumberSchema p = new NumberSchema()._default(new BigDecimal("1.2"));
p.format("float");
final String json = "{\"type\":\"number\",\"format\":\"float\",\"default\":1.2}";
assertEquals(m.writeValueAsString(p), json);
}
Aggregations