Search in sources :

Example 31 with MapProperty

use of io.swagger.models.properties.MapProperty in project swagger-parser by swagger-api.

the class SwaggerInventory method process.

public void process(Property property) {
    this.properties.add(property);
    if (property instanceof ArrayProperty) {
        ArrayProperty p = (ArrayProperty) property;
        Property ap = p.getItems();
        this.process(ap);
    } else if (property instanceof MapProperty) {
        MapProperty p1 = (MapProperty) property;
    } else if (property instanceof ObjectProperty) {
        ObjectProperty p2 = (ObjectProperty) property;
        if (p2.getProperties() != null) {
            Iterator ap1 = p2.getProperties().keySet().iterator();
            while (ap1.hasNext()) {
                String name = (String) ap1.next();
                Property ip = (Property) p2.getProperties().get(name);
                this.process(ip);
            }
        }
    }
}
Also used : ObjectProperty(io.swagger.models.properties.ObjectProperty) ArrayProperty(io.swagger.models.properties.ArrayProperty) MapProperty(io.swagger.models.properties.MapProperty) Iterator(java.util.Iterator) MapProperty(io.swagger.models.properties.MapProperty) ArrayProperty(io.swagger.models.properties.ArrayProperty) ObjectProperty(io.swagger.models.properties.ObjectProperty) Property(io.swagger.models.properties.Property)

Example 32 with MapProperty

use of io.swagger.models.properties.MapProperty in project java-chassis by ServiceComb.

the class TestSwaggerUtils method isComplexProperty.

@Test
public void isComplexProperty() {
    Property property = new RefProperty("ref");
    Assert.assertTrue(SwaggerUtils.isComplexProperty(property));
    property = new ObjectProperty();
    Assert.assertTrue(SwaggerUtils.isComplexProperty(property));
    property = new MapProperty();
    Assert.assertTrue(SwaggerUtils.isComplexProperty(property));
    property = new ArrayProperty(new ObjectProperty());
    Assert.assertTrue(SwaggerUtils.isComplexProperty(property));
    property = new ArrayProperty(new StringProperty());
    Assert.assertFalse(SwaggerUtils.isComplexProperty(property));
    property = new StringProperty();
    Assert.assertFalse(SwaggerUtils.isComplexProperty(property));
}
Also used : ObjectProperty(io.swagger.models.properties.ObjectProperty) ArrayProperty(io.swagger.models.properties.ArrayProperty) MapProperty(io.swagger.models.properties.MapProperty) StringProperty(io.swagger.models.properties.StringProperty) StringProperty(io.swagger.models.properties.StringProperty) ArrayProperty(io.swagger.models.properties.ArrayProperty) RefProperty(io.swagger.models.properties.RefProperty) Property(io.swagger.models.properties.Property) MapProperty(io.swagger.models.properties.MapProperty) ObjectProperty(io.swagger.models.properties.ObjectProperty) RefProperty(io.swagger.models.properties.RefProperty) Test(org.junit.Test)

Aggregations

MapProperty (io.swagger.models.properties.MapProperty)32 Property (io.swagger.models.properties.Property)26 ArrayProperty (io.swagger.models.properties.ArrayProperty)22 RefProperty (io.swagger.models.properties.RefProperty)16 Test (org.testng.annotations.Test)15 StringProperty (io.swagger.models.properties.StringProperty)13 Model (io.swagger.models.Model)12 IntegerProperty (io.swagger.models.properties.IntegerProperty)12 ObjectProperty (io.swagger.models.properties.ObjectProperty)8 RefModel (io.swagger.models.RefModel)7 ModelImpl (io.swagger.models.ModelImpl)6 JavaType (com.fasterxml.jackson.databind.JavaType)5 ApiModelProperty (io.swagger.annotations.ApiModelProperty)5 FileProperty (io.swagger.models.properties.FileProperty)5 LongProperty (io.swagger.models.properties.LongProperty)5 JsonProperty (com.fasterxml.jackson.annotation.JsonProperty)4 ComposedModel (io.swagger.models.ComposedModel)4 Operation (io.swagger.models.Operation)4 Response (io.swagger.models.Response)4 AbstractNumericProperty (io.swagger.models.properties.AbstractNumericProperty)4