We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello all,
I have created a very simple demo to demonstrate that the return values are not shown in swagger-ui:
Requirements.txt:
flask-apispec flask-marshmallow flask-restful
Versions:
apispec==3.3.0 Flask==1.1.1 flask-apispec==0.8.6 flask-marshmallow==0.11.0 Flask-RESTful==0.3.8 marshmallow==3.5.0 webargs==5.5.3
Code:
from apispec import APISpec from apispec.ext.marshmallow import MarshmallowPlugin from flask import Flask from flask_apispec import use_kwargs, marshal_with, FlaskApiSpec, MethodResource from flask_marshmallow import Marshmallow from flask_restful import Api from marshmallow import fields app = Flask(__name__) api = Api(app) ma = Marshmallow(app) class Todo: def __init__(self, todo_id, description): self.todo_id = todo_id self.description = description def __getitem__(self, item): return getattr(self, item) class TodoInputSchema(ma.Schema): token = fields.Str() class TodoSchema(ma.Schema): class Meta: fields = ("todo_id", "description") class Demo(MethodResource): def __init__(self): super(Demo, self).__init__() @use_kwargs(TodoInputSchema) @marshal_with(TodoSchema, code=200) def get(self): schema = TodoSchema() todo = Todo(1, "get Milk") return schema.dump(todo) api.add_resource(Demo, '/') app.config.update({ 'APISPEC_SPEC': APISpec( title='todo', version='v1', plugins=[MarshmallowPlugin()], openapi_version='3.0.2' ), 'APISPEC_SWAGGER_URL': '/swagger/', }) docs = FlaskApiSpec(app) docs.register(Demo) if __name__ == '__main__': app.run(debug=True, port=3333)
Run: http://127.0.0.1:3333/swagger-ui
Why is the return object not shown in Swagger UI?
Many Thanks, Houman
The text was updated successfully, but these errors were encountered:
Hi @houmie
I've ran into same issue today, when using openapi_version='3.0.2' in my new project.
openapi_version='3.0.2'
The reason is that OpenAPI Schema 3.0 has different responses format comparing to Swagger 2.0, while flask-apispec still produces old response format.
flask-apispec
And most interesting, that issue already fixed in #153, but unfortunately that MR is still not merged into the master.
master
Sorry, something went wrong.
Hi @sloria,
Why are you not merging #153 ?
Thanks,
No branches or pull requests
Hello all,
I have created a very simple demo to demonstrate that the return values are not shown in swagger-ui:
Requirements.txt:
Versions:
Code:
Run:
http://127.0.0.1:3333/swagger-ui
Why is the return object not shown in Swagger UI?
Many Thanks,
Houman
The text was updated successfully, but these errors were encountered: