fastapi-jsonrpc icon indicating copy to clipboard operation
fastapi-jsonrpc copied to clipboard

Multiple OpenAPI examples

Open v-- opened this issue 2 years ago • 1 comments

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)?

v-- avatar Nov 30 '22 09:11 v--

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

spumer avatar Jul 03 '23 08:07 spumer