Skip to content

feat(symfony): add routePriority to control route matching order - #8309

Merged
soyuka merged 1 commit into
api-platform:mainfrom
soyuka:feat/route-priority
Sep 11, 2026
Merged

feat(symfony): add routePriority to control route matching order#8309
soyuka merged 1 commit into
api-platform:mainfrom
soyuka:feat/route-priority

Conversation

@soyuka

@soyuka soyuka commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

Adds a new nullable ?int $routePriority operation attribute that maps to the third argument of Symfony's RouteCollection::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 priority attribute, which sorts operations within a resource via Operations::sort(). routePriority instead 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

  • ApiLoaderTest asserts an operation with routePriority: N registers the route at priority N, and that an operation without it stores no priority.
  • tests/Symfony/Routing green (5/5).
  • PHPStan + php-cs-fixer clean on changed files.

Closes #8135

@soyuka
soyuka force-pushed the feat/route-priority branch from cdc9b34 to d637d7c Compare September 11, 2026 20:22
@soyuka
soyuka merged commit 56c4ae2 into api-platform:main Sep 11, 2026
99 of 117 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Symfony API loader do not consider route priority

1 participant