[management] Code generation: update services and models - #2067
AdyenAutomationBot wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces several new models and API services to support terminal theme management and client certificate generation, while also updating existing payment method models with new fields and documentation. I have identified a high-severity issue regarding incorrect equality and hash code implementation for the List<byte[]> field in ClientCertificateWithChain and a medium-severity inconsistency where the name field in ThemeUpdateRequest is typed as Object instead of String. Please address these concerns to ensure correct object comparison and type consistency across the SDK.
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) { | ||
| return true; | ||
| } | ||
| if (o == null || getClass() != o.getClass()) { | ||
| return false; | ||
| } | ||
| ClientCertificateWithChain clientCertificateWithChain = (ClientCertificateWithChain) o; | ||
| return Objects.equals(this.caChain, clientCertificateWithChain.caChain) | ||
| && Objects.equals(this.isSetCaChain, clientCertificateWithChain.isSetCaChain) | ||
| && Objects.equals(this.id, clientCertificateWithChain.id) | ||
| && Objects.equals(this.isSetId, clientCertificateWithChain.isSetId) | ||
| && Arrays.equals(this.leaf, clientCertificateWithChain.leaf) | ||
| && Objects.equals(this.isSetLeaf, clientCertificateWithChain.isSetLeaf) | ||
| && Objects.equals(this.serialNumber, clientCertificateWithChain.serialNumber) | ||
| && Objects.equals(this.isSetSerialNumber, clientCertificateWithChain.isSetSerialNumber) | ||
| && Objects.equals(this.subjectDN, clientCertificateWithChain.subjectDN) | ||
| && Objects.equals(this.isSetSubjectDN, clientCertificateWithChain.isSetSubjectDN); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash( | ||
| caChain, | ||
| isSetCaChain, | ||
| id, | ||
| isSetId, | ||
| Arrays.hashCode(leaf), | ||
| isSetLeaf, | ||
| serialNumber, | ||
| isSetSerialNumber, | ||
| subjectDN, | ||
| isSetSubjectDN); | ||
| } |
There was a problem hiding this comment.
The caChain field is of type List<byte[]>. In Java, calling Objects.equals() on a List compares its elements using their equals() method. For byte[] arrays, equals() performs reference equality (==) rather than content equality. This means two ClientCertificateWithChain instances with identical certificate chains (same byte values but different array instances) will be considered unequal.
Similarly, Objects.hash(caChain) computes the hash code using the default identity hash codes of the byte[] elements, leading to inconsistent hash codes for identical content.
To fix this, we should implement custom helper methods to compare and hash the list of byte arrays by content.
private boolean equalCaChains(List<byte[]> list1, List<byte[]> list2) {
if (list1 == list2) {
return true;
}
if (list1 == null || list2 == null) {
return false;
}
if (list1.size() != list2.size()) {
return false;
}
for (int i = 0; i < list1.size(); i++) {
if (!Arrays.equals(list1.get(i), list2.get(i))) {
return false;
}
}
return true;
}
private int hashCodeCaChain(List<byte[]> list) {
if (list == null) {
return 0;
}
int result = 1;
for (byte[] element : list) {
result = 31 * result + Arrays.hashCode(element);
}
return result;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ClientCertificateWithChain clientCertificateWithChain = (ClientCertificateWithChain) o;
return equalCaChains(this.caChain, clientCertificateWithChain.caChain)
&& Objects.equals(this.isSetCaChain, clientCertificateWithChain.isSetCaChain)
&& Objects.equals(this.id, clientCertificateWithChain.id)
&& Objects.equals(this.isSetId, clientCertificateWithChain.isSetId)
&& Arrays.equals(this.leaf, clientCertificateWithChain.leaf)
&& Objects.equals(this.isSetLeaf, clientCertificateWithChain.isSetLeaf)
&& Objects.equals(this.serialNumber, clientCertificateWithChain.serialNumber)
&& Objects.equals(this.isSetSerialNumber, clientCertificateWithChain.isSetSerialNumber)
&& Objects.equals(this.subjectDN, clientCertificateWithChain.subjectDN)
&& Objects.equals(this.isSetSubjectDN, clientCertificateWithChain.isSetSubjectDN);
}
@Override
public int hashCode() {
return Objects.hash(
hashCodeCaChain(caChain),
isSetCaChain,
id,
isSetId,
Arrays.hashCode(leaf),
isSetLeaf,
serialNumber,
isSetSerialNumber,
subjectDN,
isSetSubjectDN);
}| public static final String JSON_PROPERTY_NAME = "name"; | ||
| private Object name; |
There was a problem hiding this comment.
The name field in ThemeUpdateRequest is defined as Object, whereas in all other theme-related models (CreateThemeRequest, ThemeSummary, ThemeWithAssetDetails, UpdateThemeResponse), it is typed as String. This inconsistency reduces type safety and makes the SDK harder to use. Consider updating the OpenAPI specification or generator configuration to ensure name is consistently typed as String.
550d186 to
4660358
Compare
4660358 to
0ccfa1f
Compare
|



This PR contains the automated changes for the
managementservice.The commit history of this PR reflects the
adyen-openapicommits that have been applied.