-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
In docs, DelimitedList field doesn't produce the expected query parameter format #416
Comments
@pamelafox Hi there. After some source code reading, I found the query parameters generating behavior above is a default behavior to Hope it helpful to you :/ |
Thanks tkzt for the explanation. After some investigation, I think it needs to be fixed in apispec. It shouldn't set the param I will try to create an issue/PR to apispec later. Moved this issue to the 2.1.0 milestone. Ref:
|
I am using the DelimitedList field like so:
And I am using it for the query parameters:
That field lets me send a query like so:
charts/pie?title=Enrolled%20students&labels=C,Ruby,Java,Python&values=10,20,15,30.5
However, if I enable the APIFlask docs and add multiple values to the DelimitedList fields, the generated URL is instead like this:
charts/pie?title=Enrolled%2520students&values=10&values=20&values=30&values=15&labels=C&labels=Ruby&labels=Java&labels=Python
That query parameter is repeating the fields instead of putting them as comma separated values. That isn't what the parser expects, apparently, as the values and labels come in to APIFlask as lists with single values (the first of each parameter).
For full code, see:
https://github.com/pamelafox/flask-charts-api-container-app/blob/main/src/api/__init__.py
Environment:
Docs screenshot here:
The text was updated successfully, but these errors were encountered: