-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[REQ][Rust Client] New Success types lead to exessive code when using the API #6650
Comments
Hi @HenningHolmDE , I am the culprit for this PR, but I agree. After discussion with @wing328 we will propose the feature as optionnal, adding a CLI option. |
Hi @bcourtine , After giving this some thought: Even when hadnling multiple 2xx, why do we need |
I let this default values to avoid an empty enum for methods that only return a success return code without body. It can probably be improved. I will look at it later. |
What downside would an empty enum entry for "disembodied results" have? pub enum GetSomethingSuccess {
Status200(crate::models::GetSomethingResponse),
Status201,
} As |
I agree an unexpected value error would be a good tradeoff 👍 But the empty enum could occur. |
The PR should fix the problem. |
@bcourtine I tested a local build of fae63e3 against my code and both variants ( Well done! 👍 Thinking about the name of the config option: As the OpenAPI Specifications names them "responses" (Schema: Responses Object), maybe |
Good idea: just renamed the param to |
Is your feature request related to a problem? Please describe.
Before #6481 has been merged this morning, my test code for using the 5.0.0 SNAPSHOT with
supportAsync: true
anduseSingleRequestParameter: true
looked something like this:For the same behaviour, I now have to write:
In my oppinion, the code has become unnecessarily complex here.
Describe the solution you'd like
I am not sure if I overlooked a way for a simpler approach, but it would be nice to only deal with one layer of error handling when using the API.
Describe alternatives you've considered
As this is only related to template code, I can of course change this back to the previous behaviour using a customized templates, but I would like to stick to the default templates as far as possible.
Additional context
I am now using SNAPSHOT version 5.0.0-20200613.071037-272.
Thanks for looking into this! If I can give a hand finding a solution, I would be glad to do so.
The text was updated successfully, but these errors were encountered: