Search in sources :

Example 76 with Operation

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

the class GenericsTest method checkCollectionsOfIntegers.

@Test(description = "check collections of integers")
public void checkCollectionsOfIntegers() {
    Operation op = getOperation("testIntegerContainers");
    assertEquals(op.getParameters().size(), 8);
    testCollection(getQueryParameter(op, 0), "set", "integer", "int32");
    testCollection(getQueryParameter(op, 1), "list", "integer", "int32");
    testCollection(getQueryParameter(op, 2), "list2D", "string", null);
    testCollection(getQueryParameter(op, 3), "array", "integer", "int32");
    testCollection(getQueryParameter(op, 4), "arrayP", "integer", "int32");
    testScalar(getQueryParameter(op, 5), "scalar", "integer", "int32");
    testScalar(getQueryParameter(op, 6), "scalarP", "integer", "int32");
    testCollection(getQueryParameter(op, 7), "forced", "integer", "int32");
}
Also used : Operation(io.swagger.models.Operation) Test(org.testng.annotations.Test)

Example 77 with Operation

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

the class GenericsTest method checkCollectionsOfObjects.

@Test(description = "check collections of objects")
public void checkCollectionsOfObjects() {
    Operation op = getOperation("testObjectContainers");
    assertEquals(op.getParameters().size(), 5);
    testCollection(getQueryParameter(op, 0), "set", "string", null);
    testCollection(getQueryParameter(op, 1), "list", "string", null);
    testCollection(getQueryParameter(op, 2), "list2D", "string", null);
    testCollection(getQueryParameter(op, 3), "array", "string", null);
    testScalar(getQueryParameter(op, 4), "scalar", "string", null);
}
Also used : Operation(io.swagger.models.Operation) Test(org.testng.annotations.Test)

Example 78 with Operation

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

the class GenericsTest method checkCollectionsOfEnumerationsAsBodyParameter.

@Test(description = "check collection of enumerations as body parameter")
public void checkCollectionsOfEnumerationsAsBodyParameter() {
    Operation op = getOperation("testEnumsInBody");
    assertEquals(op.getParameters().size(), 1);
    BodyParameter p = getBodyParameter(op, 0);
    ArrayModel enumArray = (ArrayModel) p.getSchema();
    assertEquals(((StringProperty) enumArray.getItems()).getEnum(), enumValues);
}
Also used : Operation(io.swagger.models.Operation) BodyParameter(io.swagger.models.parameters.BodyParameter) ArrayModel(io.swagger.models.ArrayModel) Test(org.testng.annotations.Test)

Example 79 with Operation

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

the class GenericsTest method checkCollectionsOfStrings.

@Test(description = "check collections of strings")
public void checkCollectionsOfStrings() {
    Operation op = getOperation("testStringContainers");
    assertEquals(op.getParameters().size(), 5);
    QueryParameter set = getQueryParameter(op, 0);
    testCollection(set, "set", "string", null);
    assertEquals(((StringProperty) set.getItems()).getEnum(), Arrays.asList("1", "2", "3"));
    testCollection(getQueryParameter(op, 1), "list", "string", null);
    testCollection(getQueryParameter(op, 2), "list2D", "string", null);
    testCollection(getQueryParameter(op, 3), "array", "string", null);
    testScalar(getQueryParameter(op, 4), "scalar", "string", null);
}
Also used : QueryParameter(io.swagger.models.parameters.QueryParameter) Operation(io.swagger.models.Operation) Test(org.testng.annotations.Test)

Example 80 with Operation

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

the class HiddenParametersScannerTest method shouldScanMethodWithAllParamsHidden.

@Test
public void shouldScanMethodWithAllParamsHidden() throws Exception {
    Operation get = getGet("/all-hidden/{id}");
    assertNotNull(get);
    assertEquals(0, get.getParameters().size());
}
Also used : Operation(io.swagger.models.Operation) Test(org.testng.annotations.Test)

Aggregations

Operation (io.swagger.models.Operation)118 Test (org.testng.annotations.Test)80 Swagger (io.swagger.models.Swagger)45 Path (io.swagger.models.Path)39 BodyParameter (io.swagger.models.parameters.BodyParameter)27 Property (io.swagger.models.properties.Property)24 Response (io.swagger.models.Response)23 Parameter (io.swagger.models.parameters.Parameter)20 RefProperty (io.swagger.models.properties.RefProperty)16 ArrayModel (io.swagger.models.ArrayModel)15 Model (io.swagger.models.Model)14 QueryParameter (io.swagger.models.parameters.QueryParameter)13 StringProperty (io.swagger.models.properties.StringProperty)13 HashMap (java.util.HashMap)13 ArrayProperty (io.swagger.models.properties.ArrayProperty)12 ReaderContext (io.swagger.servlet.ReaderContext)12 PathParameter (io.swagger.models.parameters.PathParameter)11 ArrayList (java.util.ArrayList)11 MapProperty (io.swagger.models.properties.MapProperty)10 NicknamedOperation (io.swagger.resources.NicknamedOperation)10