-
Notifications
You must be signed in to change notification settings - Fork 914
Support to UnMarshall Blob type payload data in XMlProtocol #2240
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
|
||
if (!CollectionUtils.isNullOrEmpty(element)) { | ||
Object unmarshalled = unmarshaller.unmarshall(context, element, (SdkField<Object>) field); | ||
field.set(sdkPojo, unmarshalled); | ||
if (payloadMemberAsBlobType.isPresent() && payloadMemberAsBlobType.get().equals(field) |
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.
This is similar to JsonProtocolUnmarshaller
Codecov Report
@@ Coverage Diff @@
## master #2240 +/- ##
============================================
- Coverage 77.64% 77.63% -0.01%
Complexity 335 335
============================================
Files 1231 1231
Lines 38724 38733 +9
Branches 3047 3051 +4
============================================
+ Hits 30066 30072 +6
- Misses 7199 7202 +3
Partials 1459 1459
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
if ((!response.isSuccessful() || hasPayloadMembers(sdkPojo)) && responseContent.isPresent() && | ||
!contentLengthZero(response)) { | ||
!contentLengthZero(response) && !getBlobTypePayloadMemberToUnmarshal(sdkPojo).isPresent()) { |
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.
This is long with a lot of nesting. Can we extract it and apply some names to the intermediate values?
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.
removed context.response().content().isPresent check as we already do in LineNumber 83.
Replaced with local variable
public static Optional<SdkField<?>> getBlobTypePayloadMemberToUnmarshal(SdkPojo sdkPojo) { | ||
return sdkPojo.sdkFields().stream() | ||
.filter(f -> f.location() == MarshallLocation.PAYLOAD | ||
|| MarshallerUtil.locationInUri(f.location())) |
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.
Why would a payload member be in the URI?
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.
Settings that don't make sense for the given input/output direction should default to body. E.g. URI fields in a response should go into the payload.
#1996
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.
Would it still be an explicit payload member in this case? (Line 79, or would that filter it out?)
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.
From Original #1996_Snippet which added this for Json ,it looks like it would still be explicit payload member.
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.
Can we add a protocol test for this?
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 Matt , Whi;e I was trying to come up with protocol test cases for the above cases I realized that the MarshallerUtil.locationInUri(f.location()) is not necessary in this case. It is a dead code since it will be filtered at next stage where it checks for f.containsTrait(PayloadTrait.class);
I had taken wrong reference for parsing SDK_Bytes actually it should have been JsonProtocolUnmarshaller.java#L207-L209
Sorry for the confusion , removed these extra checks.
SonarCloud Quality Gate failed. |
Description
Motivation and Context
Testing
Screenshots (if appropriate)
Types of changes
Checklist
mvn install
succeedsLicense