Skip to content
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

[DX-993, TT-11639] Updated multiple middleware for OAS #4012

Merged
merged 17 commits into from
Mar 27, 2024

Conversation

andyo-tyk
Copy link
Contributor

@andyo-tyk andyo-tyk commented Jan 23, 2024

User description

Preview Link

https://deploy-preview-4012--tyk-docs.netlify.app/docs/nightly/planning-for-production/ensure-high-availability/circuit-breakers/
https://deploy-preview-4012--tyk-docs.netlify.app/docs/nightly/planning-for-production/ensure-high-availability/enforced-timeouts/
https://deploy-preview-4012--tyk-docs.netlify.app/docs/nightly/advanced-configuration/transform-traffic/request-method-transform/
https://deploy-preview-4012--tyk-docs.netlify.app/docs/nightly/transform-traffic/request-headers/

Description

Updated and improved the docs, adding Tyk OAS, for:

  • Circuit Breaker
  • Enforced Timeout
  • Request Method Transform
  • Request Header Transform (API and endpoint level)

Type

enhancement, documentation


Description

  • Updated and enhanced documentation for various middleware configurations, including circuit breakers, enforced timeouts, request method transform, and request header transform.
  • Introduced new documentation for configuring these middleware in both Tyk OAS and Tyk Classic APIs.
  • Provided detailed examples and instructions for middleware configuration through the API definition and the Dashboard.

Changes walkthrough

Relevant files
Documentation
12 files
request-method-transform.md
Enhance Request Method Transform Documentation                     

