boaviztapi icon indicating copy to clipboard operation
boaviztapi copied to clipboard

Swagger don't handle multiple examples

Open da-ekchajzer opened this issue 3 years ago • 0 comments

Bug description

Swagger do not handle multiple exemples.

To Reproduce

  • In boaviztapi > routers > server_router.py
CHANGE 

def server_impact_by_config(server_dto: ServerDTO = Body(None, example=server_configuration_examples["DellR740"]), verbose: bool = True):

TO 

def server_impact_by_config(server_dto: ServerDTO = Body(None, examples=server_configuration_examples["DellR740"]), verbose: bool = True):

and add another server to boaviztapi > routers >openapi_doc > examples.py


server_configuration_examples = {
    "empty_server"':{}
    "DellR740": {...

You will be able to change the example in http://localhost:5000/docs#/server/server_impact_by_config_v1_server_server_impact_by_config_description_post but the content of body won't change.

Expected behavior

When another example is selected, the body should change accordingly.

Additional context

FastAPI issue on the topic : https://github.com/tiangolo/fastapi/issues/822

da-ekchajzer avatar Jan 19 '22 17:01 da-ekchajzer