Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed validation of requirements in route description #2083

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vodevel
Copy link

@vodevel vodevel commented Mar 2, 2023

See #1873

Example

#[Route('route/{id}', requirements: ['id' =>  '\d+'])]

Now Swagger UI allows any {id} that contains at least one digit (eg. x1 or "1"). Whereas in Symfony Routing allows {id} that consists only of digits. To be sure, run

bin/console route:match /route/x1
# Error: almost matches but requirement for "id" does not match (\d+)

bin/console route:match /route/11
# Success: Path Regex   | {^/route/(?P<id>\d+)$}sDu  

See also https://github.com/symfony/routing/blob/6.2/RouteCompiler.php#L301

Therefore, a wrapper has been added to fully comply with the requirements.

@shakaran
Copy link
Contributor

shakaran commented May 1, 2024

@vodevel could you rebase with last updates? Thanks

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.

None yet

2 participants