Add context attribute for properties - #212
Draft
DavidBadura wants to merge 1 commit into
Draft
DavidBadura wants to merge 1 commit into
DavidBadura wants to merge 1 commit into
Conversation
The new Context attribute adds context for a single property, which is merged into the context passed to its normalizer and on to nested objects. The date normalizers can now take their format from the context via the datetime_format key.
DavidBadura
marked this pull request as draft
October 2, 2026 21:17
|
Hello 👋 here is the most recent benchmark result:
This comment gets update everytime a new commit comes in! |
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.
This adds a
#[Context]attribute to set context for a single property. It is merged into the context passed to the normalizer of that property and on to nested objects, with values from the attribute taking precedence over the context of the call. The attribute is repeatable, multiple contexts are merged in order.DateTimeImmutableNormalizerandDateTimeNormalizernow read the format from thedatetime_formatcontext key (::FORMAT), which overrides the format given to the normalizer. Together with the attribute this allows a different date format per property, or per call.PropertyMetadatagets a newcontextfield. Metadata cached by an older version is still loaded and falls back to an empty context. Properties without the attribute only add an empty array check to the hot path, and when the call has no context the property context is passed on directly without merging.