Skip to content

[TT-11440/TT-11461] Add functionName to replace name in OAS virtual endpoint and endpoint post plugin#6098

Merged
jeffy-mathew merged 7 commits into
masterfrom
fix/TT-11440/TT-11461/rename-name-to-functionName
Mar 7, 2024
Merged

[TT-11440/TT-11461] Add functionName to replace name in OAS virtual endpoint and endpoint post plugin#6098
jeffy-mathew merged 7 commits into
masterfrom
fix/TT-11440/TT-11461/rename-name-to-functionName

Conversation

@jeffy-mathew

@jeffy-mathew jeffy-mathew commented Mar 5, 2024

Copy link
Copy Markdown
Contributor

User description

Add functionName to replace name in OAS virtual endpoint and endpoint post plugin

Related Issue

https://tyktech.atlassian.net/browse/TT-11440
https://tyktech.atlassian.net/browse/TT-11461

Motivation and Context

How This Has Been Tested

Screenshots (if appropriate)

Types of changes

  • 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

  • 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

Type

enhancement


Description

  • Deprecated Name field in favor of FunctionName for both VirtualEndpoint and EndpointPostPlugin configurations to clarify the purpose and usage.
  • Ensured backward compatibility by retaining the Name field but marking it as deprecated.
  • Updated related methods (Fill and ExtractTo) to prioritize FunctionName over Name when both are provided.
  • Modified and added unit tests to reflect changes and validate the precedence of FunctionName over Name.

Changes walkthrough

Relevant files
Enhancement
middleware.go
Deprecate Name in Favor of FunctionName for Plugin Configurations

