[BUG] [jaxrs-spec] equals/hashCode methods in POJOs ignore parent variables
Created by: PhilippParis
Description
When using allOf in the yaml OpenAPI 3.0 file the equals and hashCode methods in generated model classes ignore the parent class properties.
openapi-generator version
Tested with version 4.0, 3.3.4, 3.3.3 and current master branch
OpenAPI declaration file content or url
Command line used for generation
java -jar openapi-generator-cli.jar generate -g jaxrs-spec -i allof.yaml -o gen/
expected result
Adult.java
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Adult adult = (Adult) o;
return Objects.equals(this.children, adult.children) &&
super.equals(o);
}
actual result
Adult.java
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Adult adult = (Adult) o;
return Objects.equals(children, adult.children);
}
Suggest a fix
update equals/hashcode implementations in JavaJaxRS/spec/pojo.mustache template to match Java/pojo.mustache