Skip to content

Conversation

@cbuescher
Copy link
Member

When parsing resonses we should be ignoring any new unknown fields or inner objects in most cases to be forward compatible with changes in core on the
client side. This change adds test for this for QueryProfileShardResult and nested substructures and changes the parsing code where necessary to be able to
ignore new fields and objects in the xContent.

@cbuescher cbuescher requested review from javanna and tlrx June 8, 2017 09:59
@cbuescher cbuescher added :Java High Level REST Client >test Issues or PRs that are addressing/adding tests v6.0.0 labels Jun 8, 2017
Copy link
Member

@javanna javanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks @cbuescher

ensureExpectedToken(XContentParser.Token.START_ARRAY, parser.nextToken(), parser::getTokenLocation);
while((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
parseSearchProfileResultsEntry(parser, searchProfileResults);
ensureExpectedToken(XContentParser.Token.START_OBJECT, token, parser::getTokenLocation);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can check the expected token and then create the searchProfileResults map

}

public void testFromXContent() throws IOException {
dofromXContentTestWithRandomFields(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: doFromXContentTestWithRandomFields

}

public void testFromXContent() throws IOException {
dofromXContentTestWithRandomFields(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: doFromXContentTestWithRandomFields

@cbuescher cbuescher force-pushed the tests-addLenientParsingChecks branch from 6ddc312 to 18dd032 Compare June 8, 2017 13:34
@cbuescher cbuescher merged commit a0afa91 into elastic:master Jun 8, 2017
cbuescher added a commit that referenced this pull request Jun 8, 2017
#25130)

When parsing resonses we should be ignoring any new unknown fields or inner
objects in most cases to be forward compatible with changes in core on the
client side. This change adds test for this for QueryProfileShardResult and
nested substructures and changes the parsing code where necessary to be able to
ignore new fields and objects in the xContent.
@javanna javanna added the v5.6.0 label Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>test Issues or PRs that are addressing/adding tests v5.6.0 v6.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants