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

Examples not shown in Swagger-ui #116

Open
javierdvalle opened this issue Jan 17, 2021 · 1 comment
Open

Examples not shown in Swagger-ui #116

javierdvalle opened this issue Jan 17, 2021 · 1 comment
Labels

Comments

@javierdvalle
Copy link

Adding example resources on the docs appears to be broken. The examples are not shown in the Swagger UI although they appear in the json OpenAPI specification. I am not sure if this is a problem of eve-swagger or Swagger-ui, I just tried to follow the instructions here: https://github.com/pyeve/eve-swagger#example-resources-on-the-docs

I am using this configuration:

'DOMAIN': {
    'users': {
        'description': 'this is a description of the users endpoint',
        'example': {"name": "Joe", "id": "1234", "age": 30},  <--- custom example
        'allow_unknown': True,
        'schema': { ... }
    }, ...
}

That gets translated into this OpenAPI specification:

{
    "openapi": "3.0.0",
    "info": {...},
    "servers": {...},
    "paths": {},
    "components": {
        "schemas": {},  <---- the example shown in swagger ui appears to be taken from here
        "responses": {},
        "parameters": {},
        "examples": {},  <---- the provided custom example goes here
        "requestBodies": {},
    }
}

The provided custom example is not shown anywhere in swagger-ui. Instead, it still shows the default example generated from the schema.

I would like the custom example I provided to be shown here:

image

@stale
Copy link

stale bot commented Apr 16, 2022

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant