Annotation @BeanParam is generating errors in Swagger Editor
When you use the @BeanParam annotation in the parameter that contains an attribute of type list, you are generating some errors in Swagger Editor.
If you change type: object totype: string the errors disappear.
In my case I need to use collectionFormat: csv, but even changing this property to csv appears collectionFormat: multi.
If you remove @BeanParam and put @ApiParam (value = "Fields") @QueryParam ("fields") List <String> fields does not display errors.
For example:
@GET
@Path("/test")
@ApiOperation(value = "Test BeanParam")
@ApiResponse(code = 204, message = "No content")
public Response test(@BeanParam TestBeanParam test) {
return Response.noContent().build();
}
public class TestBeanParam {
@ApiParam(name = "test", value = "Test BeanParam")
@QueryParam("test")
private List<String> fields;
public List<String> getFields() {
return fields;
}
public void setFields(List<String> fields) {
this.fields = fields;
}
}
File swagger.json:
/api/v1/test:
get:
summary: Test BeanParam
description: ''
operationId: test
consumes:
- application/json
produces:
- application/json
parameters:
- name: test
in: query
description: Test BeanParam
required: false
type: array
items:
type: object
collectionFormat: multi
responses:
default:
description: successful operation
Errors displayed in Swagger Editor:
Line
name: test
Error
Schema error at paths['/api/v1/test'].get.parameters[0].required
should be equal to one of the allowed values
allowedValues: true
Line
items:
type: object
Error
Schema error at paths['/ai/v1/test'].get.parameters[0].items.type
should be equal to one of the allowed values
allowedValues: string, number, integer, boolean, array
Line
collectionFormat: multi
Error
Schema error at paths['/api/v1/test'].get.parameters[0].collectionFormat
should be equal to one of the allowed values
allowedValues: csv, ssv, tsv, pipes
Problem solved. The problem was that I was using a version of the outdated swagger-maven-plugin. I changed the version and it is now working correctly.