question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Display of query parameter order in openapi

See original GitHub issue

HI,

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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Kludexcommented, Jun 8, 2020

@babu-s2 You can create a Pydantic model and add evaluation and locations attributes. But you need to add locations on top of evaluation:

class MyQuery(BaseModel):
    locations: List[str]
    evaluation: str

Pydantic uses the same order as the declaration.

0reactions
github-actions[bot]commented, Oct 30, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found