OpenAPITools / OpenAPITools/openapi-generator
[BUG] [JAVA] Generic type generates invalid equals body
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
I have spec generated from springfox with definition with name SomeObject«SomeNestedObject» and it generates equals method of this object containing this line
SomeObjectSomeNestedObject someObject«SomeNestedObject» = (SomeObjectSomeNestedObject) o;
which cannot compile because of «» characters
openapi-generator version
4.1.1
OpenAPI declaration file content or url
{
"swagger": "2.0",
"info": {
"title": "Test"
},
"host": "com.test",
"basePath": "/",
"paths": {
"/api/test/v1": {
"get": {
"operationId": "getUsingGET_1",
"produces": [
"*/*"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/SomeObject«SomeNestedObject»"
}
}
},
"deprecated": false
}
}
},
"definitions": {
"SomeObject«SomeNestedObject»": {
"type": "object",
"properties": {
"id": {
"description": "id",
"type": "string"
}
},
"title": "SomeObject«SomeNestedObject»"
}
}
}
Command line used for generation
I'm using org.openapitools:openapi-generator-gradle-plugin:4.1.1
gradlew openApiGenerate
build.gradle
openApiGenerate {
generatorName = 'java'
library = 'retrofit2'
configOptions = [
dateLibrary: "legacy",
supportJava6: "true",
parcelableModel: 'true'
]
}
Related issues/PRs
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 OpenAPI JSON and the build.gradle openApiGenerate configuration using the Java generator with Retrofit2. Trace the Java model-generation entry point that emits equals; done means the generated model contains valid Java identifiers and compiles without the «» characters.
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
- 35/100