Skip to content
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

438: Reference resolution of Product references (and set of) as an attribute of nested type #439

Merged
merged 25 commits into from
Sep 5, 2019

Conversation

heshamMassoud
Copy link
Contributor

@heshamMassoud heshamMassoud commented Sep 4, 2019

Summary

Addresses #438

Important to Note

The test resolveAttributeReference_WithNullReferenceInSetAttribute_ShouldResolveReferences is disabled due to a possible bug on FasterXML/jackson-databind#2442. If this PR is ready to be merged, we can create an issue for this and merge this. --> #441

Todo

  • Tests
    • Unit
    • Integration Tests
  • Add Release Notes entry.

@codecov-io
Copy link

codecov-io commented Sep 4, 2019

Codecov Report

Merging #439 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master    #439      +/-   ##
===========================================
+ Coverage     98.67%   98.7%   +0.02%     
+ Complexity     1498    1493       -5     
===========================================
  Files           131     131              
  Lines          3787    3771      -16     
  Branches        203     202       -1     
===========================================
- Hits           3737    3722      -15     
  Misses           32      32              
+ Partials         18      17       -1
Impacted Files Coverage Δ Complexity Δ
...ync/products/helpers/VariantReferenceResolver.java 100% <100%> (+1.56%) 25 <2> (-5) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 425bede...9169802. Read the comment docs.

Copy link
Contributor

@ahmetoz ahmetoz left a comment

Choose a reason for hiding this comment

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

Good job! We are covering most of the cases, did you consider adding integration tests for the project to project (aka ctpprojectsource)

@@ -184,19 +168,11 @@ static boolean isProductReference(@Nonnull final JsonNode referenceValue) {
}

@Nonnull
CompletionStage<Optional<String>> getResolvedIdFromKeyInReference(@Nonnull final JsonNode referenceValue) {
CompletionStage<Optional<String>> getProductResolvedIdFromKeyInReference(@Nonnull final JsonNode referenceValue) {
final JsonNode idField = referenceValue.get(REFERENCE_ID_FIELD);
return idField != null
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we handle the idField.isNull() case here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Really good question. Even though, implementation wise, It would still work without this check. Because eventually, if it doesn't find "null" in the cache, will try to fetch it, and won't find it, so will still return empty optional.

However, having the check as you suggested is better as it avoids having to fetch at all. - Kind of short-circuiting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@heshamMassoud heshamMassoud merged commit 2ced654 into master Sep 5, 2019
@heshamMassoud heshamMassoud deleted the 438-ref-res-nestedtypes-product-refs branch September 13, 2019 13:53
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.

4 participants