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] Complex/optional parameter encodings are not handled correctly #8173

Open
BartMassey opened this issue May 10, 2018 · 2 comments
Open

Comments

@BartMassey
Copy link

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.

@bjgill
Copy link
Contributor

bjgill commented May 14, 2018

Thanks for the report. I've been able to reproduce with rust and rust-server.

It looks as if there are three problems:

  • rust has problems with nested lists
  • Both generators have problems with collectionFormat.
  • rust-server assumes the existence of the info.version key, and throws a null pointer exception if it is not present.

Sorry, something went wrong.

@BartMassey
Copy link
Author

I think rust's problem with nested lists is just a symptom of the collectionFormat problem. If the code generator understood the format of the expected list, it could do a reasonable job of gluing something together.

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