-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Declared Object in ConstructingObjectParser is ignored in case target object is already built. #34351
Comments
Pinging @elastic/es-core-infra |
Adding @nik9000 for more insights. Thank you. |
I think I understand what is up here. I'll open up something to detect it. |
Ok - the issue is that any parser that attempts to parse an object or a list is obligated to move to the end of that object or list. If it doesn't then all kinds of crazy things happen. You can work around this with |
I'm most of the way through a change to detect "bad parsers" but fighting with some test failures. |
Ah! I see what you are doing now. I'll include a fix when i open a PR. |
Adds checks for misbehaving parsers. Closes elastic#34351
Adds checks for misbehaving parsers. The checks aren't perfect at all but they are simple and fast enough that we can do them all the time so they'll catch most badly behaving parsers. Closes #34351
Adds checks for misbehaving parsers. The checks aren't perfect at all but they are simple and fast enough that we can do them all the time so they'll catch most badly behaving parsers. Closes #34351
Adds checks for misbehaving parsers. The checks aren't perfect at all but they are simple and fast enough that we can do them all the time so they'll catch most badly behaving parsers. Closes #34351
We found a somewhat unexpected behavior of the
ConstructingObjectParser
.While parsing JSON object
{ "role_mapping" : { "created" : "true" } }
, if we declareinner 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.We continue to sub parse the object for
role_mapping
and once we encounter constructorArg we build the target object. The fieldrole_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.
The text was updated successfully, but these errors were encountered: