-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Add ObjectParser.declareNamedObject (singular) method #53017
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
Conversation
Pinging @elastic/es-search (:Search/Search) |
I'm not sure which team owns this code, I've gone for search why not |
run elasticsearch-ci/bwc |
b1ffc1b
to
129ba9d
Compare
Pinging @elastic/es-core-infra (:Core/Infra/REST API) |
I pinged the core-infra team, since they might be interested in reviewing this change. |
@nik9000 Would you please review this? |
129ba9d
to
f6656fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -403,7 +425,7 @@ public void declareField(Parser<Value, Context> p, ParseField parseField, ValueT | |||
throw new XContentParseException(p.getTokenLocation(), "[" + field + "] can be a single object with any number of " | |||
+ "fields or an array where each entry is an object with a single field"); | |||
} | |||
// This messy exception nesting has the nice side effect of telling the use which field failed to parse | |||
// This messy exception nesting has the nice side effect of telling the user which field failed to parse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Thanks @nik9000 |
Add the convenience method AbstractObjectParser.declareNamedObject (singular) to complement the existing declareNamedObjects (plural).
Fixes a bug in #53017 where ObjectParser.parseNamedObject would leave the end object token unconsumed meaning subsequent fields would not be parsed.
Add the method
AbstractObjectParser.declareNamedObject
(singular) to complement the existingdeclareNamedObjects
(plural). This is a convenience to avoid hacking around withdeclareNamedObject*s*
.Also a small refactoring to avoid duplicated code in
ConstructingObjectParser.declareNamedObject..
methods.