OpenAPITools / OpenAPITools/openapi-generator
[BUG] [Spring][4.3.0] allOf -> syntax error on generated code
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)?
-
What's the version of OpenAPI Generator used?
-
Have you search for related issues/PRs?
-
What's the actual output vs expected output?
-
[Optional] Bounty to sponsor the fix (example)
Description
syntax error on generated code
openapi-generator version
4.3.0, 4.2.3, 4.2.0
OpenAPI declaration file content or url
schemas:
Foo:
type: object
properties:
name:
type: string
Bar:
allOf:
- $ref: '#/components/schemas/Foo'
type: object
properties:
status:
type: string
generates
@Override
public int hashCode() {
return Objects.hash(statussuper.hashCode());
}
which causes the JDK 12 compiler:
.../Bar.java:59: error: cannot find symbol
return Objects.hash(statussuper.hashCode());
^
symbol: variable statussuper
location: class Bar
the generated code misses a 'komma'
Command line used for generation
generatorName = "spring"
configOptions = [ java12: "true", library: "spring-boot", dateLibrary: "java12",
delegatePattern:"true", unhandledException: "true"
]
Steps to reproduce
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 supplied OpenAPI declaration and Spring generator configuration, then reproduce the generation and inspect the generated Bar.java hashCode method. Done means the generated Java code compiles and no longer references the malformed statussuper expression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, spring
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100