feat: Include all members of nested member #1245
Merged
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.
Flatten all nested members of a specific property
Description
The added
MapNestedPropertiesAttribute
allows users to flatten all properties of a specific member, to avoid having to manually specify the mapping of all nested properties of that member properties as shown in #453.Partly based on #587, but re-implemented, keeping the comments on the PR into account. I took a different approach on the implementation, to explicitly handle nested properties differently from manually specified properties. The resulting member lookup priority is as follows:
MapPropertyAttribute
.MapNestedPropertiesAttribute
s, which may or may not use automatic flattening. Note that these objects are checked in no explicit order, though I suspect it will be based on the order the attributes are specified in. If multiple objects contain a member with the correct name, only the first is returned and no ambiguity diagnostic is emitted. This behavior can be changed in the future.I thought this order would be most intuitive, and it also allows overriding the default behavior using
MapperIgnoreSourceAttribute
s.Fixes #453
Checklist