Skip to content

EVA-3177: strip query string from endpoint path when registering routes - #18

Merged
aivus merged 2 commits into
masterfrom
EVA-3177-strip-query-string-from-routes
Jul 13, 2026
Merged

EVA-3177: strip query string from endpoint path when registering routes#18
aivus merged 2 commits into
masterfrom
EVA-3177-strip-query-string-from-routes

Conversation

@aivus

@aivus aivus commented Jul 6, 2026

Copy link
Copy Markdown
Member

Problem

Endpoint paths generated from OpenAPI specs may contain a query string template, e.g.

/v1/items?excludeIds={excludeIds}

This template is load-bearing for API clients (service-api-client-bundle builds request URIs by substituting the {...} placeholders), but EndpointLoader passed it verbatim into the Symfony Route. Symfony matches routes against the path info, which never contains a query string, so such a route can never match — requests to /v1/items return 404:

| Path Regex   | {^/v1/items\?excludeIds\=(?P<excludeIds>[^/]++)$}sD |

Fix

Strip everything from ? onward from the endpoint path before registering the route.

Request DTO population is unaffected: ServiceRequestResolver already reads query parameters from the actual request ($request->query->all()), not from the route path.

Tests

New Tests/Routing/EndpointLoaderTest.php:

  • query string template is stripped from the registered route path
  • path placeholders (/v1/cars/{id}) are preserved
  • end-to-end: a route defined with a query string template now matches a request without query parameters via UrlMatcher

Ref: EVA-3177

🤖 Generated with Claude Code

Endpoint paths may contain a query string template (e.g.
"/v1/cars?ids={ids}") that API clients use to build request URIs.
Symfony matches routes against the path info only, so a route
registered with the query string in its path can never match.

Strip everything from "?" onward before creating the route. Request
DTO population is unaffected: ServiceRequestResolver already reads
query parameters from the actual request.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread Tests/Routing/EndpointLoaderTest.php Outdated
Comment thread Tests/Routing/EndpointLoaderTest.php
Use the concrete Endpoint DTO instead of prophesizing EndpointInterface
(it is just a DTO), and remove the UrlMatcher-based test which exercised
Symfony routing rather than EndpointLoader itself.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@aivus
aivus requested a review from aviator-ua July 8, 2026 11:58
@aivus
aivus merged commit 5c86893 into master Jul 13, 2026
5 checks passed
@aivus
aivus deleted the EVA-3177-strip-query-string-from-routes branch July 13, 2026 10:55
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.

5 participants