use of io.swagger.models.parameters.BodyParameter in project swagger-core by swagger-api.
the class SimpleReaderTest method testParam.
private Model testParam(Swagger swagger, String path, String name, String description) {
BodyParameter param = (BodyParameter) getPostParameters(swagger, path).get(0);
assertEquals(param.getIn(), "body");
assertEquals(param.getName(), name);
assertEquals(param.getDescription(), description);
return param.getSchema();
}
use of io.swagger.models.parameters.BodyParameter in project swagger-core by swagger-api.
the class GenericsTest method checkCollectionsOfStringsAsBodyParameter.
@Test(description = "check collection of strings as body parameter")
public void checkCollectionsOfStringsAsBodyParameter() {
Operation op = getOperation("testStringsInBody");
assertEquals(op.getParameters().size(), 1);
BodyParameter p = getBodyParameter(op, 0);
ArrayModel strArray = (ArrayModel) p.getSchema();
assertEquals(strArray.getItems().getType(), "string");
}
use of io.swagger.models.parameters.BodyParameter 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);
}
use of io.swagger.models.parameters.BodyParameter in project swagger-core by swagger-api.
the class PostParamTest method findPostOperationWithObjectsCollection.
@Test(description = "find a Post operation with collection of objects")
public void findPostOperationWithObjectsCollection() {
Path petPath = getPath("collectionOfObjects");
assertNotNull(petPath);
Operation petPost = petPath.getPost();
assertNotNull(petPost);
assertEquals(petPost.getParameters().size(), 1);
BodyParameter petPostBodyParam = (BodyParameter) petPost.getParameters().get(0);
assertEquals(petPostBodyParam.getName(), BODY);
Model inputModel = petPostBodyParam.getSchema();
assertTrue(inputModel instanceof ArrayModel);
ArrayModel ap = (ArrayModel) inputModel;
Property inputSchema = ap.getItems();
assertTrue(inputSchema instanceof RefProperty);
RefProperty rm = (RefProperty) inputSchema;
assertEquals(rm.getSimpleRef(), PET);
}
use of io.swagger.models.parameters.BodyParameter in project swagger-core by swagger-api.
the class PostParamTest method findAPostOperationWithStringsList.
@Test(description = "find a Post operation with list of strings")
public void findAPostOperationWithStringsList() {
Path petPath = getPath("listOfStrings");
assertNotNull(petPath);
Operation petPost = petPath.getPost();
assertNotNull(petPost);
assertEquals(petPost.getParameters().size(), 1);
BodyParameter petPostBodyParam = (BodyParameter) petPost.getParameters().get(0);
assertEquals(petPostBodyParam.getName(), BODY);
Model inputModel = petPostBodyParam.getSchema();
assertTrue(inputModel instanceof ArrayModel);
ArrayModel ap = (ArrayModel) inputModel;
Property inputSchema = ap.getItems();
assertTrue(inputSchema instanceof StringProperty);
}
Aggregations