from apiflask import APIFlask, Schema
from apiflask.fields import Integer, String
app = APIFlask(__name__, docs_ui='elements')
class InSchema(Schema):
id = Integer(required=True, metadata={'description': 'ID'})
project_id = String(required=True, metadata={'description': '项目ID'})
@app.patch('/json')
@app.input(InSchema, location='json')
def patch_json(data):
pass
@app.patch('/json_or_form')
@app.input(InSchema, location='json_or_form')
def patch_json_or_form(data):
pass
@app.delete('/json')
@app.input(InSchema, location='json')
def delete_json(data):
pass
@app.delete('/json_or_form')
@app.input(InSchema, location='json_or_form')
def delete_json_or_form(data):
pass
if __name__ == '__main__':
app.run()
location 为 json
时正常,为 json_or_form
时无法正确生成文档
效果