feat(symfony): add routePriority to control route matching order#8309
Open
soyuka wants to merge 1 commit into
Open
feat(symfony): add routePriority to control route matching order#8309soyuka wants to merge 1 commit into
soyuka wants to merge 1 commit into
Conversation
Expose Symfony RouteCollection::add() third argument via a new nullable ?int $routePriority operation attribute, distinct from the existing $priority (which sorts operations within a resource). Wired through all HttpOperation subclasses (Get, GetCollection, Post, Put, Patch, Delete, NotExposed, McpResource, McpTool) and the YAML/XML extractors + XSD schema so the attribute is usable from every config format. Closes api-platform#8135
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.
Summary
Adds a new nullable
?int $routePriorityoperation attribute that maps to the third argument of Symfony'sRouteCollection::add(string $name, Route $route, int $priority = 0), controlling the URL-matching precedence of the route generated for an operation.This is distinct from the existing
priorityattribute, which sorts operations within a resource viaOperations::sort().routePriorityinstead controls cross-route matching order in the Symfony router, which the per-resource sort does not cover.Wired through all HTTP operation subclasses (
Get,GetCollection,Post,Put,Patch,Delete,NotExposed,McpResource,McpTool) plus the YAML/XML extractors and XSD schema, so it is configurable from every metadata format.Test plan
ApiLoaderTestasserts an operation withroutePriority: Nregisters the route at priorityN, and that an operation without it stores no priority.tests/Symfony/Routinggreen (5/5).Closes #8135