Search code examples
swagger-uiopenapi

How to render the response body in Swagger UI?


I have a simple GET API. When I click "Try it out" and then "Execute" in Swagger UI, I can see the request reaching the server and getting processed successfully with HTTP status code 200 - ascertained by looking into the server logs.

I would like to see the response body in Swagger UI. What addition or change needs to be done to the OpenAPI YAML spec? I'm using OpenAPI 3.0.3.


Solution

  • By enabling CORS in my flask app, I have managed to overcome the issue ...

    From shell prompt ...

    pip install -U flask-cors
    

    Inside app.py ...

    ...
    from flask_cors import CORS
    ...
    app = Flask(__name__)
    CORS(app)
    ...