-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
[Rust Reqwest] Fixes Enums in Query Parameters via Causing Compilation Failure #22281
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
Conversation
|
Hey folks @frol @farcaller @richardwhiuk @paladinzh anyone willing to review this? |
…n Failure (OpenAPITools#22281) * [Rust Reqwest] Fixes Enums in Query Parameters via Causing Compilation Failure * regen
|
Unfortunately this PR introduces a pretty serious runtime bug that's probably breaking enum query parameters for everyone using the generated clients. The problem is that pub enum SortOrder {
#[serde(rename = "asc")]
Ascending,
#[serde(rename = "desc")]
Descending,
}You'd expect a URL like This is because let sort = SortOrder::Ascending;
serde_json::to_string(&sort).unwrap() // "\"asc\"" - wrong!
sort.to_string() // "asc" - correctI get that the original compilation error needed fixing, but this change essentially trades a compile-time error for a runtime bug that silently breaks every API call using enum query parameters. Our production client is completely broken because of this. This PR really needs to be reverted. The original type inference issue is real and needs a proper solution, but Would it be possible to revert this and then we can figure out the right approach to fix the compilation issue without breaking query parameters? |
|
@thesn10 let me see if I can address this ASAP |
|
I have a fix I am testing. |
|
@thesn10 fix is in this PR: #22683 test to prevent this from regressing again: https://github.com/OpenAPITools/openapi-generator/pull/22683/files#diff-154b2d8c634a8e04936d2bb95522716bcf8502b6e226d035f48a87d88a4218c2R119 |
|
@winrid wow, thanks for fixing it that fast. I really appreciate your effort! |
|
@thesn10 well I was very embarrassed! :) |
Fixes #22280
Fixes our sdk not compiling: https://github.com/fastcomments/fastcomments-rust
@dsteeley @jacob-pro
I had to add tests because existing tests did not cover this scenario.
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)"fixes #123"present in the PR description)