-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[TT-15856] patch matching oas CI test #7618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
OAS-specific middleware (validateRequest, mockResponse) now use the standard regex-based path matching algorithm instead of Gorilla Mux, ensuring gateway configurations like EnablePathPrefixMatching work consistently across all API types. - Add OASValidateRequest and OASMockResponse URL status types - Compile OAS operations into URLSpec entries in RxPaths - Update OAS middleware to use FindSpecMatchesStatus for matching - Add version fallback for unversioned APIs - Add regression test verifying gateway config is respected Fixes path matching inconsistencies where OAS APIs ignored gateway-level configuration options.
|
This pull request unifies the path matching algorithm for OpenAPI Specification (OAS) middleware, ensuring that it respects the gateway's standard regex-based routing configurations, such as prefix and suffix matching. This resolves a significant inconsistency where OAS APIs previously used an exact-match mechanism, ignoring global gateway routing rules that applied to classic APIs. Files Changed AnalysisThe changes are focused on the gateway's core API definition and routing logic, with 1516 additions and 23 deletions across 10 files. The vast majority of the new code consists of comprehensive tests (five new test files and significant additions to another), which is appropriate for a change to a critical component like path matching. The core logic modifications are concentrated in Architecture & Impact Assessment
Powered by Visor from Probelabs Last updated: 2025-12-15T08:52:40.794Z | Triggered by: pr_updated | Commit: 153adeb 💡 TIP: You can chat with Visor using |
|
API Changes --- prev.txt 2025-12-15 08:50:01.752347421 +0000
+++ current.txt 2025-12-15 08:49:51.375307843 +0000
@@ -11618,6 +11618,8 @@
StatusRequestNotTracked RequestStatus = "Request Not Tracked"
StatusValidateJSON RequestStatus = "Validate JSON"
StatusValidateRequest RequestStatus = "Validate Request"
+ StatusOASValidateRequest RequestStatus = "OAS Validate Request"
+ StatusOASMockResponse RequestStatus = "OAS Mock Response"
StatusInternal RequestStatus = "Internal path"
StatusGoPlugin RequestStatus = "Go plugin"
StatusPersistGraphQL RequestStatus = "Persist GraphQL"
@@ -12237,8 +12239,16 @@
GoPluginMeta GoPluginMiddleware
PersistGraphQL apidef.PersistGraphQLMeta
RateLimit apidef.RateLimitMeta
+ OASValidateRequestMeta *oas.ValidateRequest
+ OASMockResponseMeta *oas.MockResponse
IgnoreCase bool
+ // OASMethod stores the HTTP method for OAS-specific middleware
+ // This is needed because OAS operations are method-specific
+ OASMethod string
+ // OASPath stores the original OAS path pattern (e.g., "/users/{id}")
+ // This is used for matching against the OAS router when needed
+ OASPath string
// Has unexported fields.
}
URLSpec represents a flattened specification for URLs, used to check if
@@ -12269,10 +12279,12 @@
RequestTracked
RequestNotTracked
ValidateJSONRequest
+ OASValidateRequest
Internal
GoPlugin
PersistGraphQL
RateLimit
+ OASMockResponse
)
Enums representing the various statuses for a VersionInfo Path match during
a proxy request |
Security Issues (2)
Architecture Issues (2)
Performance Issues (2)
Quality Issues (2)
Powered by Visor from Probelabs Last updated: 2025-12-15T08:52:43.565Z | Triggered by: pr_updated | Commit: 153adeb 💡 TIP: You can chat with Visor using |
🚨 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. |
|



Description
Unifies path matching algorithm for OAS-specific middleware (ValidateRequest, MockResponse) to use the same regex-based RxPaths matching as Classic APIs, instead of Gorilla Mux exact matching.
Key changes
gateway/api_definition.go:gateway/model_urlspec.go:gateway/model_apispec.go:gateway/mw_oas_validate_request.go/gateway/mw_mock_response.go:Related Issue
• TT-15856: Unify path matching algorithm for all middleware
• Related: TT-10609, TT-15374, TT-10626
Motivation and Context
Before this fix, OAS middleware used Gorilla Mux which only does exact path matching. This caused:
How This Has Been Tested
Unit tests added (Go):
• gateway/mw_oas_validate_request_test.go (354 lines)
• gateway/mw_mock_response_oas_simple_test.go (204 lines)
• gateway/mw_mock_response_versioning_test.go (421 lines)
• gateway/mw_oas_path_matching_regression_test.go (115 lines)
Integration tests added (Python in tyk-analytics):
• 22 tests in tests/api/tests/dashboard_api/oas_path_matching_test.py
Validation:
Screenshots (if appropriate)
Types of changes
Checklist
Ticket Details
TT-15856
Generated at: 2025-12-15 08:49:23