New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@ApiImplicitParam: "array" dataType is getting resolved into "type":"ref" #902
Comments
Just fyi here is the documentation on the expectation of overriding types like you have. Also it should be defined as a child of the implicit params collection @ApiImplicitParams({
@ApiImplicitParam(name = "status_ids", required = false, allowMultiple = true, paramType = "query", dataType = "array")
}) |
Thank you for quick response, What i need is to describe all possible query parameters, where one of the parameters is an array. @ApiImplicitParams({
@ApiImplicitParam(name = "app_id", required = false, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "status_ids", required = false, allowMultiple = true, paramType = "query", dataType = "array"),
@ApiImplicitParam(name = "limit", required = false, dataType = "int", paramType = "query")
})
@RequestMapping(method = GET)
public List<App> listApps(@ApiIgnore HttpServletRequest request, @ApiIgnore HttpSession httpSession) {
String query = request.getQueryString();
//some code here
} My question is: what dataType value should i use for implicit parameter to be resolved into "array" type. |
Change
|
I apologize for reopening this issue (didn't want to create a duplicate one). Based on the swagger specification, one of the allowed types for a query parameter is @ApiImplicitParams({
@ApiImplicitParam(name = "classifications", allowMultiple = true, paramType = "query", allowableValues = "ONE, TWO, THREE")
}) This seems to generate a swagger model with the type set to {
"enum": [
"ONE",
"TWO",
"THREE"
],
"in": "query",
"name": "classifications",
"required": false,
"type": "string"
} The enum itself is called I tried adding rules (using {
"name": "classifications",
"in": "query",
"required": false,
"type": "array",
"items": {
"$ref": "#/definitions/"
},
"collectionFormat": "multi"
} But this doesn't have the list of enum values or the item type I want ( |
@vivin I fixed a subtle bug with it, but it should be available when we release 2.4.0. details in the commit ☝️ Thanks for reporting! |
@dilipkrish Thanks Dilip! |
@dilipkrish One more question - I can't seem to find 2.4.x snapshot versions on the snapshot repo. Am I looking in the right place? Or should I try building directly from the source? |
Haven't upped the version yet. So u should find it @ 2.3.2-Snapshot. Details on how to get it it at http://springfox.io |
@dilipkrish Thank you! |
strange results for Pojos:
|
I wanted to do the same using openapi 3. but there is no allowMultiple = true. |
Hi,
i have rest method where one of the implicit parameters is an array.
When i use @ApiImplicitParam annotation with dataType = "array" it is resolved into
i'm using springfox-swagger2 2.1.2.
Could you please advise what is the correct way to document implicit array parameter?
Thank you.
The text was updated successfully, but these errors were encountered: