APIFairy
APIFairy copied to clipboard
@body without schema ?
Hey @miguelgrinberg great work on this lib I'm a big fan
I'm fast scaffolding an API and I think it would be useful if the body decorator could return just the request.data like:
@controller.post("/create/<string:UUID>")
@body()
@response(some_schema)
@other_responses(
{400: "dashboard creation failed", 404: "dashboard template not found"}
)
def create_uuid(json_body,UUID)
bla bla
bla bla
I think It would be useful not only for fast scaffolding but for writing test tests also of course I could be getting body the old way in the function but I will need to change the function footprint when adding @body(schema) decorator
Thanks in advance!
The purpose of the body decorator is to generate the documentation. If you don't pass a schema, then it is not possible to generate documentation, so there is no purpose to use this decorator. In that case you can just don't specify a body and get the JSON data directly in the endpoint.