Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ public static ExampleNode parseNode(IType type, IType wireType, Object objectVal
ExampleNode node;
if (type instanceof IterableType) {
IType elementType = ((IterableType) type).getElementType();
if (objectValue instanceof List) {
if (objectValue == null) {
node = new ListNode(elementType, null);
} else if (objectValue instanceof List) {
ListNode listNode = new ListNode(elementType, objectValue);
node = listNode;

Expand All @@ -77,12 +79,13 @@ public static ExampleNode parseNode(IType type, IType wireType, Object objectVal
node.getChildNodes().add(childNode);
}
} else {
LOGGER.error("Example value is not List type: {}", objectValue);
node = new ListNode(elementType, null);
throw new IllegalStateException("Example value is not List type: " + objectValue);
}
} else if (type instanceof MapType) {
IType elementType = ((MapType) type).getValueType();
if (objectValue instanceof Map) {
if (objectValue == null) {
node = new MapNode(elementType, null);
} else if (objectValue instanceof Map) {
MapNode mapNode = new MapNode(elementType, objectValue);
node = mapNode;

Expand All @@ -101,8 +104,7 @@ public static ExampleNode parseNode(IType type, IType wireType, Object objectVal
mapNode.getKeys().add(entry.getKey());
}
} else {
LOGGER.error("Example value is not Map type: {}", objectValue);
node = new MapNode(elementType, null);
throw new IllegalStateException("Example value is not Map type: " + objectValue);
}
} else if (type == ClassType.OBJECT) {
node = new ObjectNode(type, objectValue);
Expand Down
Loading