Skip to content

Commit

Permalink
HLRC: Fix user parser
Browse files Browse the repository at this point in the history
It was strange and hacky and the parser checker didn't like it.
  • Loading branch information
nik9000 committed Oct 26, 2018
1 parent 6cdf3f7 commit cb20f9e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ public int hashCode() {
true, args -> new PutUserResponse((boolean) args[0]));

static {
PARSER.declareBoolean(constructorArg(), new ParseField("created"));
PARSER.declareObject((a,b) -> {}, (parser, context) -> null, new ParseField("user")); // ignore the user field!
ConstructingObjectParser<Boolean, Void> roleMappingParser = new ConstructingObjectParser<>(
"put_user_response.user", true, args -> (Boolean) args[0]);
roleMappingParser.declareBoolean(constructorArg(), new ParseField("created"));
PARSER.declareObject(constructorArg(), roleMappingParser::parse, new ParseField("user"));
}

public static PutUserResponse fromXContent(XContentParser parser) throws IOException {
Expand Down

0 comments on commit cb20f9e

Please sign in to comment.