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 codegen creates incorrectly escaped parameter names #1222

Open
ghost opened this issue Oct 11, 2018 · 1 comment
Open

Rust codegen creates incorrectly escaped parameter names #1222

ghost opened this issue Oct 11, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 11, 2018

Description

Generating Rust APIs for Kubernetes or any other API using parameters names which match keywords generates invalid rust since the escaped parameters names are invalid.

The swagger file contains "continue" as a parameter. This gets escaped by the codegen to “_continue”. Unfortunately this fails to compile when used in a format macro:

error: invalid format string: invalid argument name `_continue`
     --> kubernetes/src/client/mod.rs:21864:99
      |
21864 |         let query__continue = param__continue.map_or_else(String::new, |query| format!("continue={_continue}&", _continue=query.to_string()));
      |                                                                                                   ^^^^^^^^^ invalid argument name in format string
      |
      = note: argument names cannot start with an underscore
OpenAPI declaration file content or url

https://raw.githubusercontent.com/kubernetes/kubernetes/release-1.11/api/openapi-spec/swagger.json
https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/swagger-spec/v1.json

Suggest a fix/enhancement

Could position, rather than parameter names, be used in the format string?

@wing328
Copy link
Member

wing328 commented Feb 25, 2019

@nlj21 do you still need help with this issue? Please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants