in src/main/software/amazon/event/ruler/JsonRuleCompiler.java [139:177]
private static void parseObject(final List<Map<String, List<Patterns>>> rules,
final Path path,
final JsonParser parser,
final boolean withQuotes) throws IOException {
boolean fieldsPresent = false;
while (parser.nextToken() != JsonToken.END_OBJECT) {
fieldsPresent = true;
// field name
final String stepName = parser.getCurrentName();
// If it is "$or" primitive, we should bypass that primitive itself in the path as it is not
// a real field name, it is just used to describe the "$or" relationship among object in the followed array.
if (stepName.equals(Constants.OR_RELATIONSHIP_KEYWORD)) {
parseIntoOrRelationship(rules, path, parser, withQuotes);
// all Objects in $or array have been handled in above function, just bypass below logic.
continue;
}
switch (parser.nextToken()) {
case START_OBJECT:
path.push(stepName);
parseObject(rules, path, parser, withQuotes);
path.pop();
break;
case START_ARRAY:
writeRules(rules, path.extendedName(stepName), parser, withQuotes);
break;
default:
barf(parser, String.format("\"%s\" must be an object or an array", stepName));
}
}
if (!fieldsPresent) {
barf(parser, "Empty objects are not allowed");
}
}