tyk-docs/content/advanced-configuration/transform-traffic/request-method-transform.md

  • Updated the document title and added tags for better categorization.
  • Enhanced the description to provide a clearer overview of the
    middleware's purpose.
  • Added sections on when to use the middleware, how it works, and
    configuration examples for both Tyk OAS and Tyk Classic APIs.
  • +24/-24 
    circuit-breakers.md
    Update Circuit Breakers Documentation with Detailed Overview and
    Configuration Examples

    tyk-docs/content/planning-for-production/ensure-high-availability/circuit-breakers.md

  • Introduced a comprehensive overview of circuit breakers, including
    their purpose and operation.
  • Detailed scenarios for using circuit breakers and explained the
    configuration parameters.
  • Added configuration examples for Tyk OAS and Tyk Classic APIs.
  • +63/-89 
    enforced-timeouts.md
    Revise Enforced Timeouts Documentation with Operation Details and
    Examples

    tyk-docs/content/planning-for-production/ensure-high-availability/enforced-timeouts.md

  • Provided an overview of enforced timeouts and their importance in
    system stability.
  • Explained when to use enforced timeouts and detailed the middleware
    operation.
  • Included configuration examples for Tyk OAS and Tyk Classic APIs.
  • +36/-27 
    circuit-breaker-tyk-classic.md
    New Document on Configuring Circuit Breaker Middleware for Tyk Classic
    APIs

    tyk-docs/content/product-stack/tyk-gateway/middleware/circuit-breaker-tyk-classic.md

  • Created a new document detailing how to configure the circuit breaker
    middleware for Tyk Classic APIs.
  • Included step-by-step instructions for configuration through the API
    definition and the Dashboard.
  • +71/-0   
    circuit-breaker-tyk-oas.md
    New Guide for Circuit Breaker Configuration in Tyk OAS APIs

    tyk-docs/content/product-stack/tyk-gateway/middleware/circuit-breaker-tyk-oas.md

  • Introduced a new document for configuring circuit breaker middleware
    in Tyk OAS APIs.
  • Provided a complete example of a Tyk OAS API definition with circuit
    breaker configuration.
  • +124/-0 
    enforced-timeout-tyk-classic.md
    New Documentation on Enforced Timeout Middleware for Tyk Classic APIs

    tyk-docs/content/product-stack/tyk-gateway/middleware/enforced-timeout-tyk-classic.md

  • Created documentation on setting up enforced timeout middleware for
    Tyk Classic APIs.
  • Offered detailed configuration instructions for both the API
    definition and the Dashboard.
  • +58/-0   
    enforced-timeout-tyk-oas.md
    Guide for Configuring Enforced Timeout Middleware in Tyk OAS APIs

    tyk-docs/content/product-stack/tyk-gateway/middleware/enforced-timeout-tyk-oas.md

  • Introduced new documentation for configuring enforced timeout
    middleware in Tyk OAS APIs.
  • Included a comprehensive Tyk OAS API definition example with enforced
    timeout configuration.
  • +109/-0 
    request-header-tyk-classic.md
    New Documentation on Request Header Transform Middleware for Tyk
    Classic APIs

    tyk-docs/content/product-stack/tyk-gateway/middleware/request-header-tyk-classic.md

  • New document on configuring request header transform middleware for
    Tyk Classic APIs.
  • Provided examples and instructions for API-level and endpoint-level
    header transformation.
  • +139/-0 
    request-header-tyk-oas.md
    Guide for Request Header Transform Middleware Configuration in Tyk OAS
    APIs

    tyk-docs/content/product-stack/tyk-gateway/middleware/request-header-tyk-oas.md

  • New guide on setting up request header transform middleware in Tyk OAS
    APIs.
  • Detailed configuration examples for both API-level and endpoint-level
    transformations.
  • +232/-0 
    request-method-tyk-classic.md
    New Documentation on Configuring Request Method Transform for Tyk
    Classic APIs

    tyk-docs/content/product-stack/tyk-gateway/middleware/request-method-tyk-classic.md

  • Introduced documentation for configuring request method transform
    middleware in Tyk Classic APIs.
  • Included detailed instructions for configuration via the API
    definition and the Dashboard.
  • +60/-0   
    request-method-tyk-oas.md
    Guide for Request Method Transform Configuration in Tyk OAS APIs

    tyk-docs/content/product-stack/tyk-gateway/middleware/request-method-tyk-oas.md

  • New documentation on setting up request method transform middleware in
    Tyk OAS APIs.
  • Provided a complete Tyk OAS API definition example with request method
    transform configuration.
  • +107/-0 
    request-headers.md
    Enhance Request Header Transform Documentation                     

    tyk-docs/content/transform-traffic/request-headers.md

  • Updated the document title and added tags for better categorization.
  • Enhanced the description to provide a clearer overview of the
    middleware's purpose.
  • Added sections on when to use the middleware, how it works, and
    configuration examples for both Tyk OAS and Tyk Classic APIs.
  • +37/-139

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Copy link
    Contributor

    PR Analysis

    • 🎯 Main theme: Updated multiple middleware for OAS
    • 📝 PR summary: Updated and improved the docs, adding Tyk OAS for Circuit Breaker, Enforced Timeout, Request Method Transform, and Request Header Transform (API and endpoint level).
    • 📌 Type of PR: Enhancement
    • 🧪 Relevant tests added: False
    • ⏱️ Estimated effort to review [1-5]: 3, because the PR adds new documentation and updates existing one, which requires careful review and verification of the changes.
    • 🔒 Security concerns: No security concerns found

    PR Feedback

    • 💡 General suggestions:

      • The PR description could be more concise and focused on the specific changes made in the PR.
      • It would be helpful to provide more context and examples in the PR description to better understand the changes made.
      • Consider adding a preview link to easily access and review the updated documentation.
    🤖 Code feedback:
    relevant filetyk-docs/content/planning-for-production/ensure-high-availability/circuit-breakers.md
    suggestion      

    Consider adding a note or warning about the potential impact of the circuit breaker on the overall system performance and the importance of properly configuring the threshold and recovery time.

    relevant lineA circuit breaker is a protective mechanism that helps to maintain system stability by preventing repeated failures and overloading of services that are erroring.

    relevant filetyk-docs/content/transform-traffic/request-headers.md
    suggestion      

    Consider providing more examples and use cases for modifying request headers, to help users understand the potential benefits and use cases of this feature.

    relevant lineThere are two options for this:

    relevant filetyk-docs/content/product-stack/tyk-gateway/middleware/request-header-tyk-oas.md
    suggestion      

    Consider providing more details and examples on how to configure the request header transform middleware in the Tyk OAS API Definition.

    relevant lineWhen working with Tyk OAS APIs, then you can find details and examples of how to configure the request header transform middleware [here

    relevant filetyk-docs/content/getting-started/using-oas-definitions/oas-reference.md
    suggestion      

    Update the table to reflect the correct support for each feature in Tyk Classic and Tyk OAS APIs.

    relevant line| Circuit Breaker | ❌️ | ❌️ |


    ✨ Usage guide:

    Overview:
    The review tool scans the PR code changes, and generates a PR review. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
    When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:

    /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
    

    With a configuration file, use the following template:

    [pr_reviewer]
    some_config1=...
    some_config2=...
    
    Utilizing extra instructions

    The review tool can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.

    Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-tool, and the relevant aspects of the PR that you want to emphasize.

    Examples for extra instructions:

    [pr_reviewer] # /review #
    extra_instructions="""
    In the code feedback section, emphasize the following:
    - Does the code logic cover relevant edge cases?
    - Is the code logic clear and easy to understand?
    - Is the code logic efficient?
    ...
    """
    

    Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

    How to enable\disable automation
    • When you first install PR-Agent app, the default mode for the review tool is:
    pr_commands = ["/review", ...]
    

    meaning the review tool will run automatically on every PR, with the default configuration.
    Edit this field to enable/disable the tool, or to change the used configurations

    About the 'Code feedback' section

    The review tool provides several type of feedbacks, one of them is code suggestions.
    If you are interested only in the code suggestions, it is recommended to use the improve feature instead, since it dedicated only to code suggestions, and usually gives better results.
    Use the review tool if you want to get a more comprehensive feedback, which includes code suggestions as well.

    Auto-labels

    The review tool can auto-generate two specific types of labels for a PR:

    • a possible security issue label, that detects possible security issues (enable_review_labels_security flag)
    • a Review effort [1-5]: x label, where x is the estimated effort to review the PR (enable_review_labels_effort flag)
    Extra sub-tools

    The review tool provides a collection of possible feedbacks about a PR.
    It is recommended to review the possible options, and choose the ones relevant for your use case.
    Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example:
    require_score_review, require_soc2_review, enable_review_labels_effort, and more.

    More PR-Agent commands

    To invoke the PR-Agent, add a comment using one of the following commands:

    • /review: Request a review of your Pull Request.
    • /describe: Update the PR title and description based on the contents of the PR.
    • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
    • /ask <QUESTION>: Ask a question about the PR.
    • /update_changelog: Update the changelog based on the PR's contents.
    • /add_docs 💎: Generate docstring for new components introduced in the PR.
    • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
    • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

    See the tools guide for more details.
    To list the possible configuration parameters, add a /config comment.

    See the review usage page for a comprehensive guide on using this tool.

    Copy link

    netlify bot commented Jan 23, 2024

    PS. Pls add /docs/nightly to the end of url

    Name Link
    🔨 Latest commit 7165fa1
    🔍 Latest deploy log https://app.netlify.com/sites/tyk-docs/deploys/65afe7368ea1950008499487
    😎 Deploy Preview https://deploy-preview-4012--tyk-docs.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    Copy link

    netlify bot commented Jan 23, 2024

    PS. Pls add /docs/nightly to the end of url

    Name Link
    🔨 Latest commit 31a17c8
    🔍 Latest deploy log https://app.netlify.com/sites/tyk-docs/deploys/660466af3809c50008fa44e9
    😎 Deploy Preview https://deploy-preview-4012--tyk-docs.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    @andyo-tyk andyo-tyk changed the title Updated multiple middleware for OAS [DX-993] Updated multiple middleware for OAS Jan 23, 2024
    andyo-tyk and others added 2 commits January 23, 2024 16:29
    Copy link
    Contributor

    @dcs3spp dcs3spp left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    @andyo-tyk Thanks for submitting the updated middleware content for OAS.

    So far I have reviewed

    • circuit breakers
    • enforced timeouts
    • circuit breaker tyk classic APIs
    • circuit breaker tyk OAS APIs
    • enforced timeout
    • enforced timeout Tyk Classic
    • request header transformations for tyk classic

    I will continue to review the remaining content files tomorrow

    @letzya
    Copy link
    Collaborator

    letzya commented Jan 23, 2024

    @andyo-tyk this is a massive PR :). It's hard to review such a big PR. Going forward, if possible (I appreciate that sometimes it's not), please avoid that.
    Also - it's for 5.3 right? could you please label it as such (so we know to merge to master but not to latest)

    @andyo-tyk
    Copy link
    Contributor Author

    @andyo-tyk this is a massive PR :). It's hard to review such a big PR. Going forward, if possible (I appreciate that sometimes it's not), please avoid that. Also - it's for 5.3 right? could you please label it as such (so we know to merge to master but not to latest)

    Yes - and I've acknowledged and apologised for that in the DX ticket. I'm sorry that on this one occasion I haven't yet added the release version. It's pending peer/technical review so this omission isn't critical.

    Copy link
    Contributor Author

    @andyo-tyk andyo-tyk left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Corrected some copy/paste errors in Request Header OAS page

    Copy link
    Contributor

    @dcs3spp dcs3spp left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    PR LGTM, have made minor suggestions and made a suggestion of adding a file to content/shared for content shared in summary footer of some pages

    Copy link
    Contributor Author

    @andyo-tyk andyo-tyk left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Removed H2 Overview titles

    @andyo-tyk andyo-tyk changed the title [DX-993] Updated multiple middleware for OAS [DX-993, TT-11639] Updated multiple middleware for OAS Mar 27, 2024
    @andyo-tyk andyo-tyk removed the request for review from Yasintrm March 27, 2024 17:11
    @andyo-tyk andyo-tyk requested review from dcs3spp and andrei-tyk March 27, 2024 18:01
    @andyo-tyk andyo-tyk marked this pull request as ready for review March 27, 2024 18:10
    Copy link
    Contributor

    PR Description updated to latest commit (de82a73)

    Copy link
    Contributor

    PR Review

    ⏱️ Estimated effort to review [1-5]

    2, because the PR involves updates across multiple documentation pages related to middleware configurations for both Tyk Classic and Tyk OAS APIs. The changes are well-organized and focused on enhancing the clarity and completeness of the documentation. However, reviewing the technical accuracy of the configurations and ensuring the examples are correct and consistent across different middleware types requires a moderate level of effort.

    🧪 Relevant tests

    No

    🔍 Possible issues

    Possible Issue: The documentation updates introduce new pages and restructure existing content. It's crucial to ensure all internal and external links pointing to the modified sections are updated to prevent broken links.

    Possible Issue: The use of placeholders like {{< ref "transform-traffic/request-body" >}} for links in the markdown files. These placeholders need to be correctly resolved to actual URLs during the website build process. There's a risk of broken links if the references are not correctly mapped.

    🔒 Security concerns

    No

    Code feedback:
    relevant filetyk-docs/content/transform-traffic/request-headers.md
    suggestion      

    Consider adding a section on "Security Considerations" when transforming request headers. Manipulating headers like Authorization can have security implications, such as accidentally exposing sensitive tokens to upstream services or logging systems. Highlighting best practices and common pitfalls could help users implement header transformations more securely. [important]

    relevant lineTyk allows you to modify the headers of incoming requests to your API endpoints before they are passed to your upstream service.

    relevant filetyk-docs/content/planning-for-production/ensure-high-availability/circuit-breakers.md
    suggestion      

    Add a note or warning about the potential impact of using circuit breakers in a microservices architecture, especially regarding cascading failures. While circuit breakers are designed to prevent such issues, improper configuration can lead to widespread outages. Providing guidance on setting thresholds and testing circuit breaker behavior under load could be invaluable for users. [important]

    relevant lineA circuit breaker is a protective mechanism that helps to maintain system stability by preventing repeated failures and overloading of services that are erroring.

    relevant filetyk-docs/content/product-stack/tyk-gateway/middleware/request-method-tyk-oas.md
    suggestion      

    Include examples of how the transformed HTTP method affects the request's handling by the upstream service, especially for methods with significant semantic differences like GET vs. POST. This could help users understand the implications of method transformations on RESTful APIs, where the method can dictate behavior. [medium]

    relevant lineIn this example the Request Method Transform middleware has been configured for requests to the `GET /status/200` endpoint.

    relevant filetyk-docs/content/product-stack/tyk-gateway/middleware/request-header-tyk-classic.md
    suggestion      

    Recommend the use of environment variables for sensitive values when adding headers globally or per endpoint. This practice can prevent hardcoding secrets in the API definition files, which might be checked into version control. An example of using environment variables in the header values could enhance the documentation. [medium]

    relevant line"add_headers": {"x-widgets-secret": "the-secret-widget-key-is-secret"},


    ✨ Review tool usage guide:

    Overview:
    The review tool scans the PR code changes, and generates a PR review which includes several types of feedbacks, such as possible PR issues, security threats and relevant test in the PR. More feedbacks can be added by configuring the tool.

    The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.

    • When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:
    /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
    
    [pr_reviewer]
    some_config1=...
    some_config2=...
    

    See the review usage page for a comprehensive guide on using this tool.

    Copy link
    Contributor

    github-actions bot commented Mar 27, 2024

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Enhancement
    Add a section on limitations or known issues of the Request Method Transform middleware.

    Consider adding a section on limitations or known issues with the Request Method Transform
    middleware. This would help users understand any potential challenges or behaviors to
    expect when using this feature, enhancing the documentation's completeness and usefulness.

    tyk-docs/content/advanced-configuration/transform-traffic/request-method-transform.md [8]

    -Tyk's Request Method Transform middleware allows you to modify the HTTP method of incoming requests to an API endpoint prior to the request being proxied to the upstream service.
    +Tyk's Request Method Transform middleware allows you to modify the HTTP method of incoming requests to an API endpoint prior to the request being proxied to the upstream service. 
     
    +## Limitations and Known Issues
    +- List any limitations or known issues here.
    +
    Add guidance on monitoring and analyzing circuit breaker performance.

    Consider adding a section on how to monitor and analyze the performance of the circuit
    breaker. This could include guidance on logging, metrics to watch, and how to interpret
    these metrics to make informed decisions about adjusting circuit breaker parameters for
    optimal performance.

    tyk-docs/content/planning-for-production/ensure-high-availability/circuit-breakers.md [14]

    -Tyk can trigger events when the circuit breaker trips and when it resets. These events can be used for monitoring, alerting, or automation of recovery processes.
    +Tyk can trigger events when the circuit breaker trips and when it resets. These events can be used for monitoring, alerting, or automation of recovery processes. Additionally, consider monitoring key performance indicators (KPIs) such as the rate of tripped events, recovery times, and the impact on upstream services. This data can be invaluable for tuning the circuit breaker settings to match the characteristics of your environment.
     
    Include real-world examples of enforced timeouts improving system performance.

    It would be beneficial to include examples of real-world scenarios where enforced timeouts
    have prevented system instability or improved performance. This can help users understand
    the practical applications and benefits of using enforced timeouts in their own systems.

    tyk-docs/content/planning-for-production/ensure-high-availability/enforced-timeouts.md [34]

    -The enforced timeout middleware is enabled and configured at the endpoint level.
    +The enforced timeout middleware is enabled and configured at the endpoint level. For example, in a high-traffic e-commerce platform, setting an enforced timeout on payment processing endpoints can prevent system overload during peak shopping periods, ensuring a smooth checkout process for users.
     
    Discuss potential drawbacks of enforced timeouts to aid decision-making.

    To provide a more comprehensive understanding of the enforced timeout feature, consider
    adding a section that discusses potential drawbacks or scenarios where using enforced
    timeouts might not be ideal. This can help users make more informed decisions about when
    and how to use this feature effectively.

    tyk-docs/content/planning-for-production/ensure-high-availability/enforced-timeouts.md [8]

    -In any system, a task or operation takes a certain period of time to complete. When a client makes a request to the Tyk Gateway, it will be dependent upon the responsiveness of the upstream service before it can continue. If the upstream service is suffering from resource overload or congestion the response may be returned too late leading to unacceptable experience for the end user or even to instability in the system.
    +In any system, a task or operation takes a certain period of time to complete. When a client makes a request to the Tyk Gateway, it will be dependent upon the responsiveness of the upstream service before it can continue. If the upstream service is suffering from resource overload or congestion the response may be returned too late leading to unacceptable experience for the end user or even to instability in the system. However, it's important to consider scenarios where enforced timeouts might not be ideal, such as operations that require a longer processing time due to their complexity. In such cases, alternative strategies should be considered.
     
    Add code snippets or configuration examples for setting up the circuit breaker.

    To improve the document's utility for developers, consider adding code snippets or
    configuration examples showing how to set up and customize the circuit breaker. This
    practical guidance can help users quickly implement the feature in their projects.

    tyk-docs/content/planning-for-production/ensure-high-availability/circuit-breakers.md [58-61]

     The circuit breaker is configured using only three parameters:
     - sample size
     - error rate threshold
     - cooldown period
    +Here's an example configuration:
    +```json
    +{
    +  "circuit_breaker": {
    +    "sample_size": 100,
    +    "error_rate_threshold": 0.5,
    +    "cooldown_period": 30
    +  }
    +}
    +```
    +This configuration sets up a circuit breaker with a sample size of 100 requests, a 50% error rate threshold, and a 30-second cooldown period.
     
    Adjust the acceptable range for threshold_percent to ensure the circuit breaker's effectiveness.

    Consider using a more specific range for the threshold_percent configuration in the
    circuit_breakers object to ensure it's within a practical range. For example, a threshold
    too close to 0.0 might be too sensitive, causing the circuit breaker to trip too
    frequently, while a value too close to 1.0 might make it too lenient.

    tyk-docs/content/product-stack/tyk-gateway/middleware/circuit-breaker-tyk-classic.md [19]

    -- `threshold_percent`: the proportion of requests that can error before the breaker is tripped, this must be a value between 0.0 and 1.0
    +- `threshold_percent`: the proportion of requests that can error before the breaker is tripped, this must be a value between 0.1 and 0.9 to ensure a balance between sensitivity and leniency.
     
    Specify a practical range for timeout to enhance reliability.

    To ensure the timeout configuration is within a practical range, specify a minimum and
    maximum value. This prevents setting a timeout too low, which could lead to premature
    request termination, or too high, which might delay identifying issues with the upstream
    service.

    tyk-docs/content/product-stack/tyk-gateway/middleware/enforced-timeout-tyk-classic.md [21]

    -- `timeout`: the duration of the upstream request timer
    +- `timeout`: the duration of the upstream request timer, must be a value between 1 and 30 (seconds) to prevent too short or too long timeouts.
     
    Rename the file for better clarity and findability.

    Consider using a more descriptive file name that reflects the content's focus on both
    API-level and endpoint-level request header transformations with Tyk Classic APIs. This
    can improve the findability and clarity of the documentation for users. For example,
    renaming the file to api-and-endpoint-request-header-transform-tyk-classic.md could make
    the document's purpose and scope clearer at a glance.

    tyk-docs/content/product-stack/tyk-gateway/middleware/request-header-tyk-classic.md [2]

    -title: Using the Request Header Transform with Tyk Classic APIs
    +title: Using API and Endpoint Request Header Transform with Tyk Classic APIs
     
    Add comments to JSON examples for better understanding.

    For the JSON examples provided, consider adding a brief explanation or comment within the
    code block to clarify the purpose of specific fields or values. This can help users
    understand the significance of each part of the configuration, especially for complex
    configurations. For example, explaining the use of $tyk_context.request_id and
    $tyk_meta.uid in the context of dynamic data.

    tyk-docs/content/product-stack/tyk-gateway/middleware/request-header-tyk-classic.md [36-53]

    -```json  {hl_lines=["39-45"],linenos=true, linenostart=1}
    +```json
     {
         "version_data": {
             "versions": {
                 "Default": {
                     "global_headers": {
    -                    "X-Static": "foobar",
    -                    "X-Request-ID":"$tyk_context.request_id",
    -                    "X-User-ID": "$tyk_meta.uid"
    +                    "X-Static": "foobar", // A static header added to all requests
    +                    "X-Request-ID":"$tyk_context.request_id", // Dynamic value from request context
    +                    "X-User-ID": "$tyk_meta.uid" // Dynamic value from session metadata
                     },
                     "global_headers_remove": [
    -                    "Auth_Id"
    +                    "Auth_Id" // Header to be removed from all requests
                     ]
                 }
             }
         },
     }
                       
    </details></td></tr><tr><td>
    
    
    
    <details><summary>Add a table of contents for better document navigation.</summary>
    
    ___
    
    
    **To enhance the document's accessibility and usability, consider adding a table of contents <br>at the beginning. This table of contents should link to the major sections and subsections <br>within the document. This improvement can significantly aid users in navigating the <br>document, especially when looking for specific information in a lengthy document.**
        
    [tyk-docs/content/product-stack/tyk-gateway/middleware/request-header-tyk-classic.md [1-6]](https://github.com/TykTechnologies/tyk-docs/pull/4012/files#diff-2b8d7eb6abcd81e52f5955ba294009309b94ab4db7a34d53274266d94340b985R1-R6)
    
    ```diff
     ---
     title: Using the Request Header Transform with Tyk Classic APIs
     date: 2024-01-20
     description: "Using the Request Header Transform middleware with Tyk Classic APIs"
     tags: ["Request Header Transform", "middleware", "per-endpoint","per-API", "Tyk Classic"]
     ---
     
    +## Table of Contents
    +- [Introduction](#introduction)
    +- [Configuring the Request Header Transform](#configuring-the-request-header-transform)
    +  - [API-level Transform](#api-level-transform)
    +  - [Endpoint-level Transform](#endpoint-level-transform)
    +- [Configuring in the API Designer](#configuring-in-the-api-designer)
    +...
    +
    
    Clarity
    Rephrase the note about enabling context variables for Tyk Classic APIs for clarity.

    To improve clarity and user understanding, consider rephrasing the note about enabling
    context variables for Tyk Classic APIs. Specifically, clarify the steps and ensure the
    language is consistent and straightforward.

    tyk-docs/content/context-variables.md [18]

    -When using Tyk Classic APIs, you must [enable]({{< ref "#enabling-context-variables-for-use-with-tyk-classic-apis" >}}) context variables for the API to be able to access them.
    +For Tyk Classic APIs, enabling context variables is necessary for their use. Follow the steps in the [Enabling Context Variables section]({{< ref "#enabling-context-variables-for-use-with-tyk-classic-apis" >}}) to enable them.
     
    Consistency
    Use consistent symbols for indicating feature availability in tables.

    For consistency and to avoid confusion, consider using consistent symbols or emojis for
    indicating feature availability across all tables in the document. If "✅" indicates
    available features, ensure it is used consistently without mixing with other symbols.

    tyk-docs/content/getting-started/using-oas-definitions/oas-reference.md [27-29]

     | API Categories                        | ✅               | ✅            |
     | API Ownership                         | ✅               | ✅            |
    +(Ensure consistent use of "✅" across all tables for feature availability.)
     
    User-friendliness
    Add a quick start guide or example configurations for the Request Method Transform middleware.

    To enhance the documentation's accessibility and user-friendliness, consider adding a
    quick start guide or example configurations at the beginning of the document. This can
    help users quickly understand how to use the Request Method Transform middleware with
    minimal setup.

    tyk-docs/content/advanced-configuration/transform-traffic/request-method-transform.md [8]

     Tyk's Request Method Transform middleware allows you to modify the HTTP method of incoming requests to an API endpoint prior to the request being proxied to the upstream service.
     
    +## Quick Start Guide
    +Here's a simple example to get you started with the Request Method Transform middleware:
    +- Example configuration here.
    +
    Structure
    Move the "Enabling Context Variables" section to the beginning of the document for better structure.

    To improve the document's structure and readability, consider moving the "Enabling Context
    Variables for use with Tyk Classic APIs" section to the beginning of the document. This
    reorganization can help users understand the prerequisites before diving into the details
    of context variables.

    tyk-docs/content/context-variables.md [13]

    +## Enabling Context Variables for use with Tyk Classic APIs
    +1. In the your Tyk Dashboard, select `APIs` from the `System Management` menu 
    +2. Open the API you want to add Context Variable to
    +3. Click the `Advanced Options` tab and then select the `Enable context variables` option
    +
     Context variables are extracted from the request at the start of the middleware chain.
     
    Maintainability
    Improve document readability by breaking down large paragraphs.

    To enhance the readability and maintainability of the document, consider breaking down the
    large paragraphs into bullet points or smaller sections. This can help readers quickly
    find the information they need and understand complex concepts more easily.

    tyk-docs/content/planning-for-production/ensure-high-availability/circuit-breakers.md [10]

    -A circuit breaker is a protective mechanism that helps to maintain system stability by preventing repeated failures and overloading of services that are erroring. When a network or service failure occurs, the circuit breaker prevents further calls to that service, allowing the affected service time to recover while ensuring that the overall system remains functional. It is a critical component in ensuring the resilience and reliability of a distributed system.
    +A circuit breaker is a protective mechanism that:
    +- Helps maintain system stability.
    +- Prevents repeated failures and overloading of services.
    +- Allows affected services time to recover while ensuring the overall system remains functional.
    +It is a critical component in ensuring the resilience and reliability of a distributed system.
     
    Rename threshold to failureRateThreshold for better clarity.

    To improve clarity and maintainability, consider renaming threshold to
    failureRateThreshold in the circuitBreaker configuration. This change would make it
    immediately clear that this configuration pertains to the rate of failures, enhancing
    readability.

    tyk-docs/content/product-stack/tyk-gateway/middleware/circuit-breaker-tyk-oas.md [22]

    -- `threshold`: the proportion of requests that can error before the breaker is tripped, this must be a value between 0.0 and 1.0
    +- `failureRateThreshold`: the proportion of requests that can error before the breaker is tripped, this must be a value between 0.0 and 1.0
     
    Rename value to timeoutSeconds for clarity and explicitness.

    To improve the configuration's expressiveness and prevent potential confusion, consider
    renaming value to timeoutSeconds in the enforceTimeout middleware configuration. This
    explicitly indicates the unit of measurement and the configuration's purpose.

    tyk-docs/content/product-stack/tyk-gateway/middleware/enforced-timeout-tyk-oas.md [22]

    -- `value`: the duration of the upstream request timer
    +- `timeoutSeconds`: the duration of the upstream request timer, in seconds
     
    Remove non-standard JSON code block options for better compatibility.

    To enhance the maintainability and readability of the JSON configuration example, consider
    removing the hl_lines and linenos options from the code block. These options are not
    standard in JSON and might confuse readers or editors not familiar with the specific
    markdown renderer used.

    tyk-docs/content/product-stack/tyk-gateway/middleware/circuit-breaker-tyk-oas.md [27]

    -```json {hl_lines=["39-45"],linenos=true, linenostart=1}
    +```json
     
    Use a more generic term than "Tyk Classic APIs" to future-proof the documentation.

    To ensure compatibility and future-proofing of the documentation, consider using a more
    generic term than "Tyk Classic APIs" since product names and categorizations can evolve. A
    term like "Legacy Tyk APIs" might be less susceptible to becoming outdated if the product
    naming conventions change.

    tyk-docs/content/product-stack/tyk-gateway/middleware/request-header-tyk-classic.md [4]

    -Using the Request Header Transform middleware with Tyk Classic APIs
    +Using the Request Header Transform middleware with Legacy Tyk APIs
     
    Break down large sections into smaller, focused subsections for better readability.

    To improve the readability and navigability of the document, consider breaking down the
    large sections into smaller, more focused subsections. For instance, separate the
    configuration examples for API-level and endpoint-level transformations into distinct
    subsections with their own headers. This can make the document easier to follow and allow
    readers to quickly find the information most relevant to their needs.

    tyk-docs/content/product-stack/tyk-gateway/middleware/request-header-tyk-classic.md [26]

    -## Configuring the Request Header Transform in the Tyk Classic API Definition
    +## Configuring the Request Header Transform
    +### In the Tyk Classic API Definition
    +#### API-level Transform
    +...
    +#### Endpoint-level Transform
    +...
     

    ✨ Improve tool usage guide:

    Overview:
    The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.

    • When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:
    /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
    
    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    

    See the improve usage page for a comprehensive guide on using this tool.

    Copy link
    Contributor

    @dcs3spp dcs3spp left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    @andyo-tyk PR LGTM, I have reviewed changes and made small fix suggestions. Once @andrei-tyk has peer approved also, we can merge ready for release.

    @dcs3spp dcs3spp merged commit 82c63c9 into master Mar 27, 2024
    10 checks passed
    @dcs3spp dcs3spp deleted the Various-OAS-middleware-updates branch March 27, 2024 18:41
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    4 participants