Display of query parameter order in openapi
See original GitHub issueHI,
Is there a way to specify the order of parameters to appear in openapi for an API endpoint?
For example in below code ,there are two parameters item
and qty
. Seems in openapi, the qty
can appear first before item
.
Is there a way I can control so that item
is displayed first followed by qty
?
from fastapi import FastAPI
app = FastAPI()
@app.get("/users/me")
async def read_user_me(item: str, qty: str):
return {"user_id": "the current user"}
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Can I enforce query parameter order in OpenApi?
1 Answer. Save this answer. Show activity on this post. The solution is to just enforce ordering when building the query string.
Read more >Describing Parameters - Swagger
Query parameters can be primitive values, arrays and objects. OpenAPI 3.0 provides several ways to serialize objects and arrays in the query string....
Read more >How to add query paramters to API definition in OpenAPI ...
With this video we will learn How to add query paramters to API definition in OpenAPI specification 3.0 (OAS) ?
Read more >Path Parameters - FastAPI
So, the URL for that file would be something like: /files/home/johndoe/myfile.txt . OpenAPI support¶. OpenAPI doesn't support a way to declare a path...
Read more >Parameter Object - Redocly
Describes a request parameter, which excludes the request body. ... Excerpt from the OpenAPI 3.1 specification about the parameter object ...
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
@babu-s2 You can create a Pydantic model and add
evaluation
andlocations
attributes. But you need to addlocations
on top ofevaluation
:Pydantic uses the same order as the declaration.
Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs.