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

Swagger don't handle multiple examples #41

Open
da-ekchajzer opened this issue Jan 19, 2022 · 0 comments · May be fixed by #376
Open

Swagger don't handle multiple examples #41

da-ekchajzer opened this issue Jan 19, 2022 · 0 comments · May be fixed by #376
Labels
bug Something isn't working documentation Improvements or additions to documentation help wanted Extra attention is needed

Comments

@da-ekchajzer
Copy link
Collaborator

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 :
fastapi/fastapi#822

@da-ekchajzer da-ekchajzer added bug Something isn't working documentation Improvements or additions to documentation help wanted Extra attention is needed labels Jan 19, 2022
@ju3ouz4n ju3ouz4n linked a pull request Feb 10, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant