We found a somewhat unexpected behavior of the ConstructingObjectParser.
While parsing JSON object { "role_mapping" : { "created" : "true" } }, if we declare
inner field "create" as a constructorArg along with the field "role_mapping" for which the parser is a no-op, the target object is still constructed.
static {
PARSER.declareBoolean(constructorArg(), new ParseField("created"));
PARSER.declareObject((a,b) -> {}, (parser, context) -> null, new ParseField("role_mapping"));
}
We continue to sub parse the object for role_mapping and once we encounter constructorArg we build the target object. The field role_mapping object is queued but later ignored.
The behaviour seems to be similar to what we do for unknown fields or optional constructor args, but
not sure about it.