swagger-api / swagger-api/swagger-codegen
[Rust] Complex/optional parameter encodings are not handled correctly
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I am dealing with a Swagger 2.0 API which needs to accept an optional parameter consisting of an unexploded comma-separated list of pipe-separated lists of values. The Rust mustache templates really don't handle any of this, so I can't use the generated code: it doesn't even compile.
Swagger-codegen version
Current git master, but seems to apply to all versions.
Swagger declaration file content or url
https://gist.github.com/BartMassey/b58a73520d5ca1b66a6486d4fb345fc6
Command line used for generation
java -jar swagger-codegen-cli.jar generate \
-i swagger-params.json -l rust -o demo
Steps to reproduce
Generate the Rust API as described above. cd to demo/ and cargo build. Note that the code does not compile. Inspect the code to see that it is not generating anything usable for the parameter.
Related issues/PRs
See issues #8169 and #8171 for more information on my use case.
Suggest a fix/enhancement
rust/api.mustache needs to be expanded to handle the full set of parameter possibilities. I'm not quite sure how to do this, but I might give it a try at some point if I can't get help here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with rust/api.mustache and the Swagger declaration linked in the issue. Run the stated swagger-codegen generation command, then cargo build in demo/ to reproduce the compilation failure and inspect the generated parameter handling. Done means the generated Rust project builds and handles the described optional, unexploded comma- and pipe-separated parameter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, rust
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100