代码
from apiflask import APIFlask, Schema
from apiflask.fields import Integer, String, Nested
app = APIFlask(__name__, docs_ui='elements')
class UserSchema(Schema):
id = Integer()
name = String()
@app.get('/a')
@app.output(dict(
user=Nested(UserSchema),
))
def a():
pass
@app.get('/b')
@app.output(dict(
user=Nested(Schema.from_dict({'id': Integer(), 'name': String()})), # 这样子生成的文档有问题
))
def b():
pass
if __name__ == '__main__':
app.run()
结果
功能没问题,就是API文档不行