How to create a query/path parameter that show up as text in the dropdown but display as an integer in the url? #6037
Replies: 1 comment 1 reply
-
|
I don't have an answer for you but what you want is fast api to generate a oneOf for that field sorta like what is described in this stack over flow post https://stackoverflow.com/questions/66465888/how-to-define-enum-mapping-in-openapi I am not really sure how to coax FastAPI in generating that format though. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
Is there someway for a dropdown in the fastapi docs to display text but have the url display the corrospoding integer value instead of the text? As you can see in the image below "Option 2" is selected and then the url displays "Option%202". Is there anyway that instead I could have the url just display "2" by somehow mapping Option1 to 1, Option2 to 2, and Option3 to 3? Thanks.
Operating System
Windows
Operating System Details
No response
FastAPI Version
0.79.1
Python Version
3.9.2
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions