[BUG] [spring] Version 4.2.3 introduced bug in spring gen hashCode method - cannot find symbol
Created by: dkirrane
Description
spring-boot code generator fails in 4.2.3 with Error:(80,29) java: cannot find symbol
Here is the hashcode method generated. namesuper
cannot be found.
Seems to be an issue with the template used to generate the hashcode method
@Override
public int hashCode() {
return Objects.hash(id, namesuper.hashCode());
}
I think what it is supposed to generate is:
@Override
public int hashCode() {
return Objects.hash(id, name) + super.hashCode();
}
openapi-generator version
4.2.3
OpenAPI declaration file content or url
openapi: 3.0.2
info:
title: test
version: '1.0'
servers:
- url: 'http://localhost:3000'
paths:
/test/:
post:
summary: ''
operationId: post-test
responses:
'200':
description: OK
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Test'
description: ''
components:
schemas:
Test:
allOf:
- $ref: '#/components/schemas/Parent'
title: Test
type: object
properties:
id:
type: string
name:
type: string
required:
- id
description: ''
Parent:
title: Parent
type: object
properties:
foo:
type: string
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.2.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/api.yaml</inputSpec>
<output>${project.build.directory}/generated-sources/openapi</output>
<generatorName>spring</generatorName>
<generateSupportingFiles>true</generateSupportingFiles>
<configOptions>
<library>spring-boot</library>
<interfaceOnly>true</interfaceOnly>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Steps to reproduce
mvn clean compile