OpenAPITools / OpenAPITools/openapi-generator
[BUG][RUST] Failure when attempting to generate client from Bitbucket Cloud official OpenAPI docs because "ref" is a reserved word.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
$ openapi-generator-cli generate -i https://dac-static.atlassian.com/cloud/bitbucket/swagger.v3.json?_v=2.300.22-0.1297.0 -g rust -o ./
--- trim ---
[main] WARN o.o.c.languages.AbstractRustCodegen - type cannot be used as a field/variable name. Renamed to r#type
Exception in thread "main" java.lang.RuntimeException: Could not process model 'ref'.Please make sure that your schema is correct!
at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:549)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:1235)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:527)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: java.lang.RuntimeException: reserved word ref not allowed
at org.openapitools.codegen.DefaultCodegen.escapeReservedWord(DefaultCodegen.java:1752)
at org.openapitools.codegen.DefaultCodegen.fromModel(DefaultCodegen.java:3114)
at org.openapitools.codegen.DefaultGenerator.processModels(DefaultGenerator.java:1686)
at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:544)
... 4 more
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
The input is valid, but contains a circular reference.
- Have you tested with the latest master to confirm the issue still exists?
No, only 7.2.0. Is there a way to make openapi-generator-cli use the master version???
EDIT: Marking this done because the underlying code issue still exists on master (#17368)
- 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
Failure when attempting to generate client from Bitbucket Cloud official OpenAPI docs.
openapi-generator version
7.2.0
OpenAPI declaration file content or url
https://dac-static.atlassian.com/cloud/bitbucket/swagger.v3.json?_v=2.300.22-0.1297.0
Generation Details
openapi-generator-cli generate -i https://dac-static.atlassian.com/cloud/bitbucket/swagger.v3.json?_v=2.300.22-0.1297.0 -g rust -o ./
Steps to reproduce
openapi-generator-cli generate -i https://dac-static.atlassian.com/cloud/bitbucket/swagger.v3.json?_v=2.300.22-0.1297.0 -g rust -o ./
Suggest a fix
Stop considering "ref" a reserved word.
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 the failure path in DefaultCodegen.java and the Rust generator entry point identified by AbstractRustCodegen, then review related issue #17368 because the report says the underlying problem moved there. Re-run the Bitbucket OpenAPI generation command and consider the issue complete only when the valid specification generates successfully for Rust without the reserved-word failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, rust
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100