[13.x] Add route metadata support#60530
Open
benbjurstrom wants to merge 4 commits into
Open
Conversation
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 PR adds support for attaching arbitrary metadata to routes.
Currently applications can pass custom keys through the route action array and read them back from the resolved route, but there's no supported way to attach structured data across the full route-building pipeline. This PR makes metadata a first-class attribute so it can be applied consistently before the final route instances are created.
Metadata can be added directly to a route:
Metadata can be read from the route with optional dot notation and a default value:
Metadata set on a group cascades to every route inside it. Associative arrays merge recursively so nested groups can layer values, while lists and simple values replace inherited values:
Resources and singletons are supported as well:
Metadata is stored on the route action under a dedicated
metadatakey, allowing it to be serialized byroute:cacheand merged through the existing route group logic.setMetadatais also available on the route instance to replace metadata instead of merging.