Skip to content

Return problem+json for unmatched paths and wrong verbs under API areas#24

Merged
stixx merged 2 commits into
mainfrom
api-area-path-fallback
May 9, 2026
Merged

Return problem+json for unmatched paths and wrong verbs under API areas#24
stixx merged 2 commits into
mainfrom
api-area-path-fallback

Conversation

@stixx
Copy link
Copy Markdown
Owner

@stixx stixx commented May 9, 2026

Return problem+json for unmatched paths and wrong verbs under API areas

The exception subscriber relied on the request having a _route attribute
to decide whether the path belonged to a Nelmio API area. Symfony does not
set _route when the URL doesn't match any route (404) or when no method
matches a known path (405), so those cases fell through to the framework's
HTML error page even when the path clearly belonged to /api/...

Capture each area's path_patterns at compile time and use them as a
fallback in NelmioAreaRoutesChecker so the bundle's RFC 7807 contract
holds for missing-route and method-not-allowed cases.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 9, 2026

Warning

Rate limit exceeded

@stixx has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 4 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f6b4f32c-c438-47f3-aceb-48c0e890c0da

📥 Commits

Reviewing files that changed from the base of the PR and between 0187ef6 and f027aa0.

📒 Files selected for processing (6)
  • config/routing.php
  • src/DependencyInjection/Compiler/CollectNelmioApiDocRoutesPass.php
  • src/Routing/NelmioAreaRoutesChecker.php
  • tests/Functional/ScenarioTest.php
  • tests/Unit/DependencyInjection/Compiler/CollectNelmioApiDocRoutesPassTest.php
  • tests/Unit/Routing/NelmioAreaRoutesTest.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch api-area-path-fallback

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@stixx stixx force-pushed the api-area-path-fallback branch from bccbf4b to d8a9e58 Compare May 9, 2026 11:06
@stixx stixx merged commit 1b0fb87 into main May 9, 2026
6 checks passed
@stixx stixx deleted the api-area-path-fallback branch May 9, 2026 11:19
@stixx stixx added the enhancement New feature or request label May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant