OpenAPITools / OpenAPITools/openapi-generator
[BUG] Invalid code: missing comma in hashCode()
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
When I create code from the spec below, the result's hashCode() looks like this:
@Override
public int hashCode() {
return Objects.hash(foosuper.hashCode());
}
so there is a missing comma between foo and super.hashCode().
openapi-generator version
It works fine with 4.2.2 and fails with 4.2.3 and 4.3.0
OpenAPI declaration file content or url
swagger: "2.0"
info:
title: Issue
version: "1.0.0"
paths:
"/childs":
get:
summary: get list of childs
operationId: listChilds
produces:
- application/json
responses:
'200':
description: OK
schema:
$ref: '#/definitions/Child'
definitions:
Parent:
type: object
properties:
bar:
type: string
Child:
allOf:
- $ref: '#/definitions/Parent'
- type: object
properties:
foo:
type: boolean
How to build
openApiGenerate {
generatorName = "java"
inputSpec = "$project.rootDir/networking-client-lib/specs/plugin_interface.yaml".toString()
outputDir = "$buildDir/java".toString()
modelPackage = "foo.bar"
configOptions = [
booleanGetterPrefix: "is"
]
systemProperties = [
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
Reproduce the issue with the supplied Swagger 2.0 declaration and the Gradle openApiGenerate entry point using the Java generator. Compare generated output between versions 4.2.2 and 4.2.3; done means the Child model's generated hashCode() preserves a comma between inherited and local properties.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100