Skip to content

Standardize the way SdkBytes are unmarshalled when they're part of a payload and the service returns no content. #3021

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

Merged
merged 2 commits into from
Feb 10, 2022

Conversation

millems
Copy link
Contributor

@millems millems commented Feb 10, 2022

After this change, when SdkBytes are modeled as a payload, the SDK will always return a non-null empty SdkBytes. When SdkBytes are modeled as a field, they will be null if the service did not specify them.

This issue was brought to our attention when #2982 standardized the Netty HTTP client's behavior. Previously, chunked encoded responses would behave differently than non-chunked encoded payloads. While that change made the behavior consistent, it had the unintentional effect of the SDK now returning null for blob-returning operations (like Lambda's invoke) instead of an empty SdkBytes (unless the Lambda response used chunked encoding, in which case the result would have been null even under the old behavior).

This change standardizes this behavior across all protocols. The table at the end of this PR summarizes the current and new behavior.

Other changes in this PR:

  1. Upgrade wiremock to wiremock-jre8. The old package is deprecated, and the newest package was required for junit 5 extension support. (Note: Wiremock could not be upgraded for the HTTP client tests, because of a bug in the latest wiremock that caused wiremock to not detect HEAD requests properly)
Client Type SDK Protocol SdkBytes Location Response Encoding Previous Value New Value
SYNC JSON PAYLOAD CONTENT_LENGTH empty empty
SYNC JSON PAYLOAD CHUNKED empty empty
SYNC JSON FIELD CONTENT_LENGTH null null
SYNC JSON FIELD CHUNKED null null
SYNC XML PAYLOAD CONTENT_LENGTH empty empty
SYNC XML PAYLOAD CHUNKED empty empty
SYNC XML FIELD CONTENT_LENGTH null null
SYNC XML FIELD CHUNKED null null
SYNC QUERY PAYLOAD CONTENT_LENGTH exception empty
SYNC QUERY PAYLOAD CHUNKED exception empty
SYNC QUERY FIELD CONTENT_LENGTH exception null
SYNC QUERY FIELD CHUNKED exception null
ASYNC JSON PAYLOAD CONTENT_LENGTH null* empty
ASYNC JSON PAYLOAD CHUNKED null empty
ASYNC JSON FIELD CONTENT_LENGTH null null
ASYNC JSON FIELD CHUNKED null null
ASYNC XML PAYLOAD CONTENT_LENGTH null empty
ASYNC XML PAYLOAD CHUNKED null empty
ASYNC XML FIELD CONTENT_LENGTH null null
ASYNC XML FIELD CHUNKED null null
ASYNC QUERY PAYLOAD CONTENT_LENGTH null empty
ASYNC QUERY PAYLOAD CHUNKED null empty
ASYNC QUERY FIELD CONTENT_LENGTH null null
ASYNC QUERY FIELD CHUNKED null null

* This was the behavior that was changed with #2982. Prior to that change, it would have been 'empty'.

@millems millems requested a review from a team as a code owner February 10, 2022 00:59
import software.amazon.awssdk.annotations.SdkProtectedApi;

@SdkProtectedApi
public class LookaheadInputStream extends FilterInputStream {
Copy link
Contributor

Choose a reason for hiding this comment

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

nice utility

…payload and the service returns no content.

After this change, when SdkBytes are modeled as a payload, the SDK will always return a non-null empty SdkBytes. When SdkBytes are modeled as a field, they will
be null if the service did not specify them.
@millems millems force-pushed the millem/sdk-byte-behavior-standardization branch from 162c5a7 to 5200407 Compare February 10, 2022 17:29
@millems millems enabled auto-merge (squash) February 10, 2022 20:24
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

57.7% 57.7% Coverage
0.0% 0.0% Duplication

@millems millems merged commit bd260cb into master Feb 10, 2022
@millems millems deleted the millem/sdk-byte-behavior-standardization branch October 19, 2022 19:36
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