Skip to content

Name routes without an operationId after their class in snake_case - #63

Merged
stixx merged 2 commits into
mainfrom
feat/snake-case-route-names
Oct 25, 2026
Merged

stixx merged 2 commits into
mainfrom
feat/snake-case-route-names

Conversation

@stixx

@stixx stixx commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

A route without an operationId was named command_ plus the lowercased class short name, so CreateInvoiceCommand became command_createinvoicecommand. It is now named in snake_case, command_create_invoice_command, consistent with Symfony's own route names. Acronyms and digits are split as Symfony's string component does: ImportCSVFileCommand becomes command_import_csv_file_command.

Nelmio derives the documented operationId of such an operation from the route name, so it changes as well, e.g. post_command_create_invoice_command. Routes with an explicit operationId are unaffected.

The changelog's Upgrading section covers updating route references and regenerating clients, or setting the previous name as the operationId to keep it.

Summary by CodeRabbit

  • New Features
    • Routes without an explicit operation ID now use command class names converted to snake_case, including names with acronyms and numbers.
    • OpenAPI operation IDs are derived from these route names when no operation ID is provided.
  • Documentation
    • Updated routing and OpenAPI guidance to reflect the new naming format. Existing route references may need updating; specifying an explicit operation ID preserves a previous name.

CreateInvoiceCommand becomes command_create_invoice_command instead of
command_createinvoicecommand, and the operationId Nelmio derives from it changes
with it.
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Walkthrough

Default route names derived from command class names now use snake_case. Functional tests, OpenAPI examples, and documentation use the updated names. The changelog describes the naming change and upgrade steps.

Changes

Default command route naming

Layer / File(s) Summary
Convert class names to snake_case
src/Routing/Loader/CommandRouteClassLoader.php, tests/Unit/Routing/Loader/CommandRouteClassLoaderTest.php
The route loader inserts underscores at word boundaries before lowercasing. Unit tests cover regular words, an acronym, and digits.
Update route references and documentation
CHANGELOG.md, docs/*, tests/Functional/*
Functional route checks and OpenAPI examples use the new names. Documentation describes the naming rule and upgrade steps.

Priority: Pending latest changes

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to 464ce

No actionable merge-blocking risk is established.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

The documented operationId only has the method prefix by Nelmio's default, an
operationId keeps either the route name or the documented one, and area
name_patterns may refer to the old names.
@stixx
stixx merged commit 7aa7369 into main Oct 25, 2026
10 checks passed
@stixx
stixx deleted the feat/snake-case-route-names branch October 25, 2026 20:11
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.

1 participant