Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #1222
Closed
Open
Issue created Oct 11, 2018 by Administrator@rootContributor

Rust codegen creates incorrectly escaped parameter names

Created by: nlj21

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?

Assignee
Assign to
Time tracking