OpenAPITools / OpenAPITools/openapi-generator
[REQ][rust] Use relative paths in generated code
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
The rust generator should support dropping the generated code into an arbitrary path in the crate. Currently, each generated file refers to the absolute path crate::models, forcing the use of hacks like search and replace if the generated could should be in crate::api::models, for example.
Describe the solution you'd like
Rust doesn't make this obvious but we can import the parent without the absolute path using:
use super::super::models;
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 at the Rust generator entry point and trace how generated files emit imports of crate::models; inspect the relevant generation logic or templates. Done means generated code can be placed under an arbitrary crate path such as crate::api::models without search-and-replace, with coverage verifying the relative imports.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100