Skip to content
New issue

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

@body without schema ? #46

Open
juanitomint opened this issue May 6, 2022 · 1 comment
Open

@body without schema ? #46

juanitomint opened this issue May 6, 2022 · 1 comment
Labels
question Further information is requested

Comments

@juanitomint
Copy link

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!

@miguelgrinberg
Copy link
Owner

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.

@miguelgrinberg miguelgrinberg added the question Further information is requested label May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants