Skip to content
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

Multiple OpenAPI examples #45

Open
v-- opened this issue Nov 30, 2022 · 1 comment
Open

Multiple OpenAPI examples #45

v-- opened this issue Nov 30, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@v--
Copy link

v-- commented Nov 30, 2022

I understand that I can add examples to endpoints via

@api.method()
def endpoint(value1: str = Body(example='test'), value2: int = Body(example=3))
    ...

What to do if I want to add multiple examples as discussed in https://fastapi.tiangolo.com/tutorial/schema-extra-example/?h=examples#body-with-multiple-examples ? The obvious thing to do would be to use list the examples in the Body, as it is done in plain FastAPI, but that doesn't work. Perhaps the Entrypoint#method method can accept an examples parameter (i.e. add it to the MethodRoute class)?

@spumer spumer added the enhancement New feature or request label Jan 9, 2023
@spumer
Copy link
Collaborator

spumer commented Jul 3, 2023

Fastapi 0.99 version released and it's support openapi 3.1.0 which add native support for exampleS

https://fastapi.tiangolo.com/tutorial/schema-extra-example/#pydantic-and-fastapi-examples

I was try it out, but no effect. Need more time investment

@smagafurov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants