pyeve / eve-swagger

Swagger extension for Eve-powered RESTful APIs
http://python-eve.org
Other
154 stars 43 forks source link

Examples not shown in Swagger-ui #116

Open javierdvalle opened 3 years ago

javierdvalle commented 3 years ago

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[bot] commented 2 years ago

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.