From 487b856c11c38edd865aa4e673dc940521ca001c Mon Sep 17 00:00:00 2001 From: s-jepsen <56965038+s-jepsen@users.noreply.github.com> Date: Thu, 15 Feb 2024 05:27:33 +0100 Subject: [PATCH] Fix java-spring equals generation (#17837) --- .../src/main/resources/JavaSpring/pojo.mustache | 2 +- .../src/main/java/org/openapitools/model/BarRef.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache index 4e18d922db94..9e3cb2ed6f34 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -282,7 +282,7 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}} {{/-last}}{{/vars}}{{#additionalPropertiesType}} && Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/additionalPropertiesType}}{{#parent}} && super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} - return true;{{/hasVars}} + return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}} }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} private static boolean equalsNullable(JsonNullable a, JsonNullable b) { diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java index bb5ed0f58eeb..4faba477210b 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/BarRef.java @@ -80,7 +80,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - return true; + return super.equals(o); } @Override