[TT-11954/TT-12155] add x-tyk-api-gateway.servers.contextVariables.enabled#6281
Conversation
- enable context variables by default for OAS APIs if not explicitly configured otherwise.
06a4033 to
61fb076
Compare
|
API Changes --- prev.txt 2024-05-15 16:12:16.693082284 +0000
+++ current.txt 2024-05-15 16:12:13.637085654 +0000
@@ -2855,6 +2855,19 @@
}
ClientToPolicy contains a 1-1 mapping between Client ID and Policy ID.
+type ContextVariables struct {
+ // Enabled enables context variables to be passed to Tyk middlewares.
+ // Tyk classic API definition: `enable_context_vars`.
+ Enabled bool `json:"enabled" bson:"enabled"`
+}
+ ContextVariables holds the configuration related to Tyk context variables.
+
+func (c *ContextVariables) ExtractTo(api *apidef.APIDefinition)
+ ExtractTo extracts *ContextVariables into *apidef.APIDefinition.
+
+func (c *ContextVariables) Fill(api apidef.APIDefinition)
+ Fill fills *ContextVariables from apidef.APIDefinition.
+
type CustomPlugin struct {
// Enabled activates the custom pre plugin.
Enabled bool `bson:"enabled" json:"enabled"` // required.
@@ -3974,6 +3987,9 @@
//
// Tyk classic API definition: `event_handlers`
EventHandlers EventHandlers `bson:"eventHandlers,omitempty" json:"eventHandlers,omitempty"`
+
+ // ContextVariables contains the configuration related to Tyk context variables.
+ ContextVariables *ContextVariables `bson:"contextVariables,omitempty" json:"contextVariables,omitempty"`
}
Server contains the configuration that sets Tyk up to receive requests from
the client applications. |
|
PR Description updated to latest commit (61fb076) |
PR Review 🔍
Code feedback:
|
PR Code Suggestions ✨
|
💥 CI tests failed 🙈git-stateall okPlease look at the run or in the Checks tab. |
|
|
sonarcloud coverage report is false positive. |
|
/release to release-5.3 |
|
Working on it! Note that it can take a few minutes. |
…abled (#6281) <!-- Provide a general summary of your changes in the Title above --> - add x-tyk-api-gateway.servers.contextVariables.enabled - enable context variables by default for OAS APIs if not explicitly configured otherwise. <!-- Describe your changes in detail --> Parent: https://tyktech.atlassian.net/browse/TT-11954 Subtask: https://tyktech.atlassian.net/browse/TT-12155 <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> <!-- Why is this change required? What problem does it solve? --> <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ enhancement ___ - Added handling and configuration for context variables in the OAS server structure. - Removed hardcoded enabling of context variables, now configurable via JSON. - Updated tests to reflect new logic and added new tests for context variable configuration. - Updated JSON schema to include new `ContextVariables` definition. ___ <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Update OAS Test to Reflect Context Variable Changes</code> </dd></summary> <hr> apidef/oas/oas_test.go - Removed assertion for `EnableContextVars` in `TestOAS`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+0/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>server_test.go</strong><dd><code>Add Tests for Context Variables in Server Struct</code> </dd></summary> <hr> apidef/oas/server_test.go - Added tests for `ContextVariables` handling in `Server` struct. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-a194795077946243b2b6d04b30be360dbafff8e5eb03e6212081e45d1c72573f">+71/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Test Default Enabling of Context Variables in OAS APIs</code> </dd></summary> <hr> gateway/api_test.go <li>Added tests to ensure context variables are enabled by default and <br>respect explicit configuration.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+21/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>root.go</strong><dd><code>Remove Hardcoded Context Variable Enabling in Root Extraction</code></dd></summary> <hr> apidef/oas/root.go - Removed hardcoded enabling of `EnableContextVars`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-9c56b2bdb992e0a7db76809d4c516e1cd61c9486c7f0437b344c0032476af80f">+0/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>server.go</strong><dd><code>Integrate Context Variables Handling in Server Struct</code> </dd></summary> <hr> apidef/oas/server.go <li>Added handling for <code>ContextVariables</code> in <code>Server</code> struct.<br> <li> Implemented <code>Fill</code> and <code>ExtractTo</code> methods for <code>ContextVariables</code>.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-21857c42e8659f7980014e277c3c758703f29e9e5c0c40553f2584cddb870808">+41/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api.go</strong><dd><code>Default Enable Context Variables for OAS APIs</code> </dd></summary> <hr> gateway/api.go <li>Added default enabling of context variables for OAS APIs if not <br>explicitly set.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-644cda3aeb4ac7f325359e85fcddb810f100dd5e6fa480b0d9f9363a743c4e05">+5/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>x-tyk-api-gateway.json</strong><dd><code>Add JSON Schema for Context Variables</code> </dd></summary> <hr> apidef/oas/schema/x-tyk-api-gateway.json - Added schema definition for `ContextVariables`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-78828969c0c04cc1a776dfc93a8bad3c499a8c83e6169f83e96d090bed3e7dd0">+14/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions (cherry picked from commit 6b7c9ad)
|
@maciejwojciechowski Succesfully merged PR |
|
/release to release-5.3 |
|
Working on it! Note that it can take a few minutes. |
…abled (#6281) <!-- Provide a general summary of your changes in the Title above --> - add x-tyk-api-gateway.servers.contextVariables.enabled - enable context variables by default for OAS APIs if not explicitly configured otherwise. <!-- Describe your changes in detail --> Parent: https://tyktech.atlassian.net/browse/TT-11954 Subtask: https://tyktech.atlassian.net/browse/TT-12155 <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> <!-- Why is this change required? What problem does it solve? --> <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ enhancement ___ - Added handling and configuration for context variables in the OAS server structure. - Removed hardcoded enabling of context variables, now configurable via JSON. - Updated tests to reflect new logic and added new tests for context variable configuration. - Updated JSON schema to include new `ContextVariables` definition. ___ <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Update OAS Test to Reflect Context Variable Changes</code> </dd></summary> <hr> apidef/oas/oas_test.go - Removed assertion for `EnableContextVars` in `TestOAS`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+0/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>server_test.go</strong><dd><code>Add Tests for Context Variables in Server Struct</code> </dd></summary> <hr> apidef/oas/server_test.go - Added tests for `ContextVariables` handling in `Server` struct. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-a194795077946243b2b6d04b30be360dbafff8e5eb03e6212081e45d1c72573f">+71/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Test Default Enabling of Context Variables in OAS APIs</code> </dd></summary> <hr> gateway/api_test.go <li>Added tests to ensure context variables are enabled by default and <br>respect explicit configuration.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+21/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>root.go</strong><dd><code>Remove Hardcoded Context Variable Enabling in Root Extraction</code></dd></summary> <hr> apidef/oas/root.go - Removed hardcoded enabling of `EnableContextVars`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-9c56b2bdb992e0a7db76809d4c516e1cd61c9486c7f0437b344c0032476af80f">+0/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>server.go</strong><dd><code>Integrate Context Variables Handling in Server Struct</code> </dd></summary> <hr> apidef/oas/server.go <li>Added handling for <code>ContextVariables</code> in <code>Server</code> struct.<br> <li> Implemented <code>Fill</code> and <code>ExtractTo</code> methods for <code>ContextVariables</code>.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-21857c42e8659f7980014e277c3c758703f29e9e5c0c40553f2584cddb870808">+41/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api.go</strong><dd><code>Default Enable Context Variables for OAS APIs</code> </dd></summary> <hr> gateway/api.go <li>Added default enabling of context variables for OAS APIs if not <br>explicitly set.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-644cda3aeb4ac7f325359e85fcddb810f100dd5e6fa480b0d9f9363a743c4e05">+5/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>x-tyk-api-gateway.json</strong><dd><code>Add JSON Schema for Context Variables</code> </dd></summary> <hr> apidef/oas/schema/x-tyk-api-gateway.json - Added schema definition for `ContextVariables`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-78828969c0c04cc1a776dfc93a8bad3c499a8c83e6169f83e96d090bed3e7dd0">+14/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions (cherry picked from commit 6b7c9ad)
|
@titpetric Succesfully merged PR |
…abled (#6281) <!-- Provide a general summary of your changes in the Title above --> - add x-tyk-api-gateway.servers.contextVariables.enabled - enable context variables by default for OAS APIs if not explicitly configured otherwise. <!-- Describe your changes in detail --> Parent: https://tyktech.atlassian.net/browse/TT-11954 Subtask: https://tyktech.atlassian.net/browse/TT-12155 <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> <!-- Why is this change required? What problem does it solve? --> <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ enhancement ___ - Added handling and configuration for context variables in the OAS server structure. - Removed hardcoded enabling of context variables, now configurable via JSON. - Updated tests to reflect new logic and added new tests for context variable configuration. - Updated JSON schema to include new `ContextVariables` definition. ___ <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Update OAS Test to Reflect Context Variable Changes</code> </dd></summary> <hr> apidef/oas/oas_test.go - Removed assertion for `EnableContextVars` in `TestOAS`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+0/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>server_test.go</strong><dd><code>Add Tests for Context Variables in Server Struct</code> </dd></summary> <hr> apidef/oas/server_test.go - Added tests for `ContextVariables` handling in `Server` struct. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-a194795077946243b2b6d04b30be360dbafff8e5eb03e6212081e45d1c72573f">+71/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Test Default Enabling of Context Variables in OAS APIs</code> </dd></summary> <hr> gateway/api_test.go <li>Added tests to ensure context variables are enabled by default and <br>respect explicit configuration.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+21/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>root.go</strong><dd><code>Remove Hardcoded Context Variable Enabling in Root Extraction</code></dd></summary> <hr> apidef/oas/root.go - Removed hardcoded enabling of `EnableContextVars`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-9c56b2bdb992e0a7db76809d4c516e1cd61c9486c7f0437b344c0032476af80f">+0/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>server.go</strong><dd><code>Integrate Context Variables Handling in Server Struct</code> </dd></summary> <hr> apidef/oas/server.go <li>Added handling for <code>ContextVariables</code> in <code>Server</code> struct.<br> <li> Implemented <code>Fill</code> and <code>ExtractTo</code> methods for <code>ContextVariables</code>.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-21857c42e8659f7980014e277c3c758703f29e9e5c0c40553f2584cddb870808">+41/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api.go</strong><dd><code>Default Enable Context Variables for OAS APIs</code> </dd></summary> <hr> gateway/api.go <li>Added default enabling of context variables for OAS APIs if not <br>explicitly set.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-644cda3aeb4ac7f325359e85fcddb810f100dd5e6fa480b0d9f9363a743c4e05">+5/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>x-tyk-api-gateway.json</strong><dd><code>Add JSON Schema for Context Variables</code> </dd></summary> <hr> apidef/oas/schema/x-tyk-api-gateway.json - Added schema definition for `ContextVariables`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-78828969c0c04cc1a776dfc93a8bad3c499a8c83e6169f83e96d090bed3e7dd0">+14/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions
#6302) ### **User description** …abled (#6281) <!-- Provide a general summary of your changes in the Title above --> - add x-tyk-api-gateway.servers.contextVariables.enabled - enable context variables by default for OAS APIs if not explicitly configured otherwise. <!-- Describe your changes in detail --> Parent: https://tyktech.atlassian.net/browse/TT-11954 Subtask: https://tyktech.atlassian.net/browse/TT-12155 <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> <!-- Why is this change required? What problem does it solve? --> <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ enhancement ___ - Added handling and configuration for context variables in the OAS server structure. - Removed hardcoded enabling of context variables, now configurable via JSON. - Updated tests to reflect new logic and added new tests for context variable configuration. - Updated JSON schema to include new `ContextVariables` definition. ___ <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Update OAS Test to Reflect Context Variable Changes</code> </dd></summary> <hr> apidef/oas/oas_test.go - Removed assertion for `EnableContextVars` in `TestOAS`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+0/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>server_test.go</strong><dd><code>Add Tests for Context Variables in Server Struct</code> </dd></summary> <hr> apidef/oas/server_test.go - Added tests for `ContextVariables` handling in `Server` struct. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-a194795077946243b2b6d04b30be360dbafff8e5eb03e6212081e45d1c72573f">+71/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Test Default Enabling of Context Variables in OAS APIs</code> </dd></summary> <hr> gateway/api_test.go <li>Added tests to ensure context variables are enabled by default and <br>respect explicit configuration.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+21/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>root.go</strong><dd><code>Remove Hardcoded Context Variable Enabling in Root Extraction</code></dd></summary> <hr> apidef/oas/root.go - Removed hardcoded enabling of `EnableContextVars`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-9c56b2bdb992e0a7db76809d4c516e1cd61c9486c7f0437b344c0032476af80f">+0/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>server.go</strong><dd><code>Integrate Context Variables Handling in Server Struct</code> </dd></summary> <hr> apidef/oas/server.go <li>Added handling for <code>ContextVariables</code> in <code>Server</code> struct.<br> <li> Implemented <code>Fill</code> and <code>ExtractTo</code> methods for <code>ContextVariables</code>.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-21857c42e8659f7980014e277c3c758703f29e9e5c0c40553f2584cddb870808">+41/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api.go</strong><dd><code>Default Enable Context Variables for OAS APIs</code> </dd></summary> <hr> gateway/api.go <li>Added default enabling of context variables for OAS APIs if not <br>explicitly set.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-644cda3aeb4ac7f325359e85fcddb810f100dd5e6fa480b0d9f9363a743c4e05">+5/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>x-tyk-api-gateway.json</strong><dd><code>Add JSON Schema for Context Variables</code> </dd></summary> <hr> apidef/oas/schema/x-tyk-api-gateway.json - Added schema definition for `ContextVariables`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-78828969c0c04cc1a776dfc93a8bad3c499a8c83e6169f83e96d090bed3e7dd0">+14/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions <!-- Provide a general summary of your changes in the Title above --> ## Description <!-- Describe your changes in detail --> ## Related Issue <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ ### **PR Type** Enhancement, Tests ___ ### **Description** - Added `ContextVariables` struct and related methods to manage context variables in OAS APIs. - Updated `Fill` and `ExtractTo` methods in `Server` to handle `ContextVariables`. - Enabled context variables by default for OAS APIs if not explicitly set to false. - Added tests to ensure context variables are enabled by default and can be explicitly disabled. - Updated schema to include `contextVariables` and defined `X-Tyk-ContextVariables`. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Remove assertion for `EnableContextVars` in OAS test.</code> </dd></summary> <hr> apidef/oas/oas_test.go - Removed assertion for `EnableContextVars` in `TestOAS`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+0/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>server_test.go</strong><dd><code>Add tests for ContextVariables in Server.</code> </dd></summary> <hr> apidef/oas/server_test.go - Added tests for `ContextVariables` in `Server`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-a194795077946243b2b6d04b30be360dbafff8e5eb03e6212081e45d1c72573f">+71/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Add tests for default and explicit enabling of context variables.</code></dd></summary> <hr> gateway/api_test.go <li>Added tests to ensure context variables are enabled by default.<br> <li> Added tests to ensure context variables can be explicitly disabled.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+21/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>root.go</strong><dd><code>Remove always enabling context variables in ExtractTo method.</code></dd></summary> <hr> apidef/oas/root.go - Removed always enabling `EnableContextVars` in `ExtractTo` method. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-9c56b2bdb992e0a7db76809d4c516e1cd61c9486c7f0437b344c0032476af80f">+0/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>server.go</strong><dd><code>Add ContextVariables struct and update Fill and ExtractTo methods.</code></dd></summary> <hr> apidef/oas/server.go <li>Added <code>ContextVariables</code> struct and related methods.<br> <li> Updated <code>Fill</code> and <code>ExtractTo</code> methods to handle <code>ContextVariables</code>.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-21857c42e8659f7980014e277c3c758703f29e9e5c0c40553f2584cddb870808">+41/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api.go</strong><dd><code>Enable context variables by default for OAS APIs.</code> </dd></summary> <hr> gateway/api.go <li>Enabled context variables by default for OAS APIs if not explicitly <br>set.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-644cda3aeb4ac7f325359e85fcddb810f100dd5e6fa480b0d9f9363a743c4e05">+5/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>x-tyk-api-gateway.json</strong><dd><code>Add contextVariables to schema and define X-Tyk-ContextVariables.</code></dd></summary> <hr> apidef/oas/schema/x-tyk-api-gateway.json <li>Added <code>contextVariables</code> to the schema.<br> <li> Added <code>X-Tyk-ContextVariables</code> definition.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-78828969c0c04cc1a776dfc93a8bad3c499a8c83e6169f83e96d090bed3e7dd0">+14/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions --------- Co-authored-by: Jeffy Mathew <[email protected]> Co-authored-by: Tit Petric <[email protected]>
…abled (#6281) ### **User description** <!-- Provide a general summary of your changes in the Title above --> - add x-tyk-api-gateway.servers.contextVariables.enabled - enable context variables by default for OAS APIs if not explicitly configured otherwise. <!-- Describe your changes in detail --> Parent: https://tyktech.atlassian.net/browse/TT-11954 Subtask: https://tyktech.atlassian.net/browse/TT-12155 <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ ### **PR Type** enhancement ___ ### **Description** - Added handling and configuration for context variables in the OAS server structure. - Removed hardcoded enabling of context variables, now configurable via JSON. - Updated tests to reflect new logic and added new tests for context variable configuration. - Updated JSON schema to include new `ContextVariables` definition. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Update OAS Test to Reflect Context Variable Changes</code> </dd></summary> <hr> apidef/oas/oas_test.go - Removed assertion for `EnableContextVars` in `TestOAS`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+0/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>server_test.go</strong><dd><code>Add Tests for Context Variables in Server Struct</code> </dd></summary> <hr> apidef/oas/server_test.go - Added tests for `ContextVariables` handling in `Server` struct. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-a194795077946243b2b6d04b30be360dbafff8e5eb03e6212081e45d1c72573f">+71/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Test Default Enabling of Context Variables in OAS APIs</code> </dd></summary> <hr> gateway/api_test.go <li>Added tests to ensure context variables are enabled by default and <br>respect explicit configuration.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+21/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>root.go</strong><dd><code>Remove Hardcoded Context Variable Enabling in Root Extraction</code></dd></summary> <hr> apidef/oas/root.go - Removed hardcoded enabling of `EnableContextVars`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-9c56b2bdb992e0a7db76809d4c516e1cd61c9486c7f0437b344c0032476af80f">+0/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>server.go</strong><dd><code>Integrate Context Variables Handling in Server Struct</code> </dd></summary> <hr> apidef/oas/server.go <li>Added handling for <code>ContextVariables</code> in <code>Server</code> struct.<br> <li> Implemented <code>Fill</code> and <code>ExtractTo</code> methods for <code>ContextVariables</code>.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-21857c42e8659f7980014e277c3c758703f29e9e5c0c40553f2584cddb870808">+41/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api.go</strong><dd><code>Default Enable Context Variables for OAS APIs</code> </dd></summary> <hr> gateway/api.go <li>Added default enabling of context variables for OAS APIs if not <br>explicitly set.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-644cda3aeb4ac7f325359e85fcddb810f100dd5e6fa480b0d9f9363a743c4e05">+5/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>x-tyk-api-gateway.json</strong><dd><code>Add JSON Schema for Context Variables</code> </dd></summary> <hr> apidef/oas/schema/x-tyk-api-gateway.json - Added schema definition for `ContextVariables`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-78828969c0c04cc1a776dfc93a8bad3c499a8c83e6169f83e96d090bed3e7dd0">+14/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions
#6302) ### **User description** …abled (#6281) <!-- Provide a general summary of your changes in the Title above --> - add x-tyk-api-gateway.servers.contextVariables.enabled - enable context variables by default for OAS APIs if not explicitly configured otherwise. <!-- Describe your changes in detail --> Parent: https://tyktech.atlassian.net/browse/TT-11954 Subtask: https://tyktech.atlassian.net/browse/TT-12155 <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> <!-- Why is this change required? What problem does it solve? --> <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ enhancement ___ - Added handling and configuration for context variables in the OAS server structure. - Removed hardcoded enabling of context variables, now configurable via JSON. - Updated tests to reflect new logic and added new tests for context variable configuration. - Updated JSON schema to include new `ContextVariables` definition. ___ <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Update OAS Test to Reflect Context Variable Changes</code> </dd></summary> <hr> apidef/oas/oas_test.go - Removed assertion for `EnableContextVars` in `TestOAS`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+0/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>server_test.go</strong><dd><code>Add Tests for Context Variables in Server Struct</code> </dd></summary> <hr> apidef/oas/server_test.go - Added tests for `ContextVariables` handling in `Server` struct. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-a194795077946243b2b6d04b30be360dbafff8e5eb03e6212081e45d1c72573f">+71/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Test Default Enabling of Context Variables in OAS APIs</code> </dd></summary> <hr> gateway/api_test.go <li>Added tests to ensure context variables are enabled by default and <br>respect explicit configuration.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+21/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>root.go</strong><dd><code>Remove Hardcoded Context Variable Enabling in Root Extraction</code></dd></summary> <hr> apidef/oas/root.go - Removed hardcoded enabling of `EnableContextVars`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-9c56b2bdb992e0a7db76809d4c516e1cd61c9486c7f0437b344c0032476af80f">+0/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>server.go</strong><dd><code>Integrate Context Variables Handling in Server Struct</code> </dd></summary> <hr> apidef/oas/server.go <li>Added handling for <code>ContextVariables</code> in <code>Server</code> struct.<br> <li> Implemented <code>Fill</code> and <code>ExtractTo</code> methods for <code>ContextVariables</code>.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-21857c42e8659f7980014e277c3c758703f29e9e5c0c40553f2584cddb870808">+41/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api.go</strong><dd><code>Default Enable Context Variables for OAS APIs</code> </dd></summary> <hr> gateway/api.go <li>Added default enabling of context variables for OAS APIs if not <br>explicitly set.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-644cda3aeb4ac7f325359e85fcddb810f100dd5e6fa480b0d9f9363a743c4e05">+5/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>x-tyk-api-gateway.json</strong><dd><code>Add JSON Schema for Context Variables</code> </dd></summary> <hr> apidef/oas/schema/x-tyk-api-gateway.json - Added schema definition for `ContextVariables`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-78828969c0c04cc1a776dfc93a8bad3c499a8c83e6169f83e96d090bed3e7dd0">+14/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions <!-- Provide a general summary of your changes in the Title above --> ## Description <!-- Describe your changes in detail --> ## Related Issue <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ ### **PR Type** Enhancement, Tests ___ ### **Description** - Added `ContextVariables` struct and related methods to manage context variables in OAS APIs. - Updated `Fill` and `ExtractTo` methods in `Server` to handle `ContextVariables`. - Enabled context variables by default for OAS APIs if not explicitly set to false. - Added tests to ensure context variables are enabled by default and can be explicitly disabled. - Updated schema to include `contextVariables` and defined `X-Tyk-ContextVariables`. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Remove assertion for `EnableContextVars` in OAS test.</code> </dd></summary> <hr> apidef/oas/oas_test.go - Removed assertion for `EnableContextVars` in `TestOAS`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+0/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>server_test.go</strong><dd><code>Add tests for ContextVariables in Server.</code> </dd></summary> <hr> apidef/oas/server_test.go - Added tests for `ContextVariables` in `Server`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-a194795077946243b2b6d04b30be360dbafff8e5eb03e6212081e45d1c72573f">+71/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Add tests for default and explicit enabling of context variables.</code></dd></summary> <hr> gateway/api_test.go <li>Added tests to ensure context variables are enabled by default.<br> <li> Added tests to ensure context variables can be explicitly disabled.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+21/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>root.go</strong><dd><code>Remove always enabling context variables in ExtractTo method.</code></dd></summary> <hr> apidef/oas/root.go - Removed always enabling `EnableContextVars` in `ExtractTo` method. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-9c56b2bdb992e0a7db76809d4c516e1cd61c9486c7f0437b344c0032476af80f">+0/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>server.go</strong><dd><code>Add ContextVariables struct and update Fill and ExtractTo methods.</code></dd></summary> <hr> apidef/oas/server.go <li>Added <code>ContextVariables</code> struct and related methods.<br> <li> Updated <code>Fill</code> and <code>ExtractTo</code> methods to handle <code>ContextVariables</code>.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-21857c42e8659f7980014e277c3c758703f29e9e5c0c40553f2584cddb870808">+41/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api.go</strong><dd><code>Enable context variables by default for OAS APIs.</code> </dd></summary> <hr> gateway/api.go <li>Enabled context variables by default for OAS APIs if not explicitly <br>set.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-644cda3aeb4ac7f325359e85fcddb810f100dd5e6fa480b0d9f9363a743c4e05">+5/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>x-tyk-api-gateway.json</strong><dd><code>Add contextVariables to schema and define X-Tyk-ContextVariables.</code></dd></summary> <hr> apidef/oas/schema/x-tyk-api-gateway.json <li>Added <code>contextVariables</code> to the schema.<br> <li> Added <code>X-Tyk-ContextVariables</code> definition.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-78828969c0c04cc1a776dfc93a8bad3c499a8c83e6169f83e96d090bed3e7dd0">+14/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions --------- Co-authored-by: Jeffy Mathew <[email protected]> Co-authored-by: Tit Petric <[email protected]>
#6302) ### **User description** …abled (#6281) <!-- Provide a general summary of your changes in the Title above --> - add x-tyk-api-gateway.servers.contextVariables.enabled - enable context variables by default for OAS APIs if not explicitly configured otherwise. <!-- Describe your changes in detail --> Parent: https://tyktech.atlassian.net/browse/TT-11954 Subtask: https://tyktech.atlassian.net/browse/TT-12155 <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> <!-- Why is this change required? What problem does it solve? --> <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ enhancement ___ - Added handling and configuration for context variables in the OAS server structure. - Removed hardcoded enabling of context variables, now configurable via JSON. - Updated tests to reflect new logic and added new tests for context variable configuration. - Updated JSON schema to include new `ContextVariables` definition. ___ <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Update OAS Test to Reflect Context Variable Changes</code> </dd></summary> <hr> apidef/oas/oas_test.go - Removed assertion for `EnableContextVars` in `TestOAS`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+0/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>server_test.go</strong><dd><code>Add Tests for Context Variables in Server Struct</code> </dd></summary> <hr> apidef/oas/server_test.go - Added tests for `ContextVariables` handling in `Server` struct. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-a194795077946243b2b6d04b30be360dbafff8e5eb03e6212081e45d1c72573f">+71/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Test Default Enabling of Context Variables in OAS APIs</code> </dd></summary> <hr> gateway/api_test.go <li>Added tests to ensure context variables are enabled by default and <br>respect explicit configuration.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+21/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>root.go</strong><dd><code>Remove Hardcoded Context Variable Enabling in Root Extraction</code></dd></summary> <hr> apidef/oas/root.go - Removed hardcoded enabling of `EnableContextVars`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-9c56b2bdb992e0a7db76809d4c516e1cd61c9486c7f0437b344c0032476af80f">+0/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>server.go</strong><dd><code>Integrate Context Variables Handling in Server Struct</code> </dd></summary> <hr> apidef/oas/server.go <li>Added handling for <code>ContextVariables</code> in <code>Server</code> struct.<br> <li> Implemented <code>Fill</code> and <code>ExtractTo</code> methods for <code>ContextVariables</code>.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-21857c42e8659f7980014e277c3c758703f29e9e5c0c40553f2584cddb870808">+41/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api.go</strong><dd><code>Default Enable Context Variables for OAS APIs</code> </dd></summary> <hr> gateway/api.go <li>Added default enabling of context variables for OAS APIs if not <br>explicitly set.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-644cda3aeb4ac7f325359e85fcddb810f100dd5e6fa480b0d9f9363a743c4e05">+5/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>x-tyk-api-gateway.json</strong><dd><code>Add JSON Schema for Context Variables</code> </dd></summary> <hr> apidef/oas/schema/x-tyk-api-gateway.json - Added schema definition for `ContextVariables`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-78828969c0c04cc1a776dfc93a8bad3c499a8c83e6169f83e96d090bed3e7dd0">+14/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions <!-- Provide a general summary of your changes in the Title above --> ## Description <!-- Describe your changes in detail --> ## Related Issue <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ ### **PR Type** Enhancement, Tests ___ ### **Description** - Added `ContextVariables` struct and related methods to manage context variables in OAS APIs. - Updated `Fill` and `ExtractTo` methods in `Server` to handle `ContextVariables`. - Enabled context variables by default for OAS APIs if not explicitly set to false. - Added tests to ensure context variables are enabled by default and can be explicitly disabled. - Updated schema to include `contextVariables` and defined `X-Tyk-ContextVariables`. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Remove assertion for `EnableContextVars` in OAS test.</code> </dd></summary> <hr> apidef/oas/oas_test.go - Removed assertion for `EnableContextVars` in `TestOAS`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+0/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>server_test.go</strong><dd><code>Add tests for ContextVariables in Server.</code> </dd></summary> <hr> apidef/oas/server_test.go - Added tests for `ContextVariables` in `Server`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-a194795077946243b2b6d04b30be360dbafff8e5eb03e6212081e45d1c72573f">+71/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Add tests for default and explicit enabling of context variables.</code></dd></summary> <hr> gateway/api_test.go <li>Added tests to ensure context variables are enabled by default.<br> <li> Added tests to ensure context variables can be explicitly disabled.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+21/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>root.go</strong><dd><code>Remove always enabling context variables in ExtractTo method.</code></dd></summary> <hr> apidef/oas/root.go - Removed always enabling `EnableContextVars` in `ExtractTo` method. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-9c56b2bdb992e0a7db76809d4c516e1cd61c9486c7f0437b344c0032476af80f">+0/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>server.go</strong><dd><code>Add ContextVariables struct and update Fill and ExtractTo methods.</code></dd></summary> <hr> apidef/oas/server.go <li>Added <code>ContextVariables</code> struct and related methods.<br> <li> Updated <code>Fill</code> and <code>ExtractTo</code> methods to handle <code>ContextVariables</code>.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-21857c42e8659f7980014e277c3c758703f29e9e5c0c40553f2584cddb870808">+41/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api.go</strong><dd><code>Enable context variables by default for OAS APIs.</code> </dd></summary> <hr> gateway/api.go <li>Enabled context variables by default for OAS APIs if not explicitly <br>set.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-644cda3aeb4ac7f325359e85fcddb810f100dd5e6fa480b0d9f9363a743c4e05">+5/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>x-tyk-api-gateway.json</strong><dd><code>Add contextVariables to schema and define X-Tyk-ContextVariables.</code></dd></summary> <hr> apidef/oas/schema/x-tyk-api-gateway.json <li>Added <code>contextVariables</code> to the schema.<br> <li> Added <code>X-Tyk-ContextVariables</code> definition.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-78828969c0c04cc1a776dfc93a8bad3c499a8c83e6169f83e96d090bed3e7dd0">+14/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions --------- Co-authored-by: Jeffy Mathew <[email protected]> Co-authored-by: Tit Petric <[email protected]>
TykTechnologies#6302) ### **User description** …abled (TykTechnologies#6281) <!-- Provide a general summary of your changes in the Title above --> - add x-tyk-api-gateway.servers.contextVariables.enabled - enable context variables by default for OAS APIs if not explicitly configured otherwise. <!-- Describe your changes in detail --> Parent: https://tyktech.atlassian.net/browse/TT-11954 Subtask: https://tyktech.atlassian.net/browse/TT-12155 <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> <!-- Why is this change required? What problem does it solve? --> <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ enhancement ___ - Added handling and configuration for context variables in the OAS server structure. - Removed hardcoded enabling of context variables, now configurable via JSON. - Updated tests to reflect new logic and added new tests for context variable configuration. - Updated JSON schema to include new `ContextVariables` definition. ___ <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Update OAS Test to Reflect Context Variable Changes</code> </dd></summary> <hr> apidef/oas/oas_test.go - Removed assertion for `EnableContextVars` in `TestOAS`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+0/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>server_test.go</strong><dd><code>Add Tests for Context Variables in Server Struct</code> </dd></summary> <hr> apidef/oas/server_test.go - Added tests for `ContextVariables` handling in `Server` struct. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-a194795077946243b2b6d04b30be360dbafff8e5eb03e6212081e45d1c72573f">+71/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Test Default Enabling of Context Variables in OAS APIs</code> </dd></summary> <hr> gateway/api_test.go <li>Added tests to ensure context variables are enabled by default and <br>respect explicit configuration.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+21/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>root.go</strong><dd><code>Remove Hardcoded Context Variable Enabling in Root Extraction</code></dd></summary> <hr> apidef/oas/root.go - Removed hardcoded enabling of `EnableContextVars`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-9c56b2bdb992e0a7db76809d4c516e1cd61c9486c7f0437b344c0032476af80f">+0/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>server.go</strong><dd><code>Integrate Context Variables Handling in Server Struct</code> </dd></summary> <hr> apidef/oas/server.go <li>Added handling for <code>ContextVariables</code> in <code>Server</code> struct.<br> <li> Implemented <code>Fill</code> and <code>ExtractTo</code> methods for <code>ContextVariables</code>.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-21857c42e8659f7980014e277c3c758703f29e9e5c0c40553f2584cddb870808">+41/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api.go</strong><dd><code>Default Enable Context Variables for OAS APIs</code> </dd></summary> <hr> gateway/api.go <li>Added default enabling of context variables for OAS APIs if not <br>explicitly set.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-644cda3aeb4ac7f325359e85fcddb810f100dd5e6fa480b0d9f9363a743c4e05">+5/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>x-tyk-api-gateway.json</strong><dd><code>Add JSON Schema for Context Variables</code> </dd></summary> <hr> apidef/oas/schema/x-tyk-api-gateway.json - Added schema definition for `ContextVariables`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6281/files#diff-78828969c0c04cc1a776dfc93a8bad3c499a8c83e6169f83e96d090bed3e7dd0">+14/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions <!-- Provide a general summary of your changes in the Title above --> ## Description <!-- Describe your changes in detail --> ## Related Issue <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ ### **PR Type** Enhancement, Tests ___ ### **Description** - Added `ContextVariables` struct and related methods to manage context variables in OAS APIs. - Updated `Fill` and `ExtractTo` methods in `Server` to handle `ContextVariables`. - Enabled context variables by default for OAS APIs if not explicitly set to false. - Added tests to ensure context variables are enabled by default and can be explicitly disabled. - Updated schema to include `contextVariables` and defined `X-Tyk-ContextVariables`. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Remove assertion for `EnableContextVars` in OAS test.</code> </dd></summary> <hr> apidef/oas/oas_test.go - Removed assertion for `EnableContextVars` in `TestOAS`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+0/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>server_test.go</strong><dd><code>Add tests for ContextVariables in Server.</code> </dd></summary> <hr> apidef/oas/server_test.go - Added tests for `ContextVariables` in `Server`. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-a194795077946243b2b6d04b30be360dbafff8e5eb03e6212081e45d1c72573f">+71/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Add tests for default and explicit enabling of context variables.</code></dd></summary> <hr> gateway/api_test.go <li>Added tests to ensure context variables are enabled by default.<br> <li> Added tests to ensure context variables can be explicitly disabled.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+21/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement </strong></td><td><table> <tr> <td> <details> <summary><strong>root.go</strong><dd><code>Remove always enabling context variables in ExtractTo method.</code></dd></summary> <hr> apidef/oas/root.go - Removed always enabling `EnableContextVars` in `ExtractTo` method. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-9c56b2bdb992e0a7db76809d4c516e1cd61c9486c7f0437b344c0032476af80f">+0/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>server.go</strong><dd><code>Add ContextVariables struct and update Fill and ExtractTo methods.</code></dd></summary> <hr> apidef/oas/server.go <li>Added <code>ContextVariables</code> struct and related methods.<br> <li> Updated <code>Fill</code> and <code>ExtractTo</code> methods to handle <code>ContextVariables</code>.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-21857c42e8659f7980014e277c3c758703f29e9e5c0c40553f2584cddb870808">+41/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>api.go</strong><dd><code>Enable context variables by default for OAS APIs.</code> </dd></summary> <hr> gateway/api.go <li>Enabled context variables by default for OAS APIs if not explicitly <br>set.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-644cda3aeb4ac7f325359e85fcddb810f100dd5e6fa480b0d9f9363a743c4e05">+5/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>x-tyk-api-gateway.json</strong><dd><code>Add contextVariables to schema and define X-Tyk-ContextVariables.</code></dd></summary> <hr> apidef/oas/schema/x-tyk-api-gateway.json <li>Added <code>contextVariables</code> to the schema.<br> <li> Added <code>X-Tyk-ContextVariables</code> definition.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6302/files#diff-78828969c0c04cc1a776dfc93a8bad3c499a8c83e6169f83e96d090bed3e7dd0">+14/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions --------- Co-authored-by: Jeffy Mathew <[email protected]> Co-authored-by: Tit Petric <[email protected]>



User description
Parent: https://tyktech.atlassian.net/browse/TT-11954
Subtask: https://tyktech.atlassian.net/browse/TT-12155
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
Checklist
PR Type
enhancement
Description
ContextVariablesdefinition.Changes walkthrough 📝
oas_test.go
Update OAS Test to Reflect Context Variable Changesapidef/oas/oas_test.go
EnableContextVarsinTestOAS.server_test.go
Add Tests for Context Variables in Server Structapidef/oas/server_test.go
ContextVariableshandling inServerstruct.api_test.go
Test Default Enabling of Context Variables in OAS APIsgateway/api_test.go
respect explicit configuration.
root.go
Remove Hardcoded Context Variable Enabling in Root Extractionapidef/oas/root.go
EnableContextVars.server.go
Integrate Context Variables Handling in Server Structapidef/oas/server.go
ContextVariablesinServerstruct.FillandExtractTomethods forContextVariables.api.go
Default Enable Context Variables for OAS APIsgateway/api.go
explicitly set.
x-tyk-api-gateway.json
Add JSON Schema for Context Variablesapidef/oas/schema/x-tyk-api-gateway.json
ContextVariables.