swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

Recursive types in rust can't compile.

Open PatrickDekker98 opened this issue 1 year ago • 2 comments

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

There are a couple of issues with the rust code generation. Firstly when there is a recursive type, in our case three structs that reference each other. The rust compiler complains that there is an infinite size. This can be easily solved by adding a Box<> around those members.

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

PatrickDekker98 avatar Apr 04 '24 13:04 PatrickDekker98

Ive tried this on the docker build and on 'editor-next'

PatrickDekker98 avatar Apr 04 '24 13:04 PatrickDekker98

Hi @PatrickDekker98,

I'm transferring this issue to swagger-codegen.

char0n avatar Apr 24 '24 19:04 char0n