OpenAPITools / OpenAPITools/openapi-generator
[BUG][JAVA] oneOf creates non-compilable model
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
Spec: https://docs.btcpayserver.org/API/Greenfield/v1/swagger.json
org.openapitools.client.model.InvoiceMetadata model contains an invalid import:
import org.openapitools.client.model.OneOfstringobject;
The above class doesn't exist.
openapi-generator version
6.4.0 and 6.5.0
OpenAPI declaration file content or url
https://docs.btcpayserver.org/API/Greenfield/v1/swagger.json
Generation Details
java -jar ~/Downloads/openapi-generator-cli-6.5.0-20230219.124821-1.jar generate -i https://docs.btcpayserver.org/API/Greenfield/v1/swagger.json -g java -o . --skip-validate-spec
Steps to reproduce
java -jar ~/Downloads/openapi-generator-cli-6.5.0-20230219.124821-1.jar generate -i https://docs.btcpayserver.org/API/Greenfield/v1/swagger.json -g java -o . --skip-validate-spec
Open the generated project on IDE and see the compilation error in org.openapitools.client.model.InvoiceMetadata class.
Related issues/PRs
Suggest a fix
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 by running the provided openapi-generator command with the linked BTCPay Server swagger.json and inspect the generated InvoiceMetadata model. Trace how the Java generator handles the oneOf schema and creates imports. Done means the generated project compiles and no longer imports the nonexistent OneOfstringobject class.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100