Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #5587
Closed
Open
Issue created Mar 12, 2020 by Administrator@rootContributor

[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

Assignee
Assign to
Time tracking