Added new code sections to support deser overrides#1090
Open
timocov wants to merge 1 commit intosmithy-lang:mainfrom
Open
Added new code sections to support deser overrides#1090timocov wants to merge 1 commit intosmithy-lang:mainfrom
timocov wants to merge 1 commit intosmithy-lang:mainfrom
Conversation
78dfbc6 to
9f0c265
Compare
9f0c265 to
2cc4ff1
Compare
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.
Issue #, if available: fixes #1053
Description of changes:
I was playing around with the code in order to find a good solution for #1053 and it seems this is the one (well, at least it works, it doesn't expose too much and kinda fits into current architecture 😂).
To summarize, this PR adds 2 new code sections that consuming code can override:
MemberDeserializerSectionMemberSerializerSectionFor instance, considering an example from #1053 (comment) you can write something like that in your codegen integration in order to get proper deser and type change:
This doesn't feel like a huge change (even tho it might expose something you don't want to expose - let me know) and the amount of changes is relatively small, but it feels like it gives enough flexibility for consumers if they need to (e.g. I also was able to add support for
alloy#discriminatedas well, which feels like a huge win tbh 😂)By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.