TykTechnologies / tyk

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

[TT-13242] Moved/Cleaned up nestedApiDefinition to model.MergedAPI #6609

Closed titpetric closed 1 month ago

titpetric commented 1 month ago

User description

https://tyktech.atlassian.net/browse/TT-13242


PR Type

enhancement


Description


Changes walkthrough 📝

Relevant files
Enhancement
api_definition.go
Refactor API definition handling to use MergedAPI model   

gateway/api_definition.go
  • Replaced nestedApiDefinition with model.MergedAPI.
  • Removed nestedApiDefinitionList and related methods.
  • Updated function calls to use model.MergedAPIList.
  • Adjusted filtering logic to use Filter method from MergedAPIList.
  • +9/-54   
    tracing.go
    Update tracing logic for MergedAPI integration                     

    gateway/tracing.go - Modified trace handler to use `model.MergedAPI`.
    +2/-1     
    merged_apis.go
    Introduce MergedAPI and MergedAPIList models                         

    internal/model/merged_apis.go
  • Added MergedAPIList and MergedAPI structs.
  • Implemented SetClassic and Filter methods for MergedAPIList.
  • +61/-0   
    Tests
    api_definition_test.go
    Update tests for MergedAPI model integration                         

    gateway/api_definition_test.go
  • Updated tests to use model.MergedAPIList.
  • Replaced nestedApiDefinition with model.MergedAPI.
  • Adjusted test logic to use Filter method.
  • +16/-15 
    coprocess_id_extractor_test.go
    Modify coprocess ID extractor tests for MergedAPI               

    gateway/coprocess_id_extractor_test.go - Updated test setup to use `model.MergedAPI`.
    +2/-1     
    policy_test.go
    Update policy tests for MergedAPI model                                   

    gateway/policy_test.go
  • Replaced nestedApiDefinition with model.MergedAPI in mock data.
  • +2/-1     
    testutil.go
    Adjust test utilities for MergedAPI model                               

    gateway/testutil.go - Updated utility function to use `model.MergedAPI`.
    +2/-1     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    github-actions[bot] commented 1 month ago

    Failed to generate code suggestions for PR

    github-actions[bot] commented 1 month ago

    API Changes

    --- prev.txt    2024-10-09 12:45:49.727991125 +0000
    +++ current.txt 2024-10-09 12:45:43.691955732 +0000
    @@ -7954,7 +7954,7 @@
    
     func (a APIDefinitionLoader) GetOASFilepath(path string) string
    
    -func (a APIDefinitionLoader) MakeSpec(def *nestedApiDefinition, logger *logrus.Entry) (*APISpec, error)
    +func (a APIDefinitionLoader) MakeSpec(def *model.MergedAPI, logger *logrus.Entry) (*APISpec, error)
         MakeSpec will generate a flattened URLSpec from and APIDefinitions'
         VersionInfo data. paths are keyed to the Api version name, which is
         determined during routing to speed up lookups
    sonarcloud[bot] commented 1 month ago

    Quality Gate Failed Quality Gate failed

    Failed conditions
    0.0% Coverage on New Code (required ≥ 80%)
    C Reliability Rating on New Code (required ≥ A)

    See analysis details on SonarCloud

    Catch issues before they fail your Quality Gate with our IDE extension SonarLint