use of io.swagger.models.parameters.QueryParameter in project swagger-core by swagger-api.
the class ReaderTest method scanParametersFromBaseResource.
@Test(description = "it should scan parameters from base resource class")
public void scanParametersFromBaseResource() {
Swagger swagger = getSwagger(BookResource.class);
assertNotNull(swagger);
List<Parameter> parameters = getGet(swagger, "/{id}/v1/books/{name}").getParameters();
assertEquals(parameters.size(), 4);
Parameter description = parameters.get(0);
assertTrue(description instanceof PathParameter);
assertEquals(description.getName(), "description");
assertEquals(description.getDescription(), "Overridden description");
Parameter id = parameters.get(1);
assertTrue(id instanceof PathParameter);
assertEquals(id.getName(), "id");
assertEquals(id.getDescription(), "The Identifier of entity");
Parameter test = parameters.get(2);
assertTrue(test instanceof QueryParameter);
assertEquals(test.getName(), "test");
assertEquals(test.getDescription(), "Test Query Param");
Parameter name = parameters.get(3);
assertTrue(name instanceof PathParameter);
assertEquals(name.getName(), "name");
assertEquals(name.getDescription(), "The books name");
}
use of io.swagger.models.parameters.QueryParameter in project swagger-core by swagger-api.
the class SimpleReaderTest method scanDefaultValueAndRequiredOptions.
@Test(description = "scan defaultValue and required per #937")
public void scanDefaultValueAndRequiredOptions() {
Swagger swagger = getSwagger(Resource937.class);
QueryParameter param = (QueryParameter) getGetParameters(swagger, "/external/info").get(0);
assertFalse(param.getRequired());
assertEquals(param.getDefaultValue(), "dogs");
}
use of io.swagger.models.parameters.QueryParameter 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);
}
use of io.swagger.models.parameters.QueryParameter in project swagger-core by swagger-api.
the class OverriddenTypeTests method integerTypeOverrideTest.
@Test(description = "overrides a system-detected type")
public void integerTypeOverrideTest() {
Swagger swagger = new Reader(new Swagger()).read(Resource469.class);
QueryParameter qp = (QueryParameter) swagger.getPath("/test").getPut().getParameters().get(0);
assertEquals(qp.getType(), "string");
assertEquals(qp.getFormat(), "blah");
}
use of io.swagger.models.parameters.QueryParameter in project swagger-core by swagger-api.
the class OverriddenTypeTests method integerFormatOverrideTest.
@Test(description = "overrides a system-detected format")
public void integerFormatOverrideTest() {
Swagger swagger = new Reader(new Swagger()).read(Resource469.class);
QueryParameter qp = (QueryParameter) swagger.getPath("/test").getPost().getParameters().get(0);
assertEquals(qp.getFormat(), "int64");
}
Aggregations