-
Notifications
You must be signed in to change notification settings - Fork 9.1k
[Question] Dynamic query parameters #367
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
@rhazegh - you'll have to forgive me for not reading that whole document, but I assume you mean the attachment of the |
Let's say you have 10 attributes in your model. There are 25 attachment kinds of The problem is how do we handle this in Swagger UI? Having 250 parameters makes the UI hard to read/use. |
I understand, but the spec currently does not try to deal with such a REST API design. |
The request in issue #349 could be a possible solution. |
It could, but a - it doesn't really cover your issue, since you do want to document which parameters you have and it's not all that 'free form', and secondly, it would require more traction. We can keep this issue as a feature request as well, leaving people to comment about their needs. |
Cool. That would be great. |
I encountered similar issue while working on server which is supposed to conform certain API specification. Full spec: http://hl7-fhir.github.io/search.html
This is something outside of our control but we want to document it and allow users to use Swagger UI to experiment. |
I would also like to see this functionality. We are building a dynamic search application which is based on the data inside the application. For us an URL looks like :
Where JOB_CONTRACT_TYPE is a dynamic query parameter that we only know at runtime. What I would like to see is the possibility to also add these from swagger ui. So just a key and a value field would be really nice! |
I have a similar issue - our application provides a REST query interface to a NoSQL backend, which our (enterprise, on-prem) customers can fill with whatever data they want. This means that we don't know the 'schema' - the field/key names - up front, so we couldn't hardcode all the possible combinations into the spec file, even if we wanted to. These appear in the query URL as parameters to query on, with a prefix of |
Check the Path Parameters object to see how free-form query parameters were added in 3.0. |
I am using Ransack (https://github.com/activerecord-hackery/ransack/wiki/Basic-Searching) to build dynamic queries.
Say I have this model:
Is there any way to document the following query?
GET api/v1/users?q[first_name_cont]=eric&q[email_not_cont]=gmail
or this?
GET api/v1/users?q[last_name_cont]=johnson&q[age_gt]=18&q[email_cont]=gmail
If not, do you know any workarounds for this?
The text was updated successfully, but these errors were encountered: