Skip to content

[BUG] [JAVA] Generic type generates invalid equals body #3808

@lsuski

Description

@lsuski

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

#1157

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions