equals and hashCode methods ignore Map fields
beknazaresenbek opened this issue · 6 comments
beknazaresenbek commented
If class contains fields of type java.util.Map, they aren't being included in equals and hashCode methods. They look like this:
@Override
public boolean equals(Object object) {
if (object == this) {
return true;
}
if (object == null || getClass() != object.getClass()) {
return false;
}
return super.equals(object);
}
@Override
public int hashCode() {
return java.util.Objects.hash();
}
Is this a bug or did I miss something in settings of the plugin?
sschnabe commented
Which version do you use? Do you have an yaml-snippet for the model to reproduce it?
beknazaresenbek commented
I'm using the version 3.4.4, but I also tried testing it on latest version 4.0.2.
Here is the minified yml you can check:
openapi: 3.0.3
info:
title: Dummy api
description: Dummy api
version: 0.0.1
tags:
- name: service
paths:
/demo:
get:
description: Dummy
responses:
'200':
description: The service scopes
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceScopes'
components:
schemas:
Credential:
type: object
description: Dummy credential
properties:
dummy:
type: string
description: Dummy
ServiceScopes:
type: object
description: Dummy service scopes
additionalProperties:
$ref: '#/components/schemas/ServiceScopesEntry'
ServiceScopesEntry:
type: array
minItems: 1
items:
$ref: '#/components/schemas/Credential'
And the missing methods are in the ServiceScopes model
sschnabe commented
Thx, i'll check next week.
sschnabe commented
@beknazaresenbek please check the mentioned pr and give feedback
beknazaresenbek commented
Thank you, I think, it looks good