Skip to content

[BUG] [Rust] Generated client does not compile for kebab-cased path parameters #20295

@ranger-ross

Description

@ranger-ross

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When building openapi schema that use kebab case in path parameters (ie. /v1/pet/pet-id) the Rust client does not compile

86 | ...   let local_var_uri_str = format!("{}/pet/{pet-id}", local_var_configuration.base_path, pet-id=pet_id);
   |                                               -   ^ expected `'}'` in format string
   |                                               |
   |                                               because of this opening brace
openapi-generator version
> openapi-generator-cli version
7.10.0
OpenAPI declaration file content or url

https://gist.github.com/ranger-ross/c2f6fd836c5bb3196c5d9c18eff712f4

Generation Details
generatorName: rust
library: reqwest-trait
additionalProperties:
  supportMiddleware: true
  preferUnsignedInt: true
  topLevelApiClient: true
  useBonBuilder: true
  mockall: true
Steps to reproduce
  1. generate the client using the schema and config provided above.
  2. cd to the output directory and run cargo build
Related issues/PRs

none

Suggest a fix

I believe that params should be normalized to underscore_snake_case to avoid compilation issues.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions