-
Notifications
You must be signed in to change notification settings - Fork 26
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
2xx codes treated as error response #70
Comments
It's stronger than that. The 2xx range is literally defined as "Successful" in RFC 9110, which defines the semantics of the HTTP protocol. I use |
Would you be willing to pose a PR for this? |
Not sure if I have the time. It also depends on whether we settle on this code generator, or another one. Would it be possible to have the dependencies in Also the use of I know this is a bit off-topic for this particular Github issue, but the answers may directly influence the answer to your question. |
Describe the bug
In the HTTP world, 2xx response codes tend to be treated as success. For instance, 201 is an extension of 200 which indicates the creation of a resource.
Problem
This function here dictates what code is acceptable as a response code. It will default to 200 or the first 2xx code in the list of defined responses and there is no way to specify which responses are acceptable.
openapi-python-generator/src/openapi_python_generator/language_converters/python/service_generator.py
Line 196 in 390ce1a
In other words, there's no way for the service provider to dictate multiple response codes as "good"
An alternative to this problem is to allow the client to decide which response codes to treat as error but the current implementation forbids that and instead throws an exception on the behalf of the client if that singular response code is not observed. The workaround for the service is to always return 200 OK
Expected behavior
Either:
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: