Repository navigation
Read renamed fields from their former names - #237
Merged
Merged
Conversation
NormalizedName accepts aliases now. While hydrating, the first alias in the data is used if the field itself is missing, extracting always writes the field name. This covers the most common upcasting case, a renamed field, without writing an upcaster. The generated mappers copy the alias into the field before the assignment, classes without aliases get the same code as before. The cryptography middleware also finds sensitive data and subject ids stored under an alias.
|
Hello 👋 Here are the most recent benchmark results, compared against GeneratedHydrator
StackHydrator
StackHydratorWithLazy
StackHydratorWithCryptography
GeneratedHydratorWithCryptography
This comment gets updated every time a new commit comes in. |
DanielBadura
approved these changes
Oct 18, 2026
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.
Renaming a field breaks the stored data, so far that needed an upcaster which moves the value from the old to the new key.
NormalizedNameaccepts aliases now, similar to the event aliases in event-sourcing:While hydrating, the first alias in the data is used if the field itself is missing. Extracting always writes the field name, so the stored data catches up over time. Field names and aliases have to be unique within a class and its parents, the metadata factory throws
DuplicatedFieldNameInMetadataotherwise.The
ReflectionMapperonly looks at the aliases if the field is missing. The generated mappers copy the alias into the field right before the assignment, classes without aliases get exactly the same code as before. The aliases are part of the fingerprint, and so is the property name now: renaming only the property behind an unchanged field name used to keep the outdated generated mapper.Middlewares see the data as it is stored. The
CryptographyMiddlewareruns before the mapper, so it now also finds sensitive data and subject ids stored under an alias, otherwise a renamed sensitive field would not be decrypted.#233 intersects the data with the fields kept by a property filter, which would drop the aliases. Whichever of both is merged second gets the fix for that.