Skip to content

fix: extract path parameters correctly when the router is mounted as … - #135

Merged
pk-work merged 1 commit into
5.1from
downport51
Aug 10, 2026
Merged

fix: extract path parameters correctly when the router is mounted as …#135
pk-work merged 1 commit into
5.1from
downport51

Conversation

@pk-work

@pk-work pk-work commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

…subrouter

The position of a path parameter was calculated from the beginning of the OpenAPI path template and applied to the path of the incoming request. When the router built from the contract is mounted as a subrouter, the request path contains additional leading segments, so the calculated position pointed to the wrong segment and validation failed or, even worse, validated the wrong value.

Since mounting a router can only prepend segments to the request path, the number of additional leading segments is now determined by comparing the number of segments of the request path with the number of segments of the path template, and the parameter position is shifted accordingly. For routers that are not mounted as subrouter the behaviour is unchanged.

Fixes #120

(cherry picked from commit 2c61293)

Motivation:

Explain here the context, and why you're making that change, what is the problem you're trying to solve.

Conformance:

You should have signed the Eclipse Contributor Agreement as explained in https://github.com/eclipse/vert.x/blob/master/CONTRIBUTING.md
Please also make sure you adhere to the code style guidelines: https://github.com/vert-x3/wiki/wiki/Vert.x-code-style-guidelines

…subrouter

The position of a path parameter was calculated from the beginning of
the OpenAPI path template and applied to the path of the incoming
request. When the router built from the contract is mounted as a
subrouter, the request path contains additional leading segments, so the
calculated position pointed to the wrong segment and validation failed
or, even worse, validated the wrong value.

Since mounting a router can only prepend segments to the request path,
the number of additional leading segments is now determined by comparing
the number of segments of the request path with the number of segments
of the path template, and the parameter position is shifted accordingly.
For routers that are not mounted as subrouter the behaviour is
unchanged.

Fixes #120

(cherry picked from commit 2c61293)
@pk-work
pk-work merged commit 397e46e into 5.1 Aug 10, 2026
5 checks passed
@pk-work
pk-work deleted the downport51 branch August 10, 2026 09:21
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.

2 participants