Search in sources :

Example 16 with LongProperty

use of io.swagger.models.properties.LongProperty in project swagger-core by swagger-api.

the class PropertySerializationTest method serializeLongMapProperty.

@Test(description = "it should serialize a long MapProperty")
public void serializeLongMapProperty() throws IOException {
    final MapProperty p = new MapProperty(new LongProperty());
    final String json = "{\"type\":\"object\",\"additionalProperties\":{\"type\":\"integer\",\"format\":\"int64\"}}";
    assertEquals(m.writeValueAsString(p), json);
}
Also used : MapProperty(io.swagger.models.properties.MapProperty) LongProperty(io.swagger.models.properties.LongProperty) Test(org.testng.annotations.Test)

Example 17 with LongProperty

use of io.swagger.models.properties.LongProperty 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());
    }
}
Also used : BaseIntegerProperty(io.swagger.models.properties.BaseIntegerProperty) IntegerProperty(io.swagger.models.properties.IntegerProperty) ArrayProperty(io.swagger.models.properties.ArrayProperty) LongProperty(io.swagger.models.properties.LongProperty) StringProperty(io.swagger.models.properties.StringProperty) FloatProperty(io.swagger.models.properties.FloatProperty) DoubleProperty(io.swagger.models.properties.DoubleProperty)

Aggregations

LongProperty (io.swagger.models.properties.LongProperty)17 StringProperty (io.swagger.models.properties.StringProperty)13 Test (org.testng.annotations.Test)13 Property (io.swagger.models.properties.Property)8 ArrayProperty (io.swagger.models.properties.ArrayProperty)7 IntegerProperty (io.swagger.models.properties.IntegerProperty)7 RefProperty (io.swagger.models.properties.RefProperty)7 Model (io.swagger.models.Model)6 DoubleProperty (io.swagger.models.properties.DoubleProperty)5 Operation (io.swagger.models.Operation)4 Path (io.swagger.models.Path)4 Response (io.swagger.models.Response)4 QueryParameter (io.swagger.models.parameters.QueryParameter)4 BooleanProperty (io.swagger.models.properties.BooleanProperty)4 FloatProperty (io.swagger.models.properties.FloatProperty)4 Contact (io.swagger.models.Contact)3 Info (io.swagger.models.Info)3 ModelImpl (io.swagger.models.ModelImpl)3 Person (io.swagger.models.Person)3 RefModel (io.swagger.models.RefModel)3