fix: backport #7974 — [TT-16890] validate middleware collapsed path fix#8074
Merged
buger merged 1 commit intorelease-5.8.13from Apr 17, 2026
Merged
fix: backport #7974 — [TT-16890] validate middleware collapsed path fix#8074buger merged 1 commit intorelease-5.8.13from
buger merged 1 commit intorelease-5.8.13from
Conversation
Contributor
|
API Changes --- prev.txt 2026-04-17 07:29:40.147678513 +0000
+++ current.txt 2026-04-17 07:29:35.459693190 +0000
@@ -10438,6 +10438,14 @@
func (m *MockReadCloser) Read(p []byte) (n int, err error)
+type MockResponseCandidate struct {
+ OASMockResponseMeta *oas.MockResponse
+ OASMethod string
+ OASPath string
+}
+ MockResponseCandidate represents one OAS endpoint that maps to the same
+ compiled regex pattern for mock response disambiguation.
+
type Monitor struct {
Gw *Gateway `json:"-"`
}
@@ -11802,6 +11810,16 @@
OASValidateRequestMeta *oas.ValidateRequest
OASMockResponseMeta *oas.MockResponse
+ // OASValidateRequestCandidates holds multiple OAS endpoints that compile to the
+ // same regex pattern. When non-empty, the validate request middleware must
+ // disambiguate by checking path parameter schemas against each candidate.
+ OASValidateRequestCandidates []ValidateRequestCandidate
+
+ // OASMockResponseCandidates holds multiple OAS endpoints that compile to the
+ // same regex pattern. When non-empty, the mock response middleware must
+ // disambiguate by checking path parameter schemas against each candidate.
+ OASMockResponseCandidates []MockResponseCandidate
+
IgnoreCase bool
// OASMethod stores the HTTP method for OAS-specific middleware
// This is needed because OAS operations are method-specific
@@ -11904,6 +11922,16 @@
ProcessRequest will run any checks on the request on the way through the
system, return an error to have the chain fail
+type ValidateRequestCandidate struct {
+ OASValidateRequestMeta *oas.ValidateRequest
+ OASMethod string
+ OASPath string
+}
+ ValidateRequestCandidate represents one OAS endpoint that maps to the
+ same compiled regex pattern. Used for disambiguation when multiple
+ parameterized paths collapse to the same regex (e.g., /employees/{prct} and
+ /employees/{zd}).
+
type ValueExtractor struct {
BaseExtractor
} |
Contributor
|
Failed to generate code suggestions for PR |
1a70d19 to
df7fcb1
Compare
Contributor
🚨 Jira Linter FailedCommit: The Jira linter failed to validate your PR. Please check the error details below: 🔍 Click to view error detailsNext Steps
This comment will be automatically deleted once the linter passes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of #7974 to release-5.8.13. Follow-up fix for collapsed parameterized path disambiguation.
groupCollapsedValidateRequestSpecsandgroupCollapsedMockResponseSpecsto detect and group URLSpec entries with identical compiled regex patternsmatchCandidatePathfor shared disambiguation logiclib.RestoreUnicodeEscapesInErrorreference (not available on this branch)Note: This PR includes the #7972 backport commit as a prerequisite (stacked PR). Merge #7972 backport first: #8072
Test plan
go build ./gateway/...passes🤖 Generated with Claude Code