Skip to content

Conversation

@aweigold
Copy link
Contributor

@aweigold aweigold commented Feb 6, 2018

This is a convenience enhancement to automatically add the system.type query parameter if it's possible by introspecting the type requested.

Internally, we have been finding many times we are manually adding this to our client request parameters, as sometimes certain queries will return content types that somewhat map to the objects we request, and are not wanted.

…tomatically add a query filter for system type
((DeliveryOptions) deliveryOptionsField.get(client)).setProductionEndpoint(testServerUri);

ArticleItem itemObj = client.getItem("on_roasts", ArticleItem.class);
Assert.assertNotNull(itemObj);
Copy link
Contributor

Choose a reason for hiding this comment

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

the tests are not conclusive. they'd pass even if the new type detection logic was not present because you're filtering by codename in the first place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ultimately, the test hits a mocked server, which limits it's usefulness for the edge you are bringing up, but the mock server is checking for the parameter to be present. I would expect that in a real world scenario, if you filtered by system.type=article, and codename=some_non_article, that the API wouldn't respond with any results, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test hits the view a content item API, which requires a code name: https://developer.kenticocloud.com/v1/reference#view-a-content-item

Copy link
Contributor

Choose a reason for hiding this comment

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

correct. 👍 i didn't notice the check on the mocked server. merging

@petrsvihlik
Copy link
Contributor

the implementation is ok, I found just one little thing in the tests..

@petrsvihlik petrsvihlik merged commit a62d315 into master Feb 6, 2018
@petrsvihlik petrsvihlik deleted the delivery-sdk-java-48 branch February 6, 2018 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants