Skip to content

Commit

Permalink
fix: Fix issue when oneOf/anyOf could be different vairants of arrays…
Browse files Browse the repository at this point in the history
… in root path
  • Loading branch information
en-milie committed Oct 5, 2024
1 parent ea2551e commit b135162
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/endava/cats/factory/FuzzingDataFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,8 @@ private Map<String, Map<String, JsonElement>> getAnyOrOneOffElements(String json
for (Map.Entry<String, JsonElement> 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())) {
Expand Down

0 comments on commit b135162

Please sign in to comment.