Search in sources :

Example 56 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 57 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 58 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 59 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 60 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)82 Property (io.swagger.models.properties.Property)62 StringProperty (io.swagger.models.properties.StringProperty)42 RefProperty (io.swagger.models.properties.RefProperty)39 Test (org.testng.annotations.Test)36 MapProperty (io.swagger.models.properties.MapProperty)25 Model (io.swagger.models.Model)23 IntegerProperty (io.swagger.models.properties.IntegerProperty)23 LongProperty (io.swagger.models.properties.LongProperty)14 ModelImpl (io.swagger.models.ModelImpl)13 BooleanProperty (io.swagger.models.properties.BooleanProperty)12 DoubleProperty (io.swagger.models.properties.DoubleProperty)12 RefModel (io.swagger.models.RefModel)10 FloatProperty (io.swagger.models.properties.FloatProperty)10 Operation (io.swagger.models.Operation)9 ByteArrayProperty (io.swagger.models.properties.ByteArrayProperty)9 DecimalProperty (io.swagger.models.properties.DecimalProperty)9 HashMap (java.util.HashMap)9 Response (io.swagger.models.Response)7 Swagger (io.swagger.models.Swagger)7