Boavizta / boaviztapi

🛠 Giving access to BOAVIZTA reference data and methodologies trough a RESTful API
GNU Affero General Public License v3.0
68 stars 23 forks source link

Swagger don't handle multiple examples #41

Open da-ekchajzer opened 2 years ago

da-ekchajzer commented 2 years ago

Bug description

Swagger do not handle multiple exemples.

To Reproduce

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

```python

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