[QUESTION] How can use a default value for query parameter list
See original GitHub issueDescription
I would to set a default value for query parameter list. I tried List[str] = Query(('a', 'b'))
but i receive an empty array.
Additional context
I added a simple test case that demonstrate the empty array returned by List[str] = Query(('a', 'b'))
https://github.com/ysavary/fastapi/commit/2bee1fa5e158ca37c5dbc554c07c9711dbd05d29
The 3rd test, ("/query/list_str/default", 200, "foo bar ['a', 'b']")
is failing:
E assert 'foo bar []' == "foo bar ['a', 'b']"
E - foo bar []
E + foo bar ['a', 'b']
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Default values in list query parameter - asp.net core
I am trying to display default values in Swashbuckle. Is there a way to define default values in a query list parameter in...
Read more >Set Question Defaults with Query Parameters
ConvertCalculator supports setting these default question values by using query parameters. Here's how it works: Go to the question settings you want pre-filledĀ ......
Read more >Query Parameters and String Validations - FastAPI
As we have to replace the default value None in the function with Query() , we can now set the default value with...
Read more >How to set default values for parameters - Microsoft Q&A
I want to set the default value of the parameter according to the current time. power-query-not-supported. Comment. Comment
Read more >Default parameters - JavaScript - MDN Web Docs
Default function parameters allow named parameters to be initialized with default values if no value or undefined is passed.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tiangolo @euri10
Thank you for your answers. Awesome framework š
Iām glad youāre liking it @ysavary ! I think the issue is solved now, so Iāll close it. But feel free to add more comments, create new issues, etc.