-
-
Notifications
You must be signed in to change notification settings - Fork 228
Delete request with body #545
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
Comments
Sounds good to me. IMO a client shouldn't be prescriptive about an Server's API implementation since it's usually not up to the client 😬. Happy to accept a PR that makes this a bit more flexible. |
Cool :) |
Generally folks will fork the repo, make changes on their fork, then make a PR back upstream. |
#547]. Thanks @MalteBecker! Co-authored-by: Dylan Anthony <[email protected]>
Feature committed in #547 |
Is your feature request related to a problem? Please describe.
In our API we handle a lot of items and came to a point where we want to delete a lot of this items at the same time. Our first approach was to call a DELETE on every single ID. This works, but it is very slow.
Then we added a new delete functionality where we have only one DELETE call with a json body with a lot of IDs. I know, that this is not the "normal" way to do it, but it works fine and is not forbidden in openapi I think.
The problem with the openapi-python-client is, that it creates an httpx.delete call. And the httpx library does not allow a body for a DELETE. In the httpx github I found this thread: encode/httpx#1587
So a DELETE with a body is possible if you use httpx.request instead of http.delete.
Describe the solution you'd like
After a short look into the openapi-python-client code I have an easy solution for this problem. I just changed every httpx call into a httpx.request call and added the endpoint.method in the _get_kwargs method.
Here are my changes:
endpoint_module.py.jinja.txt
For me this works pretty good and does not change any other behavior. If nothing speaks against it I would like to PR this change.
The text was updated successfully, but these errors were encountered: