TykTechnologies / tyk

Tyk Open Source API Gateway written in Go, supporting REST, GraphQL, TCP and gRPC protocols
Other
9.76k stars 1.09k forks source link

[TT-13088] Fixed godoc for path prefix and sufix configs #6610

Closed lghiur closed 1 month ago

github-actions[bot] commented 1 month ago

API Changes

--- prev.txt    2024-10-08 11:59:24.126468070 +0000
+++ current.txt 2024-10-08 11:59:18.457531955 +0000
@@ -5913,9 +5913,42 @@
    // Regular expressions and parameterized routes will be left alone regardless of this setting.
    EnableStrictRoutes bool `json:"enable_strict_routes"`

+   // EnablePathPrefixMatching changes how the gateway matches incoming URL paths against routes (patterns) defined in the API definition.
+   // By default, the gateway uses wildcard matching. When EnablePathPrefixMatching is enabled, it switches to prefix matching. For example, a defined path such as `/json` will only match request URLs that begin with `/json`, rather than matching any URL containing `/json`.
+   //
+   // The gateway checks the request URL against several variations depending on whether path versioning is enabled:
+   // - Full path (listen path + version + endpoint): `/listen-path/v4/json`
+   // - Non-versioned full path (listen path + endpoint): `/listen-path/json`
+   // - Path without version (endpoint only): `/json`
+   //
+   // For patterns that start with `/`, the gateway prepends `^` before performing the check, ensuring a true prefix match.
+   // For patterns that start with `^`, the gateway will already perform prefix matching so EnablePathPrefixMatching will have no impact.
+   // This option allows for more specific and controlled routing of API requests, potentially reducing unintended matches. Note that you may need to adjust existing route definitions when enabling this option.
+   //
+   // Example:
+   //
+   // With wildcard matching, `/json` might match `/api/v1/data/json`.
+   // With prefix matching, `/json` would not match `/api/v1/data/json`, but would match `/json/data`.
+   //
    // Combining EnablePathPrefixMatching with EnablePathSuffixMatching will result in exact URL matching, with `/json` being evaluated as `^/json$`.
    EnablePathPrefixMatching bool `json:"enable_path_prefix_matching"`

+   // EnablePathSuffixMatching changes how the gateway matches incoming URL paths against routes (patterns) defined in the API definition.
+   // By default, the gateway uses wildcard matching. When EnablePathSuffixMatching is enabled, it switches to suffix matching. For example, a defined path such as `/json` will only match request URLs that end with `/json`, rather than matching any URL containing `/json`.
+   //
+   // The gateway checks the request URL against several variations depending on whether path versioning is enabled:
+   // - Full path (listen path + version + endpoint): `/listen-path/v4/json`
+   // - Non-versioned full path (listen path + endpoint): `/listen-path/json`
+   // - Path without version (endpoint only): `/json`
+   //
+   // For patterns that already end with `$`, the gateway will already perform suffix matching so EnablePathSuffixMatching will have no impact. For all other patterns, the gateway appends `$` before performing the check, ensuring a true suffix match.
+   // This option allows for more specific and controlled routing of API requests, potentially reducing unintended matches. Note that you may need to adjust existing route definitions when enabling this option.
+   //
+   // Example:
+   //
+   // With wildcard matching, `/json` might match `/api/v1/json/data`.
+   // With suffix matching, `/json` would not match `/api/v1/json/data`, but would match `/api/v1/json`.
+   //
    // Combining EnablePathSuffixMatching with EnablePathPrefixMatching will result in exact URL matching, with `/json` being evaluated as `^/json$`.
    EnablePathSuffixMatching bool `json:"enable_path_suffix_matching"`
github-actions[bot] commented 1 month ago

Failed to generate code suggestions for PR

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

lghiur commented 1 month ago

/release to release-5.6

lghiur commented 1 month ago

/release to release-5.6.0

lghiur commented 1 month ago

/release to release-5.3

tykbot[bot] commented 1 month ago

Working on it! Note that it can take a few minutes.

tykbot[bot] commented 1 month ago

Working on it! Note that it can take a few minutes.

tykbot[bot] commented 1 month ago

Working on it! Note that it can take a few minutes.

lghiur commented 1 month ago

/release to release-5.3.6

tykbot[bot] commented 1 month ago

@lghiur Succesfully merged PR

tykbot[bot] commented 1 month ago

@lghiur Release branch not found

tykbot[bot] commented 1 month ago

Working on it! Note that it can take a few minutes.

tykbot[bot] commented 1 month ago

@lghiur Succesfully merged PR

tykbot[bot] commented 1 month ago

Still working...

tykbot[bot] commented 1 month ago

@lghiur Succesfully merged PR

tykbot[bot] commented 1 month ago

Still working...

tykbot[bot] commented 1 month ago

@lghiur Succesfully merged PR