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

[rust][client] fix breaking regression introduced by #10432 #10720

Merged
merged 2 commits into from
Nov 11, 2021
Merged

[rust][client] fix breaking regression introduced by #10432 #10720

merged 2 commits into from
Nov 11, 2021

Conversation

Foorack
Copy link
Contributor

@Foorack Foorack commented Oct 27, 2021

#10432

This change forgot enum structures, which causes the compiler to throw errors for "the trait Default is not implemented for MyEnum". This change implements the Default trait to the enum template.

This has been tested to work and fixes the problem.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    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*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (5.3.0), 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05)

This change forgot enum structures, which causes the compiler to throw errors for "the trait `Default` is not implemented for MyEnum".
This change implements the Default trait to the enum template.
aeneasr added a commit to ory/sdk that referenced this pull request Nov 1, 2021
@xli
Copy link

xli commented Nov 3, 2021

+1 facing the issue.

@wing328
Copy link
Member

wing328 commented Nov 11, 2021

Tested locally with updated samples and the result is good:

   Compiling reqwest v0.9.24
   Compiling petstore-reqwest v1.0.0 (/Users/williamcheng/Code/openapi-generator/samples/client/petstore/rust/reqwest/petstore)
    Finished test [unoptimized + debuginfo] target(s) in 1m 27s
     Running unittests (/Users/williamcheng/Code/openapi-generator/samples/client/petstore/rust/target/debug/deps/petstore_reqwest-64fb8d120c068931)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/pet_tests.rs (/Users/williamcheng/Code/openapi-generator/samples/client/petstore/rust/target/debug/deps/pet_tests-a306d64f90bd2c91)

running 1 test
test test_pet ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

   Doc-tests petstore-reqwest

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Thanks for the fix.

@wing328 wing328 merged commit 30e1ba7 into OpenAPITools:master Nov 11, 2021
@wing328 wing328 added this to the 5.3.1 milestone Nov 11, 2021
@wing328
Copy link
Member

wing328 commented Nov 11, 2021

@Foorack when you've time, I wonder if you can contribute a test under samples/client/petstore/rust/reqwest/ to help catch the issue moving forward. Thanks in advance.

@wing328 wing328 changed the title fix(rust, client): fix breaking regression introduced by #10432 [rust][client] fix breaking regression introduced by #10432 Dec 19, 2021
@aeneasr
Copy link
Contributor

aeneasr commented Feb 5, 2022

This introduced another regression that can happen:

error[E0277]: the trait bound `UiNodeAttributes: Default` is not satisfied
   --> src/models/ui_node.rs:18:5
    |
15  | #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
    |                                   ------- in this derive macro expansion
...
18  |     pub attributes: Box<crate::models::UiNodeAttributes>,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `UiNodeAttributes`
    |
    = note: required because of the requirements on the impl of `Default` for `Box<UiNodeAttributes>`
note: required by `std::default::Default::default`
    = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)

See also: #10845

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants