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

In rust code generation trait objects should contain an explicit dyn #12383

Open
PatrickDekker98 opened this issue Apr 4, 2024 · 1 comment

Comments

@PatrickDekker98
Copy link

Q&A (please complete the following information)

  • OS: Fedora 39
  • Browser: Firefox
  • Version:
  • Method of installation: docker
  • Swagger-Editor version: [e.g. 3.10.0]
  • Swagger/OpenAPI version: [Swagger 2.0, ]

Content & configuration

I will not share our yaml, as it can contain confidential information I am not allowed to share.

Describe the bug you're encountering

I generated a rust client and it contains a lot of warnings, it shows like this:

warning: trait objects without an explicit `dyn` are deprecated
   --> src/apis/client.rs:197:31
    |
197 |   pub fn tools_api(&self) -> &::apis::ToolsApi{
    |                               ^^^^^^^^^^^^^^^^
    |
    = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
    |
197 |   pub fn tools_api(&self) -> &dyn (::apis::ToolsApi){
    |                               +++++                +

To reproduce...

Steps to reproduce the behavior:

  1. Make a yaml with a circular reference within its models
  2. Generate a rust client
  3. Try to build
  4. See compiler error

Expected behavior

I expect the rust client generator to generate working code.

Additional context or thoughts

@char0n
Copy link
Member

char0n commented Apr 24, 2024

Hi @PatrickDekker98,

Transfering this issue to swagger-codegen repo.

@char0n char0n transferred this issue from swagger-api/swagger-editor Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants