Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What behavior changes?
By default no behavior changes. Opt-in: a symbol provider now can say if a structure member should be serialized as explicit
nullinstead of nothing as it is right now.Why is this change needed?
We're migrating to Smithy and it is working very well, but unfortunately due to the previous setup we had, a couple of public APIs we expose returned certain values as explicit
nulls and this is something our consumers rely on and will treat omitting values as a "breaking change" (which we're happy to do, but it requires quite long lead time which will stop us from migrating to smithy until then). I was trying to overcome this otherwise in our codegen integration with available injection points, but this requires quite a lot of changes: the solution I was thinking was to override a structure containing such fields serialization calls (basically forstructure Payload > structure Data > "field with explicit null"we would need to override serialization ofDatainsidePayloadso that it wraps the data struct into a wrapper class that serializes members of the original struct + goes over all "nullable" fields and checks if they are nulls and then writes explicit nulls). So I was thinking if you're fine with having support for this new feature inside the codegen (it is similar to@sparsefor collections, but for structure members).How was this validated?
pTMLlocally and then installed in our integration package and run testsnullPlease note that I had to run tests with 27ff34d as a base because current main has broken deserailization - see #1358 (comment).
What should reviewers focus on?
I also moved a common "logic" of writing explicit
nullintoSerializerMemberGeneratorsince it felt like the right place for this (we need to know the schema variable and it handles it already; and it kinda did handle list/map members already for schema detection).Additional Links
Nothing.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.