OpenAPITools / OpenAPITools/openapi-generator
[BUG] Gradle plugin produces uncompilable code for GitHub definition file.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- [yes] Have you provided a full/minimal spec to reproduce the issue?
- [ think so ] Have you validated the input using an OpenAPI validator (example)?
The domain has expired. Is this your domain? Renew now
I tried this validator with this cut-down schema and it looked like it was happy, but I'm not an expert.
- [yes ] Have you tested with the latest master to confirm the issue still exists?
- [ yes ] Have you searched for related issues/PRs?
- [ yes ] What's the actual output vs expected output?
Expected: There should be some fields in all kotlin data classes.
Actual: None
Description
Generating the GitHub API schema for Kotlin results in a data class without fields, which doesn't compile. I've extracted and pared down a single endpoint in the gist.
In data.class.mustache, allVars is empty, even though hasVars is true and nonNullableVars, optionalVars, and readWriteVars all contain (in the example Gist) reviewers and teamReviewers.
openapi-generator version
My target version is 7.12.0 but it happens with :latest too, see above.
OpenAPI declaration file content or url
Generation Details
$ curl -o https://gist.githubusercontent.com/sleekweasel/bd91330c7c437d1641a52761d18d8d60/raw/a9fcef66c20938b762944f3d938cbcee1f483fc5/api.chopped.json
$ docker run -v $PWD:$PWD openapitools/openapi-generator-cli:v7.12.0 generate -i api.chopped.json -g kotlin -o $PWD
$ grep -A2 data src/main/kotlin/org/openapitools/client/models/PullsRequestReviewersRequest.kt
data class PullsRequestReviewersRequest (
) {
Steps to reproduce
See above. There are no entries in data class, which means it won't compile.
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 with the cut-down schema in the linked gist and reproduce the Kotlin output using the provided Docker generation command. Inspect data.class.mustache, especially the allVars, hasVars, nonNullableVars, optionalVars, and readWriteVars values. Done means PullsRequestReviewersRequest.kt contains the expected reviewers and teamReviewers fields and compiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100