Skip to content

Fix(routes): show full resolved path in spectator:routes output - #222

Merged
hotmeteor merged 1 commit into
hotmeteor:masterfrom
jaap:master
Aug 23, 2026
Merged

Fix(routes): show full resolved path in spectator:routes output#222
hotmeteor merged 1 commit into
hotmeteor:masterfrom
jaap:master

Conversation

@jaap

@jaap jaap commented May 1, 2026

Copy link
Copy Markdown
Contributor

Summary

When running spectator:routes with a configured path_prefix (or --prefix filter), the table displayed the raw spec path (/files) instead of the actual path used for matching against Laravel routes (/api/v4/files). This was inconsistent with the undocumented rows, which already showed the full URI, and made the output confusing when a prefix was in play.

The fix swaps the displayed value from the raw spec path to the resolved path in both the text table and JSON output.

Before

CleanShot 2026-05-01 at 15 03 57

After

CleanShot 2026-05-01 at 15 04 30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the spectator:routes command output to display the fully resolved (path-prefixed) operation path—matching what the command uses when comparing OpenAPI operations to Laravel routes—so the displayed “Path” is no longer confusing when spectator.path_prefix is configured.

Changes:

  • Switch spectator:routes text table output to show the resolved (prefixed) path instead of the raw spec path.
  • Switch spectator:routes JSON output (spec_operations[].path) to emit the resolved (prefixed) path.
  • Add a console test asserting the JSON output includes the configured prefix in the displayed path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Console/RoutesCommand.php Uses the resolved (prefixed) operation path for both text and JSON output.
tests/Console/RoutesCommandTest.php Adds a regression test for prefixed path display in JSON output.

Comment on lines 224 to 229
foreach ($specOps as $op) {
$rows[] = [
$op['matched'] ? '<fg=green>matched</>' : '<fg=red>unimplemented</>',
$op['method'],
$op['path'],
$op['resolved'],
];
@hotmeteor
hotmeteor merged commit 0a590ff into hotmeteor:master Aug 23, 2026
6 checks passed
@hotmeteor

Copy link
Copy Markdown
Owner

Merged and shipped in v3.0.4. Nice consistency fix — the mismatch between the matched-routes column and the undocumented-routes column with a prefix set was definitely confusing. 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.

3 participants