Skip to content

Commit a6b8dfd

Browse files
AdyenAutomationBotAdyenAutomationBotgcatanese
authored
Implement stricter oneOf deserialization (#1544)
* false[adyen-sdk-automation] automated change * style(fmt): code formatted * Revert PayByBankPlaidInfo * style(fmt): code formatted --------- Co-authored-by: AdyenAutomationBot <AdyenAutomationBot 38424300+AdyenAutomationBot@users.noreply.github.com> Co-authored-by: gcatanese <gcatanese@yahoo.com>
1 parent 65fffcb commit a6b8dfd

23 files changed

+1147
-574
lines changed

src/main/java/com/adyen/model/balanceplatform/BankAccountAccountIdentification.java

Lines changed: 96 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
8282
boolean attemptParsing = true;
8383
if (attemptParsing) {
8484
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
85-
boolean typeMatch =
86-
Arrays.stream(AULocalAccountIdentification.TypeEnum.values())
87-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
85+
boolean typeMatch = false;
86+
if (tree.findValue("type") != null) {
87+
typeMatch =
88+
Arrays.stream(AULocalAccountIdentification.TypeEnum.values())
89+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
90+
}
8891

8992
if (typeMatch) {
9093
deserialized =
@@ -106,9 +109,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
106109
boolean attemptParsing = true;
107110
if (attemptParsing) {
108111
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
109-
boolean typeMatch =
110-
Arrays.stream(BRLocalAccountIdentification.TypeEnum.values())
111-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
112+
boolean typeMatch = false;
113+
if (tree.findValue("type") != null) {
114+
typeMatch =
115+
Arrays.stream(BRLocalAccountIdentification.TypeEnum.values())
116+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
117+
}
112118

113119
if (typeMatch) {
114120
deserialized =
@@ -130,9 +136,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
130136
boolean attemptParsing = true;
131137
if (attemptParsing) {
132138
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
133-
boolean typeMatch =
134-
Arrays.stream(CALocalAccountIdentification.TypeEnum.values())
135-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
139+
boolean typeMatch = false;
140+
if (tree.findValue("type") != null) {
141+
typeMatch =
142+
Arrays.stream(CALocalAccountIdentification.TypeEnum.values())
143+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
144+
}
136145

137146
if (typeMatch) {
138147
deserialized =
@@ -154,9 +163,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
154163
boolean attemptParsing = true;
155164
if (attemptParsing) {
156165
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
157-
boolean typeMatch =
158-
Arrays.stream(CZLocalAccountIdentification.TypeEnum.values())
159-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
166+
boolean typeMatch = false;
167+
if (tree.findValue("type") != null) {
168+
typeMatch =
169+
Arrays.stream(CZLocalAccountIdentification.TypeEnum.values())
170+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
171+
}
160172

161173
if (typeMatch) {
162174
deserialized =
@@ -178,9 +190,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
178190
boolean attemptParsing = true;
179191
if (attemptParsing) {
180192
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
181-
boolean typeMatch =
182-
Arrays.stream(DKLocalAccountIdentification.TypeEnum.values())
183-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
193+
boolean typeMatch = false;
194+
if (tree.findValue("type") != null) {
195+
typeMatch =
196+
Arrays.stream(DKLocalAccountIdentification.TypeEnum.values())
197+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
198+
}
184199

185200
if (typeMatch) {
186201
deserialized =
@@ -202,9 +217,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
202217
boolean attemptParsing = true;
203218
if (attemptParsing) {
204219
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
205-
boolean typeMatch =
206-
Arrays.stream(HKLocalAccountIdentification.TypeEnum.values())
207-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
220+
boolean typeMatch = false;
221+
if (tree.findValue("type") != null) {
222+
typeMatch =
223+
Arrays.stream(HKLocalAccountIdentification.TypeEnum.values())
224+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
225+
}
208226

209227
if (typeMatch) {
210228
deserialized =
@@ -226,9 +244,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
226244
boolean attemptParsing = true;
227245
if (attemptParsing) {
228246
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
229-
boolean typeMatch =
230-
Arrays.stream(HULocalAccountIdentification.TypeEnum.values())
231-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
247+
boolean typeMatch = false;
248+
if (tree.findValue("type") != null) {
249+
typeMatch =
250+
Arrays.stream(HULocalAccountIdentification.TypeEnum.values())
251+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
252+
}
232253

233254
if (typeMatch) {
234255
deserialized =
@@ -250,9 +271,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
250271
boolean attemptParsing = true;
251272
if (attemptParsing) {
252273
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
253-
boolean typeMatch =
254-
Arrays.stream(IbanAccountIdentification.TypeEnum.values())
255-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
274+
boolean typeMatch = false;
275+
if (tree.findValue("type") != null) {
276+
typeMatch =
277+
Arrays.stream(IbanAccountIdentification.TypeEnum.values())
278+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
279+
}
256280

257281
if (typeMatch) {
258282
deserialized =
@@ -274,9 +298,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
274298
boolean attemptParsing = true;
275299
if (attemptParsing) {
276300
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
277-
boolean typeMatch =
278-
Arrays.stream(NOLocalAccountIdentification.TypeEnum.values())
279-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
301+
boolean typeMatch = false;
302+
if (tree.findValue("type") != null) {
303+
typeMatch =
304+
Arrays.stream(NOLocalAccountIdentification.TypeEnum.values())
305+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
306+
}
280307

281308
if (typeMatch) {
282309
deserialized =
@@ -298,9 +325,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
298325
boolean attemptParsing = true;
299326
if (attemptParsing) {
300327
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
301-
boolean typeMatch =
302-
Arrays.stream(NZLocalAccountIdentification.TypeEnum.values())
303-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
328+
boolean typeMatch = false;
329+
if (tree.findValue("type") != null) {
330+
typeMatch =
331+
Arrays.stream(NZLocalAccountIdentification.TypeEnum.values())
332+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
333+
}
304334

305335
if (typeMatch) {
306336
deserialized =
@@ -322,9 +352,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
322352
boolean attemptParsing = true;
323353
if (attemptParsing) {
324354
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
325-
boolean typeMatch =
326-
Arrays.stream(NumberAndBicAccountIdentification.TypeEnum.values())
327-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
355+
boolean typeMatch = false;
356+
if (tree.findValue("type") != null) {
357+
typeMatch =
358+
Arrays.stream(NumberAndBicAccountIdentification.TypeEnum.values())
359+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
360+
}
328361

329362
if (typeMatch) {
330363
deserialized =
@@ -347,9 +380,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
347380
boolean attemptParsing = true;
348381
if (attemptParsing) {
349382
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
350-
boolean typeMatch =
351-
Arrays.stream(PLLocalAccountIdentification.TypeEnum.values())
352-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
383+
boolean typeMatch = false;
384+
if (tree.findValue("type") != null) {
385+
typeMatch =
386+
Arrays.stream(PLLocalAccountIdentification.TypeEnum.values())
387+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
388+
}
353389

354390
if (typeMatch) {
355391
deserialized =
@@ -371,9 +407,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
371407
boolean attemptParsing = true;
372408
if (attemptParsing) {
373409
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
374-
boolean typeMatch =
375-
Arrays.stream(SELocalAccountIdentification.TypeEnum.values())
376-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
410+
boolean typeMatch = false;
411+
if (tree.findValue("type") != null) {
412+
typeMatch =
413+
Arrays.stream(SELocalAccountIdentification.TypeEnum.values())
414+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
415+
}
377416

378417
if (typeMatch) {
379418
deserialized =
@@ -395,9 +434,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
395434
boolean attemptParsing = true;
396435
if (attemptParsing) {
397436
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
398-
boolean typeMatch =
399-
Arrays.stream(SGLocalAccountIdentification.TypeEnum.values())
400-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
437+
boolean typeMatch = false;
438+
if (tree.findValue("type") != null) {
439+
typeMatch =
440+
Arrays.stream(SGLocalAccountIdentification.TypeEnum.values())
441+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
442+
}
401443

402444
if (typeMatch) {
403445
deserialized =
@@ -419,9 +461,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
419461
boolean attemptParsing = true;
420462
if (attemptParsing) {
421463
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
422-
boolean typeMatch =
423-
Arrays.stream(UKLocalAccountIdentification.TypeEnum.values())
424-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
464+
boolean typeMatch = false;
465+
if (tree.findValue("type") != null) {
466+
typeMatch =
467+
Arrays.stream(UKLocalAccountIdentification.TypeEnum.values())
468+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
469+
}
425470

426471
if (typeMatch) {
427472
deserialized =
@@ -443,9 +488,12 @@ public BankAccountAccountIdentification deserialize(JsonParser jp, Deserializati
443488
boolean attemptParsing = true;
444489
if (attemptParsing) {
445490
// Checks if the unique type of the oneOf json matches any of the object TypeEnum values
446-
boolean typeMatch =
447-
Arrays.stream(USLocalAccountIdentification.TypeEnum.values())
448-
.anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
491+
boolean typeMatch = false;
492+
if (tree.findValue("type") != null) {
493+
typeMatch =
494+
Arrays.stream(USLocalAccountIdentification.TypeEnum.values())
495+
.anyMatch((t) -> t.getValue().equals(tree.findValue("type").asText()));
496+
}
449497

450498
if (typeMatch) {
451499
deserialized =

0 commit comments

Comments
 (0)