swagger-api / swagger-api/swagger-codegen

[RUST] Generated code does not compile on 2.3.1

Open
#8,396 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I generated a rust client using swagger codegen and it almost compiles but there's a few minor issues. I fixed them by hand but I wanted to point them out so future people can know/fix this.

Swagger-codegen version

2.3.1

Swagger declaration file content or url

https://gist.github.com/cholcombe973/1db5c030032b8b14554afca07d6577be

Command line used for generation

I used docker to generate the client library
./run-in-docker.sh generate -i isilon_swagger.json -l rust -o /gen/out/rust-isilon

Steps to reproduce

cargo check

Suggest a fix/enhancement

https://github.com/swagger-api/swagger-codegen/blob/v2.3.1/modules/swagger-codegen/src/main/resources/rust/api.mustache#L71 This line shouldn't be &body. it should be &{{name}} I think. It needs to pass in the struct referenced in the function declaration. &body doesn't exist anywhere.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect modules/swagger-codegen/src/main/resources/rust/api.mustache at line 71 and compare the generated function declaration with the argument passed to it. Reproduce the report with the provided Swagger declaration and Docker command, then run cargo check; done means the generated Rust client compiles without the undefined body reference.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.