feature: extend deep mapping support to nested types, pointers, maps and arrays#176
Open
iamtakingiteasy wants to merge 1 commit intogo-viper:mainfrom
Open
feature: extend deep mapping support to nested types, pointers, maps and arrays#176iamtakingiteasy wants to merge 1 commit intogo-viper:mainfrom
iamtakingiteasy wants to merge 1 commit intogo-viper:mainfrom
Conversation
…and arrays Signed-off-by: Alexander Tumin <iamtakingiteasy@eientei.org>
e3eb0ad to
e3aba7c
Compare
Author
|
Removed unnecessary dispatches. |
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.
Currently deep mapping is limited only to non-pointer slice elements.
This MR extends deep mapping, allowing to perform deep conversion on pointer types, including nested pointer types, arrays and maps.
To facilitate this, all container type mapping functions are extended with
stateto carry global default configuration / field overrides down the type hierarchy for recursive deep conversion.Additionally, a new configuration option
Indirect(and field-level tag optionindirect) is added to allow conversion of nested maps/slices/arrays to their indirect/interface representations, e.g. havingmap[string]anyin output instead ofmap[string]map[string]anyand[]anyinstead of[][]anyand[123]anyon the top level.Explicitly supported cases are covered by tests in all permutations.