OpenAPITools / OpenAPITools/openapi-generator
[BUG][RUST] Description
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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
Query parameters with deep object and specific properties are not being fully qualified in the api function in Rust. Here is a snippet of what's causing the issue:
name: page
in: query
required: false
description: "In a list return, the data associated with the page number and size returned. 20 results per page, page 2 would be `page[size]=20&page[number]=2`"
explode: true
style: deepObject
schema:
type: object
properties:
number:
type: number
description: The page to jump to
size:
type: number
description: The number of resources returned per page.
This generates the following error:

This struct is properly generated, it's just not fully qualified
openapi-generator version
6.0.0
OpenAPI declaration file content or url
https://drive.google.com/file/d/16DDHJZrBgT0OrVbwO85VtmX4RAr54Qoi/view?usp=sharing
Generation Details
./run-in-docker.sh generate -i /gen/public-api.yml -g rust -o /gen/out/openapi
Steps to reproduce
Run the generator, and attempt to compile the code with the rust compiler.
Related issues/PRs
Suggest a fix
It appears the bug is caused here:
modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache -> line 20 col 386
It appears that it only sets up the fully qualified import if it's a body parameter, not a query parameter. In the case of explicit parameters however, it assumes that it would be a core type. I'm not sure how to detect if something is a generated parameter or not however.
cc @nshaaban-cPacket since I know you're working on some rust generator code right now.
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 modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache, especially line 20, and reproduce the issue with the provided run-in-docker.sh command and OpenAPI declaration. Compile the generated Rust client and inspect the API function's deep-object query parameter handling. Done means the generated code compiles and the explicit query properties are fully qualified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100