From b1351625e16815d4e67a6c2f3d659ea9bdb50212 Mon Sep 17 00:00:00 2001 From: Madalin Ilie Date: Sat, 5 Oct 2024 22:21:59 +0300 Subject: [PATCH] fix: Fix issue when oneOf/anyOf could be different vairants of arrays in root path --- src/main/java/com/endava/cats/factory/FuzzingDataFactory.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/endava/cats/factory/FuzzingDataFactory.java b/src/main/java/com/endava/cats/factory/FuzzingDataFactory.java index 1e5975c9f..5b31fd4ee 100644 --- a/src/main/java/com/endava/cats/factory/FuzzingDataFactory.java +++ b/src/main/java/com/endava/cats/factory/FuzzingDataFactory.java @@ -722,6 +722,8 @@ private Map> getAnyOrOneOffElements(String json for (Map.Entry elementEntry : jsonObject.entrySet()) { if (isNotNullAndNonPrimitiveArray(elementEntry) && isAnyOrOneOfInChildren(elementEntry.getValue())) { anyOrOneOfs.putAll(this.getAnyOrOneOffElements(this.createArrayKey(jsonElementKey, elementEntry.getKey()), elementEntry.getValue().getAsJsonArray().get(0))); + } else if (isNotNullAndNonPrimitiveArray(elementEntry) && isXxxOfInString(elementEntry.getKey()) && "$".equals(jsonElementKey)) { + anyOrOneOfs.merge(this.createSimpleElementPath(jsonElementKey, elementEntry.getKey()), Map.of(elementEntry.getKey(), elementEntry.getValue().getAsJsonArray()), this::mergeMaps); } else if (isNotNullAndNonPrimitiveArray(elementEntry) && isXxxOfInString(elementEntry.getKey())) { anyOrOneOfs.merge(this.createArrayKey(jsonElementKey, elementEntry.getKey()), Map.of(elementEntry.getKey(), elementEntry.getValue().getAsJsonArray().get(0)), this::mergeMaps); } else if (isXxxOfInString(elementEntry.getKey())) {