apidef/oas/middleware.go

  • Deprecated Name in favor of FunctionName for both VirtualEndpoint and
    EndpointPostPlugin.
  • Added handling to prefer FunctionName over Name if both are provided.
  • Updated Fill and ExtractTo methods to support the new FunctionName
    field.
  • +26/-9   
    Tests
    middleware_test.go
    Update Tests for FunctionName Precedence and Usage             

    apidef/oas/middleware_test.go

  • Updated tests to use FunctionName instead of Name.
  • Added tests to ensure FunctionName has precedence over Name.
  • +59/-6   

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

    @github-actions

    github-actions Bot commented Mar 5, 2024

    Copy link
    Copy Markdown
    Contributor

    PR Description updated to latest commit (dcd71f8)

    @github-actions

    github-actions Bot commented Mar 5, 2024

    Copy link
    Copy Markdown
    Contributor

    API Changes

    --- prev.txt	2024-03-07 10:21:37.552528783 +0000
    +++ current.txt	2024-03-07 10:21:34.772509738 +0000
    @@ -2850,12 +2850,20 @@
     	// Enabled activates post plugin.
     	Enabled bool `bson:"enabled" json:"enabled"` // required.
     	// Name is the name of plugin function to be executed.
    -	Name string `bson:"name" json:"name"` // required.
    +	// Deprecated: Use FunctionName instead.
    +	Name string `bson:"name,omitempty" json:"name,omitempty"`
    +	// FunctionName is the name of plugin function to be executed.
    +	FunctionName string `bson:"functionName" json:"functionName"` // required.
     	// Path is the path to plugin.
     	Path string `bson:"path" json:"path"` // required.
     }
         EndpointPostPlugin contains endpoint level post plugin configuration.
     
    +func (ep *EndpointPostPlugin) MarshalJSON() ([]byte, error)
    +    MarshalJSON is a custom JSON marshaler for the EndpointPostPlugin struct.
    +    It is implemented to facilitate a smooth migration from deprecated fields
    +    that were previously used to represent the same data.
    +
     type EndpointPostPlugins []EndpointPostPlugin
     
     func (e EndpointPostPlugins) ExtractTo(meta *apidef.GoPluginMeta)
    @@ -4266,8 +4274,11 @@
     type VirtualEndpoint struct {
     	// Enabled activates virtual endpoint.
     	Enabled bool `bson:"enabled" json:"enabled"` // required.
    -	// Name is the name of JS function.
    -	Name string `bson:"name" json:"name"` // required.
    +	// Name is the name of plugin function to be executed.
    +	// Deprecated: Use FunctionName instead.
    +	Name string `bson:"name,omitempty" json:"name,omitempty"`
    +	// FunctionName is the name of plugin function to be executed.
    +	FunctionName string `bson:"functionName" json:"functionName"` // required.
     	// Path is the path to JS file.
     	Path string `bson:"path,omitempty" json:"path,omitempty"`
     	// Body is the JS function to execute encoded in base64 format.
    @@ -4285,6 +4296,11 @@
     func (v *VirtualEndpoint) Fill(meta apidef.VirtualMeta)
         Fill fills *VirtualEndpoint from apidef.VirtualMeta.
     
    +func (v *VirtualEndpoint) MarshalJSON() ([]byte, error)
    +    MarshalJSON is a custom JSON marshaler for the VirtualEndpoint struct.
    +    It is implemented to facilitate a smooth migration from deprecated fields
    +    that were previously used to represent the same data.
    +
     type XTykAPIGateway struct {
     	// Info contains the main metadata for the API definition.
     	Info Info `bson:"info" json:"info"` // required

    @github-actions

    github-actions Bot commented Mar 5, 2024

    Copy link
    Copy Markdown
    Contributor

    PR Review

    ⏱️ Estimated effort to review [1-5]

    3, because the PR involves changes in the data structure that could have wide-ranging effects across the codebase. Understanding the implications of these changes on existing functionality and ensuring backward compatibility requires a thorough review.

    🧪 Relevant tests

    No

    🔍 Possible issues

    Possible Bug: The deprecation of Name in favor of FunctionName without a clear migration or compatibility strategy for existing configurations might lead to issues with current deployments. It's crucial to ensure that existing configurations using Name do not break after this update.

    🔒 Security concerns

    No

    Code feedback:
    relevant fileapidef/oas/middleware.go
    suggestion      

    Consider implementing a migration strategy or compatibility layer for configurations using the deprecated Name field. This could involve automatically copying the value from Name to FunctionName if FunctionName is empty, ensuring backward compatibility. [important]

    relevant lineName string `bson:"name,omitempty" json:"name,omitempty"`

    relevant fileapidef/oas/middleware.go
    suggestion      

    Ensure that the deprecation of the Name field and the introduction of FunctionName are clearly documented, including any necessary steps users must take when upgrading. This is crucial for avoiding confusion and support issues. [important]

    relevant line// Deprecated: Use FunctionName instead.

    relevant fileapidef/oas/middleware_test.go
    suggestion      

    Add tests to verify the behavior when both Name and FunctionName are provided, ensuring that FunctionName takes precedence as expected. This will help prevent regressions in the future. [medium]

    relevant lineName: "virtualFunc",

    relevant fileapidef/oas/middleware_test.go
    suggestion      

    Add tests to ensure that existing configurations using the Name field continue to work as expected, to verify backward compatibility. This is important for ensuring a smooth transition for users. [medium]

    relevant lineName: "virtualFunc",


    ✨ Review tool 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 'possible issues' 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

    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_ticket, and more.

    Auto-approve PRs

    By invoking:

    /review auto_approve
    

    The tool will automatically approve the PR, and add a comment with the approval.

    To ensure safety, the auto-approval feature is disabled by default. To enable auto-approval, you need to actively set in a pre-defined configuration file the following:

    [pr_reviewer]
    enable_auto_approval = true
    

    (this specific flag cannot be set with a command line argument, only in the configuration file, committed to the repository)

    You can also enable auto-approval only if the PR meets certain requirements, such as that the estimated_review_effort is equal or below a certain threshold, by adjusting the flag:

    [pr_reviewer]
    maximal_review_effort = 5
    
    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.

    @github-actions

    github-actions Bot commented Mar 5, 2024

    Copy link
    Copy Markdown
    Contributor

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Enhancement
    Remove unnecessary operations on deprecated fields.

    Since Name is deprecated and should not be used, it's better to remove the line that
    explicitly sets v.Name = "" after assigning v.FunctionName. This avoids unnecessary
    operations on a deprecated field.

    apidef/oas/middleware.go [1225-1226]

     v.FunctionName = meta.ResponseFunctionName
    -v.Name = ""
     
    Best practice
    Ensure backward compatibility by using Name as a fallback.

    To ensure backward compatibility and avoid potential issues with existing configurations,
    it's recommended to add a check that ensures v.Name is only used if v.FunctionName is
    empty. This way, v.Name acts as a fallback.

    apidef/oas/middleware.go [1239-1243]

     if v.FunctionName != "" {
         meta.ResponseFunctionName = v.FunctionName
    -    v.Name = ""
    -} else {
    +} else if v.Name != "" {
         meta.ResponseFunctionName = v.Name
     }
     
    Performance
    Optimize field assignment logic for better efficiency.

    For the ExtractTo method of EndpointPostPlugin, it's more efficient to directly assign the
    most relevant field (FunctionName if not empty, otherwise Name) to meta.SymbolName without
    modifying the EndpointPostPlugin instance itself.

    apidef/oas/middleware.go [1293-1296]

    -if e[0].FunctionName != "" {
    -    meta.SymbolName = e[0].FunctionName
    -} else {
    +meta.SymbolName = e[0].FunctionName
    +if meta.SymbolName == "" {
         meta.SymbolName = e[0].Name
     }
     
    Test improvement
    Ensure test cases accurately reflect their intended purpose.

    To ensure the test case "functionName should have precedence" accurately reflects its
    purpose, it's important to assert that FunctionName takes precedence over Name when both
    are provided. This can be done by initially setting Name to a different value than
    FunctionName and then asserting that the FunctionName is the one used.

    apidef/oas/middleware_test.go [693-694]

    -Name:           "virtualFunc",
    +Name:           "oldVirtualFunc",  # Changed to indicate it's the old function name
     FunctionName:   "newVirtualFunc",
     
    Verify precedence logic in test cases for clarity and correctness.

    In the test case "value - function name should have precedence", it's crucial to assert
    that when both Name and FunctionName are provided, FunctionName is used, and Name is
    ignored. This ensures the precedence logic is correctly implemented and tested.

    apidef/oas/middleware_test.go [771-772]

    -Name:         "symbolFunc",
    +Name:         "oldSymbolFunc",  # Indicate it's the deprecated or old function name
     FunctionName: "newSymbolFunc",
     

    ✨ 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=...
    

    With a configuration file, use the following template:

    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    
    Enabling\disabling automation

    When you first install the app, the default mode for the improve tool is:

    pr_commands = ["/improve --pr_code_suggestions.summarize=true", ...]
    

    meaning the improve tool will run automatically on every PR, with summarization enabled. Delete this line to disable the tool from running automatically.

    Utilizing extra instructions

    Extra instructions are very important for the improve tool, since they enable to guide the model to suggestions that are more relevant to the specific needs of the project.

    Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify relevant aspects that you want the model to focus on.

    Examples for extra instructions:

    [pr_code_suggestions] # /improve #
    extra_instructions="""
    Emphasize the following aspects:
    - 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.

    A note on code suggestions quality
    • While the current AI for code is getting better and better (GPT-4), it's not flawless. Not all the suggestions will be perfect, and a user should not accept all of them automatically.
    • Suggestions are not meant to be simplistic. Instead, they aim to give deep feedback and raise questions, ideas and thoughts to the user, who can then use his judgment, experience, and understanding of the code base.
    • Recommended to use the 'extra_instructions' field to guide the model to suggestions that are more relevant to the specific needs of the project, or use the custom suggestions 💎 tool
    • With large PRs, best quality will be obtained by using 'improve --extended' mode.
    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 improve usage page for a more comprehensive guide on using this tool.

    @github-actions

    github-actions Bot commented Mar 5, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    all ok

    Please look at the run or in the Checks tab.

    1 similar comment
    @github-actions

    github-actions Bot commented Mar 5, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    all ok

    Please look at the run or in the Checks tab.

    @buger

    buger commented Mar 5, 2024

    Copy link
    Copy Markdown
    Member

    API tests result - postgres15-sha256 env: success
    Branch used: refs/heads/master
    Commit: f101b1d [TT-11440/TT-11461] Add functionName to replace name in OAS virtual endpoint and endpoint post plugin (#6098)

    User description

    Add functionName to replace name in OAS virtual endpoint and endpoint
    post plugin

    Related Issue

    https://tyktech.atlassian.net/browse/TT-11440
    https://tyktech.atlassian.net/browse/TT-11461

    Motivation and Context

    How This Has Been Tested

    Screenshots (if appropriate)

    Types of changes

    • 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

    • 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

    Type

    enhancement


    Description

    • Deprecated Name field in favor of FunctionName for both
      VirtualEndpoint and EndpointPostPlugin configurations to clarify the
      purpose and usage.
    • Ensured backward compatibility by retaining the Name field but
      marking it as deprecated.
    • Updated related methods (Fill and ExtractTo) to prioritize
      FunctionName over Name when both are provided.
    • Modified and added unit tests to reflect changes and validate the
      precedence of FunctionName over Name.

    Changes walkthrough

    Relevant files
    Enhancement
    middleware.go
    Deprecate Name in Favor of FunctionName for Plugin Configurations

    apidef/oas/middleware.go

  • Deprecated Name in favor of FunctionName for both VirtualEndpoint and
    EndpointPostPlugin.
  • Added handling to prefer FunctionName over Name if both are provided.
  • Updated Fill and ExtractTo methods to support the new FunctionName
    field.
  • +26/-9   
    Tests
    middleware_test.go
    Update Tests for FunctionName Precedence and Usage             

    apidef/oas/middleware_test.go

  • Updated tests to use FunctionName instead of Name.
  • Added tests to ensure FunctionName has precedence over Name.
  • +59/-6   

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions
    Triggered by: push (@jeffy-mathew)
    Execution page

    @buger

    buger commented Mar 5, 2024

    Copy link
    Copy Markdown
    Member

    API tests result - mongo44-sha256 env: success
    Branch used: refs/heads/master
    Commit: f101b1d [TT-11440/TT-11461] Add functionName to replace name in OAS virtual endpoint and endpoint post plugin (#6098)

    User description

    Add functionName to replace name in OAS virtual endpoint and endpoint
    post plugin

    Related Issue

    https://tyktech.atlassian.net/browse/TT-11440
    https://tyktech.atlassian.net/browse/TT-11461

    Motivation and Context

    How This Has Been Tested

    Screenshots (if appropriate)

    Types of changes

    • 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

    • 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

    Type

    enhancement


    Description

    • Deprecated Name field in favor of FunctionName for both
      VirtualEndpoint and EndpointPostPlugin configurations to clarify the
      purpose and usage.
    • Ensured backward compatibility by retaining the Name field but
      marking it as deprecated.
    • Updated related methods (Fill and ExtractTo) to prioritize
      FunctionName over Name when both are provided.
    • Modified and added unit tests to reflect changes and validate the
      precedence of FunctionName over Name.

    Changes walkthrough

    Relevant files
    Enhancement
    middleware.go
    Deprecate Name in Favor of FunctionName for Plugin Configurations

    apidef/oas/middleware.go

  • Deprecated Name in favor of FunctionName for both VirtualEndpoint and
    EndpointPostPlugin.
  • Added handling to prefer FunctionName over Name if both are provided.
  • Updated Fill and ExtractTo methods to support the new FunctionName
    field.
  • +26/-9   
    Tests
    middleware_test.go
    Update Tests for FunctionName Precedence and Usage             

    apidef/oas/middleware_test.go

  • Updated tests to use FunctionName instead of Name.
  • Added tests to ensure FunctionName has precedence over Name.
  • +59/-6   

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions
    Triggered by: push (@jeffy-mathew)
    Execution page

    @github-actions

    github-actions Bot commented Mar 6, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    all ok

    Please look at the run or in the Checks tab.

    @jeffy-mathew
    jeffy-mathew force-pushed the fix/TT-11440/TT-11461/rename-name-to-functionName branch from 829e3fc to 3e7bf2e Compare March 6, 2024 15:22
    @github-actions

    github-actions Bot commented Mar 6, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    all ok

    Please look at the run or in the Checks tab.

    @github-actions

    github-actions Bot commented Mar 6, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    all ok

    Please look at the run or in the Checks tab.

    @github-actions

    github-actions Bot commented Mar 6, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    all ok

    Please look at the run or in the Checks tab.

    @github-actions

    github-actions Bot commented Mar 6, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    all ok

    Please look at the run or in the Checks tab.

    Comment thread apidef/oas/middleware.go Outdated
    // the same data.
    func (v *VirtualEndpoint) MarshalJSON() ([]byte, error) {
    if v.FunctionName == "" && v.Name != "" {
    v.FunctionName = v.Name

    Copy link
    Copy Markdown
    Contributor

    Choose a reason for hiding this comment

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

    This is probablly not great, marshaller writing out to v may cause side effects; all fields are primitives so it makes sense to make a copy into the Alias type?

    @jeffy-mathew
    jeffy-mathew force-pushed the fix/TT-11440/TT-11461/rename-name-to-functionName branch from a625089 to 38c8b06 Compare March 7, 2024 10:21
    @sonarqubecloud

    sonarqubecloud Bot commented Mar 7, 2024

    Copy link
    Copy Markdown

    @github-actions

    github-actions Bot commented Mar 7, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    all ok

    Please look at the run or in the Checks tab.

    @jeffy-mathew
    jeffy-mathew enabled auto-merge (squash) March 7, 2024 10:42
    @jeffy-mathew
    jeffy-mathew merged commit f101b1d into master Mar 7, 2024
    @jeffy-mathew
    jeffy-mathew deleted the fix/TT-11440/TT-11461/rename-name-to-functionName branch March 7, 2024 10:44
    @jeffy-mathew

    Copy link
    Copy Markdown
    Contributor Author

    /release to release-5.3

    @jeffy-mathew

    Copy link
    Copy Markdown
    Contributor Author

    /release to release-5.3.0

    @tykbot

    tykbot Bot commented Mar 7, 2024

    Copy link
    Copy Markdown

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

    tykbot Bot pushed a commit that referenced this pull request Mar 7, 2024
    …ndpoint and endpoint post plugin (#6098)
    
    ## **User description**
    <!-- Provide a general summary of your changes in the Title above -->
    
    Add functionName to replace name in OAS virtual endpoint and endpoint
    post plugin
    <!-- Describe your changes in detail -->
    
    ## Related Issue
    https://tyktech.atlassian.net/browse/TT-11440
    https://tyktech.atlassian.net/browse/TT-11461
    
    ## 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
    
    
    ___
    
    ## **Type**
    enhancement
    
    
    ___
    
    ## **Description**
    - Deprecated `Name` field in favor of `FunctionName` for both
    `VirtualEndpoint` and `EndpointPostPlugin` configurations to clarify the
    purpose and usage.
    - Ensured backward compatibility by retaining the `Name` field but
    marking it as deprecated.
    - Updated related methods (`Fill` and `ExtractTo`) to prioritize
    `FunctionName` over `Name` when both are provided.
    - Modified and added unit tests to reflect changes and validate the
    precedence of `FunctionName` over `Name`.
    
    
    ___
    
    
    
    ## **Changes walkthrough**
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>middleware.go</strong><dd><code>Deprecate Name in Favor
    of FunctionName for Plugin Configurations</code></dd></summary>
    <hr>
    
    apidef/oas/middleware.go
    <li>Deprecated <code>Name</code> in favor of <code>FunctionName</code>
    for both <code>VirtualEndpoint</code> and
    <br><code>EndpointPostPlugin</code>.<br> <li> Added handling to prefer
    <code>FunctionName</code> over <code>Name</code> if both are
    provided.<br> <li> Updated <code>Fill</code> and <code>ExtractTo</code>
    methods to support the new <code>FunctionName</code> <br>field.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6098/files#diff-992ec7c28d25fd54f6491d295389757705cd114bc869a35cba50d42e548cdc6e">+26/-9</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>middleware_test.go</strong><dd><code>Update Tests for
    FunctionName Precedence and Usage</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    apidef/oas/middleware_test.go
    <li>Updated tests to use <code>FunctionName</code> instead of
    <code>Name</code>.<br> <li> Added tests to ensure
    <code>FunctionName</code> has precedence over <code>Name</code>.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6098/files#diff-0af31cb29ae298a6ac3e402b283ab364a6fd793fd04f253ef7c4983234c17bef">+59/-6</a>&nbsp;
    &nbsp; </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 f101b1d)
    @tykbot

    tykbot Bot commented Mar 7, 2024

    Copy link
    Copy Markdown

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

    @tykbot

    tykbot Bot commented Mar 7, 2024

    Copy link
    Copy Markdown

    @jeffy-mathew Seems like there is conflict and it require manual merge.

    tykbot Bot pushed a commit that referenced this pull request Mar 7, 2024
    …ndpoint and endpoint post plugin (#6098)
    
    ## **User description**
    <!-- Provide a general summary of your changes in the Title above -->
    
    Add functionName to replace name in OAS virtual endpoint and endpoint
    post plugin
    <!-- Describe your changes in detail -->
    
    ## Related Issue
    https://tyktech.atlassian.net/browse/TT-11440
    https://tyktech.atlassian.net/browse/TT-11461
    
    ## 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
    
    
    ___
    
    ## **Type**
    enhancement
    
    
    ___
    
    ## **Description**
    - Deprecated `Name` field in favor of `FunctionName` for both
    `VirtualEndpoint` and `EndpointPostPlugin` configurations to clarify the
    purpose and usage.
    - Ensured backward compatibility by retaining the `Name` field but
    marking it as deprecated.
    - Updated related methods (`Fill` and `ExtractTo`) to prioritize
    `FunctionName` over `Name` when both are provided.
    - Modified and added unit tests to reflect changes and validate the
    precedence of `FunctionName` over `Name`.
    
    
    ___
    
    
    
    ## **Changes walkthrough**
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>middleware.go</strong><dd><code>Deprecate Name in Favor
    of FunctionName for Plugin Configurations</code></dd></summary>
    <hr>
    
    apidef/oas/middleware.go
    <li>Deprecated <code>Name</code> in favor of <code>FunctionName</code>
    for both <code>VirtualEndpoint</code> and
    <br><code>EndpointPostPlugin</code>.<br> <li> Added handling to prefer
    <code>FunctionName</code> over <code>Name</code> if both are
    provided.<br> <li> Updated <code>Fill</code> and <code>ExtractTo</code>
    methods to support the new <code>FunctionName</code> <br>field.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6098/files#diff-992ec7c28d25fd54f6491d295389757705cd114bc869a35cba50d42e548cdc6e">+26/-9</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>middleware_test.go</strong><dd><code>Update Tests for
    FunctionName Precedence and Usage</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    apidef/oas/middleware_test.go
    <li>Updated tests to use <code>FunctionName</code> instead of
    <code>Name</code>.<br> <li> Added tests to ensure
    <code>FunctionName</code> has precedence over <code>Name</code>.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6098/files#diff-0af31cb29ae298a6ac3e402b283ab364a6fd793fd04f253ef7c4983234c17bef">+59/-6</a>&nbsp;
    &nbsp; </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 f101b1d)
    buger added a commit that referenced this pull request Mar 7, 2024
    …lace name in OAS virtual endpoint and endpoint post plugin (#6098)
    
    [TT-11440/TT-11461] Add functionName to replace name in OAS virtual endpoint and endpoint  post plugin (#6098)
    
    ## **User description**
    <!-- Provide a general summary of your changes in the Title above -->
    
    Add functionName to replace name in OAS virtual endpoint and endpoint
    post plugin
    <!-- Describe your changes in detail -->
    
    ## Related Issue
    https://tyktech.atlassian.net/browse/TT-11440
    https://tyktech.atlassian.net/browse/TT-11461
    
    ## 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
    
    
    ___
    
    ## **Type**
    enhancement
    
    
    ___
    
    ## **Description**
    - Deprecated `Name` field in favor of `FunctionName` for both
    `VirtualEndpoint` and `EndpointPostPlugin` configurations to clarify the
    purpose and usage.
    - Ensured backward compatibility by retaining the `Name` field but
    marking it as deprecated.
    - Updated related methods (`Fill` and `ExtractTo`) to prioritize
    `FunctionName` over `Name` when both are provided.
    - Modified and added unit tests to reflect changes and validate the
    precedence of `FunctionName` over `Name`.
    
    
    ___
    
    
    
    ## **Changes walkthrough**
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>middleware.go</strong><dd><code>Deprecate Name in Favor
    of FunctionName for Plugin Configurations</code></dd></summary>
    <hr>
    
    apidef/oas/middleware.go
    <li>Deprecated <code>Name</code> in favor of <code>FunctionName</code>
    for both <code>VirtualEndpoint</code> and
    <br><code>EndpointPostPlugin</code>.<br> <li> Added handling to prefer
    <code>FunctionName</code> over <code>Name</code> if both are
    provided.<br> <li> Updated <code>Fill</code> and <code>ExtractTo</code>
    methods to support the new <code>FunctionName</code> <br>field.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6098/files#diff-992ec7c28d25fd54f6491d295389757705cd114bc869a35cba50d42e548cdc6e">+26/-9</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>middleware_test.go</strong><dd><code>Update Tests for
    FunctionName Precedence and Usage</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    apidef/oas/middleware_test.go
    <li>Updated tests to use <code>FunctionName</code> instead of
    <code>Name</code>.<br> <li> Added tests to ensure
    <code>FunctionName</code> has precedence over <code>Name</code>.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6098/files#diff-0af31cb29ae298a6ac3e402b283ab364a6fd793fd04f253ef7c4983234c17bef">+59/-6</a>&nbsp;
    &nbsp; </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
    @tykbot

    tykbot Bot commented Mar 7, 2024

    Copy link
    Copy Markdown

    @jeffy-mathew Succesfully merged PR

    jeffy-mathew added a commit that referenced this pull request Mar 7, 2024
    …ce name in OAS virtual endpoint and endpoint post plugin (#6098) (#6113)
    
    ## **User description**
    [TT-11440/TT-11461] Add functionName to replace name in OAS virtual
    endpoint and endpoint post plugin (#6098)
    
    ## **User description**
    <!-- Provide a general summary of your changes in the Title above -->
    
    Add functionName to replace name in OAS virtual endpoint and endpoint
    post plugin
    <!-- Describe your changes in detail -->
    
    ## Related Issue
    https://tyktech.atlassian.net/browse/TT-11440
    https://tyktech.atlassian.net/browse/TT-11461
    
    ## 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
    
    
    ___
    
    ## **Type**
    enhancement
    
    
    ___
    
    ## **Description**
    - Deprecated `Name` field in favor of `FunctionName` for both
    `VirtualEndpoint` and `EndpointPostPlugin` configurations to clarify the
    purpose and usage.
    - Ensured backward compatibility by retaining the `Name` field but
    marking it as deprecated.
    - Updated related methods (`Fill` and `ExtractTo`) to prioritize
    `FunctionName` over `Name` when both are provided.
    - Modified and added unit tests to reflect changes and validate the
    precedence of `FunctionName` over `Name`.
    
    
    ___
    
    
    
    ## **Changes walkthrough**
    <table><thead><tr><th></th><th align="left">Relevant
    
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>middleware.go</strong><dd><code>Deprecate Name in Favor
    of FunctionName for Plugin Configurations</code></dd></summary>
    <hr>
    
    apidef/oas/middleware.go
    <li>Deprecated <code>Name</code> in favor of <code>FunctionName</code>
    for both <code>VirtualEndpoint</code> and
    <br><code>EndpointPostPlugin</code>.<br> <li> Added handling to prefer
    <code>FunctionName</code> over <code>Name</code> if both are
    provided.<br> <li> Updated <code>Fill</code> and <code>ExtractTo</code>
    methods to support the new <code>FunctionName</code> <br>field.
    
    
    </details>
        
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6098/files#diff-992ec7c28d25fd54f6491d295389757705cd114bc869a35cba50d42e548cdc6e">+26/-9</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>middleware_test.go</strong><dd><code>Update Tests for
    FunctionName Precedence and Usage</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    apidef/oas/middleware_test.go
    <li>Updated tests to use <code>FunctionName</code> instead of
    <code>Name</code>.<br> <li> Added tests to ensure
    <code>FunctionName</code> has precedence over <code>Name</code>.
    
    
    </details>
        
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6098/files#diff-0af31cb29ae298a6ac3e402b283ab364a6fd793fd04f253ef7c4983234c17bef">+59/-6</a>&nbsp;
    &nbsp; </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
    
    
    ___
    
    ## **Type**
    enhancement
    
    
    ___
    
    ## **Description**
    - Deprecated `Name` field in `VirtualEndpoint` and `EndpointPostPlugin`,
    replaced with `FunctionName` to better reflect its purpose.
    - Added custom JSON marshaling to handle the transition from `Name` to
    `FunctionName`, ensuring backward compatibility.
    - Updated tests and JSON schema to align with the changes introduced for
    `FunctionName`.
    
    
    ___
    
    
    
    ## **Changes walkthrough**
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>middleware.go</strong><dd><code>Deprecate Name Field in
    Favor of FunctionName for VirtualEndpoint and
    </code><br><code>EndpointPostPlugin</code></dd></summary>
    <hr>
    
    apidef/oas/middleware.go
    <li>Added JSON marshaling logic for <code>VirtualEndpoint</code> and
    <code>EndpointPostPlugin</code> <br>to handle deprecated
    <code>Name</code> field and prioritize <code>FunctionName</code>.<br>
    <li> Deprecated <code>Name</code> field in <code>VirtualEndpoint</code>
    and <code>EndpointPostPlugin</code>, <br>replaced with
    <code>FunctionName</code>.<br> <li> Updated <code>Fill</code> and
    <code>ExtractTo</code> methods to support the new
    <code>FunctionName</code> <br>field.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6113/files#diff-992ec7c28d25fd54f6491d295389757705cd114bc869a35cba50d42e548cdc6e">+68/-9</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>x-tyk-api-gateway.json</strong><dd><code>Update JSON
    Schema to Reflect FunctionName Changes</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    apidef/oas/schema/x-tyk-api-gateway.json
    <li>Updated JSON schema to include <code>functionName</code> and mark it
    as required <br>for <code>VirtualEndpoint</code> and
    <code>EndpointPostPlugin</code>.<br> <li> Deprecated <code>name</code>
    field in JSON schema for <code>VirtualEndpoint</code> and
    <br><code>EndpointPostPlugin</code>.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6113/files#diff-78828969c0c04cc1a776dfc93a8bad3c499a8c83e6169f83e96d090bed3e7dd0">+8/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>middleware_test.go</strong><dd><code>Update Tests for
    VirtualEndpoint and EndpointPostPlugin to Reflect
    </code><br><code>FunctionName Changes</code></dd></summary>
    <hr>
    
    apidef/oas/middleware_test.go
    <li>Updated tests to use <code>FunctionName</code> instead of
    <code>Name</code>.<br> <li> Added tests to ensure
    <code>FunctionName</code> has precedence over <code>Name</code>.<br>
    <li> Added JSON marshaling tests to verify <code>functionName</code> is
    included and <br><code>name</code> is excluded.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6113/files#diff-0af31cb29ae298a6ac3e402b283ab364a6fd793fd04f253ef7c4983234c17bef">+82/-6</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>operation_test.go</strong><dd><code>Update Operation
    Tests to Ignore Deprecated Name Field</code>&nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/oas/operation_test.go
    <li>Updated tests to ignore deprecated <code>Name</code> field in
    <code>VirtualEndpoint</code> and <br><code>EndpointPostPlugin</code>.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6113/files#diff-cd234db716d6d2edc97c135ef546021c9ab4fa9282d63964bd155d41635cf964">+2/-0</a>&nbsp;
    &nbsp; &nbsp; </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]>
    @buger

    buger commented Mar 7, 2024

    Copy link
    Copy Markdown
    Member

    API tests result - postgres15-murmur64 env: success
    Branch used: refs/heads/master
    Commit: f101b1d [TT-11440/TT-11461] Add functionName to replace name in OAS virtual endpoint and endpoint post plugin (#6098)

    User description

    Add functionName to replace name in OAS virtual endpoint and endpoint
    post plugin

    Related Issue

    https://tyktech.atlassian.net/browse/TT-11440
    https://tyktech.atlassian.net/browse/TT-11461

    Motivation and Context

    How This Has Been Tested

    Screenshots (if appropriate)

    Types of changes

    • 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

    • 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

    Type

    enhancement


    Description

    • Deprecated Name field in favor of FunctionName for both
      VirtualEndpoint and EndpointPostPlugin configurations to clarify the
      purpose and usage.
    • Ensured backward compatibility by retaining the Name field but
      marking it as deprecated.
    • Updated related methods (Fill and ExtractTo) to prioritize
      FunctionName over Name when both are provided.
    • Modified and added unit tests to reflect changes and validate the
      precedence of FunctionName over Name.

    Changes walkthrough

    Relevant files
    Enhancement
    middleware.go
    Deprecate Name in Favor of FunctionName for Plugin Configurations

    apidef/oas/middleware.go

  • Deprecated Name in favor of FunctionName for both VirtualEndpoint and
    EndpointPostPlugin.
  • Added handling to prefer FunctionName over Name if both are provided.
  • Updated Fill and ExtractTo methods to support the new FunctionName
    field.
  • +26/-9   
    Tests
    middleware_test.go
    Update Tests for FunctionName Precedence and Usage             

    apidef/oas/middleware_test.go

  • Updated tests to use FunctionName instead of Name.
  • Added tests to ensure FunctionName has precedence over Name.
  • +59/-6   

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions
    Triggered by: push (@jeffy-mathew)
    Execution page

    @buger

    buger commented Mar 7, 2024

    Copy link
    Copy Markdown
    Member

    API tests result - mongo44-murmur64 env: success
    Branch used: refs/heads/master
    Commit: f101b1d [TT-11440/TT-11461] Add functionName to replace name in OAS virtual endpoint and endpoint post plugin (#6098)

    User description

    Add functionName to replace name in OAS virtual endpoint and endpoint
    post plugin

    Related Issue

    https://tyktech.atlassian.net/browse/TT-11440
    https://tyktech.atlassian.net/browse/TT-11461

    Motivation and Context

    How This Has Been Tested

    Screenshots (if appropriate)

    Types of changes

    • 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

    • 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

    Type

    enhancement


    Description

    • Deprecated Name field in favor of FunctionName for both
      VirtualEndpoint and EndpointPostPlugin configurations to clarify the
      purpose and usage.
    • Ensured backward compatibility by retaining the Name field but
      marking it as deprecated.
    • Updated related methods (Fill and ExtractTo) to prioritize
      FunctionName over Name when both are provided.
    • Modified and added unit tests to reflect changes and validate the
      precedence of FunctionName over Name.

    Changes walkthrough

    Relevant files
    Enhancement
    middleware.go
    Deprecate Name in Favor of FunctionName for Plugin Configurations

    apidef/oas/middleware.go

  • Deprecated Name in favor of FunctionName for both VirtualEndpoint and
    EndpointPostPlugin.
  • Added handling to prefer FunctionName over Name if both are provided.
  • Updated Fill and ExtractTo methods to support the new FunctionName
    field.
  • +26/-9   
    Tests
    middleware_test.go
    Update Tests for FunctionName Precedence and Usage             

    apidef/oas/middleware_test.go

  • Updated tests to use FunctionName instead of Name.
  • Added tests to ensure FunctionName has precedence over Name.
  • +59/-6   

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions
    Triggered by: push (@jeffy-mathew)
    Execution page

    @buger

    buger commented Mar 7, 2024

    Copy link
    Copy Markdown
    Member

    API tests result - postgres15-murmur64 env: success
    Branch used: refs/heads/master
    Commit: f101b1d [TT-11440/TT-11461] Add functionName to replace name in OAS virtual endpoint and endpoint post plugin (#6098)

    User description

    Add functionName to replace name in OAS virtual endpoint and endpoint
    post plugin

    Related Issue

    https://tyktech.atlassian.net/browse/TT-11440
    https://tyktech.atlassian.net/browse/TT-11461

    Motivation and Context

    How This Has Been Tested

    Screenshots (if appropriate)

    Types of changes

    • 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

    • 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

    Type

    enhancement


    Description

    • Deprecated Name field in favor of FunctionName for both
      VirtualEndpoint and EndpointPostPlugin configurations to clarify the
      purpose and usage.
    • Ensured backward compatibility by retaining the Name field but
      marking it as deprecated.
    • Updated related methods (Fill and ExtractTo) to prioritize
      FunctionName over Name when both are provided.
    • Modified and added unit tests to reflect changes and validate the
      precedence of FunctionName over Name.

    Changes walkthrough

    Relevant files
    Enhancement
    middleware.go
    Deprecate Name in Favor of FunctionName for Plugin Configurations

    apidef/oas/middleware.go

  • Deprecated Name in favor of FunctionName for both VirtualEndpoint and
    EndpointPostPlugin.
  • Added handling to prefer FunctionName over Name if both are provided.
  • Updated Fill and ExtractTo methods to support the new FunctionName
    field.
  • +26/-9   
    Tests
    middleware_test.go
    Update Tests for FunctionName Precedence and Usage             

    apidef/oas/middleware_test.go

  • Updated tests to use FunctionName instead of Name.
  • Added tests to ensure FunctionName has precedence over Name.
  • +59/-6   

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions
    Triggered by: push (@jeffy-mathew)
    Execution page

    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.

    3 participants