代码
from apiflask import APIFlask, Schema
from apiflask.fields import String, Nested
app = APIFlask(__name__)
class InSchema(Schema):
a = String()
b = String()
@app.post('/')
@app.input(dict(
detail=Nested(InSchema),
), location='json_or_form')
def index(data):
print(data)
return 'success'
if __name__ == '__main__':
app.run()
运行
报错
{
"detail": {
"json_or_form": {
"detail": {
"_schema": [
"Invalid input type."
]
}
}
},
"message": "Validation error"
}