Search in sources :

Example 36 with ArrayProperty

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

the class SimpleReaderTest method scanResourceWithInnerClass.

@Test(description = "scan a resource with inner class")
public void scanResourceWithInnerClass() {
    Swagger swagger = getSwagger(ResourceWithInnerClass.class);
    assertEquals(((RefProperty) ((ArrayProperty) getGetResponses(swagger, "/description").get("200").getSchema()).getItems()).get$ref(), "#/definitions/Description");
    assertTrue(swagger.getDefinitions().containsKey("Description"));
}
Also used : ArrayProperty(io.swagger.models.properties.ArrayProperty) Swagger(io.swagger.models.Swagger) Test(org.testng.annotations.Test)

Example 37 with ArrayProperty

use of io.swagger.models.properties.ArrayProperty 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)

Example 38 with ArrayProperty

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

the class ArrayPropertyTest method testEquals.

@Test
public void testEquals() {
    final ArrayProperty prop1 = new ArrayProperty();
    prop1.setName(PROP_1);
    prop1.setRequired(true);
    final ArrayProperty prop2 = new ArrayProperty();
    prop2.setName(PROP_2);
    assertNotEquals(prop1, prop2);
    prop2.setName(PROP_1);
    prop2.setRequired(true);
    assertEquals(prop1, prop2);
}
Also used : ArrayProperty(io.swagger.models.properties.ArrayProperty) Test(org.testng.annotations.Test)

Example 39 with ArrayProperty

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

the class ArrayModelTest method testItems.

@Test
public void testItems() {
    // given
    Property items = new ArrayProperty();
    // when
    instance.items(items);
    // then
    assertEquals(items, instance.getItems(), "The got items must be the same as the set one");
}
Also used : ArrayProperty(io.swagger.models.properties.ArrayProperty) StringProperty(io.swagger.models.properties.StringProperty) ArrayProperty(io.swagger.models.properties.ArrayProperty) Property(io.swagger.models.properties.Property) Test(org.testng.annotations.Test)

Example 40 with ArrayProperty

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

the class ModelImplTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    instance = new ModelImpl();
    propertiesAndValues = new Object[] { "additionalProperties", new ArrayProperty(), "description", "description", "discriminator", "discriminator", "example", new Object(), "format", "format", "isSimple", true, "name", "name", "properties", new HashMap<String, Property>(), "required", new ArrayList<String>(), "type", "type", "xml", new Xml(), "defaultValue", "defaultValue" };
}
Also used : ArrayProperty(io.swagger.models.properties.ArrayProperty) ArrayProperty(io.swagger.models.properties.ArrayProperty) Property(io.swagger.models.properties.Property) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

ArrayProperty (io.swagger.models.properties.ArrayProperty)44 Property (io.swagger.models.properties.Property)30 Test (org.testng.annotations.Test)30 StringProperty (io.swagger.models.properties.StringProperty)24 Model (io.swagger.models.Model)14 MapProperty (io.swagger.models.properties.MapProperty)14 RefProperty (io.swagger.models.properties.RefProperty)13 IntegerProperty (io.swagger.models.properties.IntegerProperty)12 ModelImpl (io.swagger.models.ModelImpl)8 DoubleProperty (io.swagger.models.properties.DoubleProperty)7 LongProperty (io.swagger.models.properties.LongProperty)7 Operation (io.swagger.models.Operation)6 ByteArrayProperty (io.swagger.models.properties.ByteArrayProperty)6 FloatProperty (io.swagger.models.properties.FloatProperty)5 ApiModelProperty (io.swagger.annotations.ApiModelProperty)4 AbstractNumericProperty (io.swagger.models.properties.AbstractNumericProperty)4 BaseIntegerProperty (io.swagger.models.properties.BaseIntegerProperty)4 BooleanProperty (io.swagger.models.properties.BooleanProperty)4 DecimalProperty (io.swagger.models.properties.DecimalProperty)4 Annotation (java.lang.annotation.Annotation)4