-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Map query parameters are not working as expected. #2241
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
Comments
Maps are not supported in query params in the 2.0 spec but you shouldn't get this error. Are you using master? |
This is using 2.14 (the latest released swagger-ui). If you c&p the json in editor.swagger.io, you should see the same error. It may ultimately be a problem in swagger.js, haven't dug into it I'm afraid. |
Please retry with Master |
Sure. Will let u know. Is there an ETA on the next cut of swagger-ui? Seems like it has a lot of good fixes |
Very soon, in fact, I'd like to this week. |
What the status of this? |
+1 |
I have the same problem using @ResquestParam with java.util.Map. |
Same for us with @ResquestParam with java.util.Map<String, String> |
Is there any update on this? We really want to use swagger in our swing rest api and it will be helpful for me to avoid separately documenting everything if swagger works |
Well, query parameters with Maps are simply not supported in the specification, and therefore not in the UI. You can only have primitives, arrays of primitives for query and path parameters. If you have a Map, it should be in a body parameter with a That said, the specification will be changing in 3.0 to allow complex schemas in all inputs. That will solve it, but not with the 2.0 spec. |
Hi If you see spring ref It does support Map. |
An implementation of a spec and a spec are quite different, and we can't control what people do with the spec implementation itself other than discourage things that are not supported. 3.0 sometime this year. |
Here is the link to the openapi issue for 3.0. The springfox implementation favors minor spec transgressions over gaps in the documentation especially for common spring usage patterns (and jax-rs patterns). However, I feel the swagger-ui should identify any transgression rather than throw its hands up in the air with an error that is hard to trace or do root cause analysis without stepping through the debugger. |
Thanks for replying. Do you guys know what is the alternative to MAP<String,String> @RequestParam , where I can accept n number of request parameters. |
You can get get the request param map by: Waiting for a fix for the issues, but for now that's an acceptable hack. :) |
Hi @dilipkrish, |
Given the following definition
Produces the following spec. The spec is a valid spec for the parameter (test) which is an open ended grab bag of query parameters.
However in swagger-ui, when we load this spec, we see this error
NOTE: This error manifests itself in editor.swagger.io as well.
The text was updated successfully, but these errors were encountered: