Skip to content

Conversation

@JorrenH
Copy link
Contributor

@JorrenH JorrenH commented Jun 3, 2025

Fixes #20747 by applying the same patch as done for other libraries in (e.g. #19713).

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) @martin-mfg (2023/08)

@JorrenH
Copy link
Contributor Author

JorrenH commented Jun 26, 2025

@wing328 Any update on when this PR might be reviewed? Thanks!

@wing328
Copy link
Member

wing328 commented Jun 29, 2025

thanks for the fix. I did some tests and the change looks good

diff --git a/src/main/java/org/openapitools/client/model/SampleObject.java b/src/main/java/org/openapitools/client/model/SampleObject.java
index 347eabe..8af2bc4 100644
--- a/src/main/java/org/openapitools/client/model/SampleObject.java
+++ b/src/main/java/org/openapitools/client/model/SampleObject.java
@@ -42,8 +42,8 @@ import org.openapitools.client.ApiClient;
   SampleObject.JSON_PROPERTY_ID,
   SampleObject.JSON_PROPERTY_SUB_OBJECT
 })
-@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-06-29T17:32:47.085305100+08:00[Asia/Hong_Kong]", comments = "Generator version: 7.15.0-SNAPSHOT")
-public class SampleObject extends HashMap<String, Object> {
+@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-06-29T17:43:34.851773600+08:00[Asia/Hong_Kong]", comments = "Generator version: 7.15.0-SNAPSHOT")
+public class SampleObject {
   public static final String JSON_PROPERTY_ID = "id";
   @javax.annotation.Nullable
   private String id;
@@ -168,20 +168,18 @@ public class SampleObject extends HashMap<String, Object> {
     SampleObject sampleObject = (SampleObject) o;
     return Objects.equals(this.id, sampleObject.id) &&
         Objects.equals(this.subObject, sampleObject.subObject)&&
-        Objects.equals(this.additionalProperties, sampleObject.additionalProperties) &&
-        super.equals(o);
+        Objects.equals(this.additionalProperties, sampleObject.additionalProperties);
   }

   @Override
   public int hashCode() {
-    return Objects.hash(id, subObject, super.hashCode(), additionalProperties);
+    return Objects.hash(id, subObject, additionalProperties);
   }

   @Override
   public String toString() {
     StringBuilder sb = new StringBuilder();
     sb.append("class SampleObject {\n");
-    sb.append("    ").append(toIndentedString(super.toString())).append("\n");
     sb.append("    id: ").append(toIndentedString(id)).append("\n");
     sb.append("    subObject: ").append(toIndentedString(subObject)).append("\n");
     sb.append("    additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");

let's give it a try

@wing328 wing328 added this to the 7.15.0 milestone Jun 29, 2025
@wing328 wing328 merged commit 304b3cb into OpenAPITools:master Jun 29, 2025
75 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] [Java] POJO with "library: native" with "additionalProperties:true" property leads to wrong generation

2 participants