[spring] equals and hashCode for models with array type []
Created by: canaz
Description
equals() and hashCode() are not generated correctly for generatorName spring and library spring-boot. It uses Objects.equals() to compare primitive arrays.
The same model generated with generatorName java and library resttemplate uses Arrays.equals(), which ist correct.
openapi-generator version
3.3.2
OpenAPI declaration file content or url
openapi: 3.0.0
info:
version: "1"
title: "Test Api"
servers:
- url: "localhost:8282"
paths:
/test:
post:
operationId: "doTest"
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Test'
responses:
200:
description: "Ok"
400:
description: "Bad Request"
500:
description: "Internal Server Error"
components:
schemas:
Test:
type: object
required:
- name
- stream
properties:
name:
type: string
stream:
description: "byte array with binary data"
type: string
format: byte
Command line used for generation
Used pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>my-test</artifactId>
<version>1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.10.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.2.5.FINAL</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.21</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Swagger config START -->
<plugin>
<!-- fuer das Generieren aus dem swagger....yaml file-->
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>3.3.2</version>
<dependencies>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>3.3.2</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>buildSwagger</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>src/main/resources/swagger.yaml</inputSpec>
<generatorName>spring</generatorName>
<library>spring-boot</library>
<generateApis>true</generateApis>
<generateApiTests>false</generateApiTests>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModels>true</generateModels>
<generateModelTests>false</generateModelTests>
<generateModelDocumentation>false</generateModelDocumentation>
<generateSupportingFiles>true</generateSupportingFiles>
<environmentVariables>
<supportingFiles>
ApiClient.java,ApiException.java,ApiOriginFilter.java,ApiResponseMessage.java,HomeController.java,NotFoundException.java,SwaggerDocumentationConfig.java,RFC3339DateFormat.java,OAuth.java,ApiKeyAuth.java,HttpBasicAuth.java,Authentication.java
</supportingFiles>
</environmentVariables>
<configOptions>
<dateLibrary>java8</dateLibrary>
<useBeanValidation>true</useBeanValidation>
<performBeanValidation>true</performBeanValidation>
<modelPackage>com.test.model</modelPackage>
<apiPackage>com.test.api</apiPackage>
<sourceFolder>/src/main/java</sourceFolder>
<implFolder>/src/main/java</implFolder>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Steps to reproduce
Create project with given pom file and put swagger.yaml to src/main/resources