Skip to content

[TT-11684] OAS-to-UDG converter - import paths & cleanup#6181

Merged
buraksezer merged 4 commits into
masterfrom
feat/TT-11684/OAS-to-UDG-converter-import-paths-cleanup
Mar 26, 2024
Merged

[TT-11684] OAS-to-UDG converter - import paths & cleanup#6181
buraksezer merged 4 commits into
masterfrom
feat/TT-11684/OAS-to-UDG-converter-import-paths-cleanup

Conversation

@buraksezer

@buraksezer buraksezer commented Mar 25, 2024

Copy link
Copy Markdown
Contributor

User description

See https://tyktech.atlassian.net/browse/TT-11684


Type

enhancement, dependencies


Description

  • Updated import paths for AsyncAPI and OpenAPI adapters to use the new graphql-translator library.
  • Updated graphql-go-tools dependency to the latest version.
  • Added graphql-translator as a new dependency.
  • Adjusted checksums in go.sum for the updated and new dependencies.

Changes walkthrough

Relevant files
Enhancement
asyncapi.go
Update AsyncAPI Import Path to Use graphql-translator       

apidef/adapter/asyncapi.go

  • Replaced graphql-go-tools/pkg/asyncapi import with
    graphql-translator/asyncapi.
  • +1/-1     
    openapi.go
    Update OpenAPI Import Path and Reorder Imports                     

    apidef/adapter/openapi.go

  • Removed graphql-go-tools/pkg/openapi import.
  • Added graphql-translator/openapi import.
  • Reordered imports to place getkin/kin-openapi/openapi3 at the end.
  • +2/-3     
    Dependencies
    go.mod
    Update graphql-go-tools and Add graphql-translator Dependency

    go.mod

  • Updated graphql-go-tools dependency to a newer version.
  • Added graphql-translator dependency.
  • +2/-1     
    go.sum
    Update Checksums for Dependencies                                               

    go.sum

  • Updated checksums for graphql-go-tools.
  • Added checksums for graphql-translator.
  • +4/-2     

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

    @github-actions

    Copy link
    Copy Markdown
    Contributor

    API Changes

    no api changes detected

    @github-actions github-actions Bot added enhancement dependencies Pull requests that update a dependency file labels Mar 25, 2024
    @github-actions

    Copy link
    Copy Markdown
    Contributor

    PR Description updated to latest commit (60ab66c)

    @github-actions

    Copy link
    Copy Markdown
    Contributor

    PR Review

    ⏱️ Estimated effort to review [1-5]

    2, because the changes are mostly about updating import paths and dependencies, which are straightforward. However, ensuring compatibility and no side effects with the new versions requires some attention.

    🧪 Relevant tests

    No

    🔍 Possible issues

    Dependency Version Compatibility: The update to graphql-go-tools and addition of graphql-translator might introduce compatibility issues if not properly tested with existing code.

    🔒 Security concerns

    No

    Code feedback:
    relevant fileapidef/adapter/asyncapi.go
    suggestion      

    Ensure that the new graphql-translator/asyncapi package is fully compatible with the existing codebase and does not introduce breaking changes. Consider running integration tests that cover AsyncAPI functionality. [important]

    relevant line"github.com/TykTechnologies/graphql-translator/asyncapi"

    relevant fileapidef/adapter/openapi.go
    suggestion      

    Verify that the updated import path to graphql-translator/openapi does not affect the OpenAPI functionality, especially if there are any specific customizations or extensions previously relying on graphql-go-tools/pkg/openapi. [important]

    relevant line"github.com/TykTechnologies/graphql-translator/openapi"

    relevant filego.mod
    suggestion      

    After updating graphql-go-tools to a newer version and adding graphql-translator, ensure to test the entire application for any unexpected behavior or deprecations that might have been introduced. [important]

    relevant linegithub.com/TykTechnologies/graphql-translator v0.0.0-20240319092712-4ba87e4c06ff

    relevant filego.sum
    suggestion      

    After updating dependencies, it's a good practice to run go mod tidy to clean up any unnecessary entries in go.sum to keep the project clean and manageable. [medium]

    relevant linegithub.com/TykTechnologies/graphql-translator v0.0.0-20240319092712-4ba87e4c06ff h1:kFA240S1Y4snsEL4Ng4Ch1Ib2N04A15Y+9KYumK6uCg=


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

    @github-actions

    github-actions Bot commented Mar 25, 2024

    Copy link
    Copy Markdown
    Contributor

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Maintainability
    Organize imports by grouping them for better readability.

    Consider organizing your imports by grouping them into standard library, external
    libraries, and internal packages for better readability.

    apidef/adapter/asyncapi.go [10-17]

     "github.com/buger/jsonparser"
     
     "github.com/TykTechnologies/graphql-go-tools/pkg/astprinter"
     "github.com/TykTechnologies/graphql-go-tools/pkg/engine/datasource/kafka_datasource"
     "github.com/TykTechnologies/graphql-go-tools/pkg/operationreport"
    +
     "github.com/TykTechnologies/graphql-translator/asyncapi"
     "github.com/TykTechnologies/tyk/apidef"
     
    Possible issue
    Verify the usage of newly added imports to avoid unnecessary package imports.

    Ensure that the newly added imports are used within the file to avoid importing packages
    unnecessarily which can lead to increased compilation time and binary size.

    apidef/adapter/openapi.go [12-17]

    -"github.com/TykTechnologies/graphql-go-tools/pkg/astprinter"
    -"github.com/TykTechnologies/graphql-go-tools/pkg/operationreport"
    -"github.com/TykTechnologies/graphql-translator/openapi"
    -"github.com/TykTechnologies/tyk/apidef"
    -"github.com/getkin/kin-openapi/openapi3"
    +"Ensure that all imported packages are used within the file."
     
    Enhancement
    Update to the latest stable version of github.com/TykTechnologies/graphql-go-tools.

    Update the version of github.com/TykTechnologies/graphql-go-tools to the latest stable
    version if possible, to ensure you have the latest features and bug fixes.

    go.mod [17-18]

    -github.com/TykTechnologies/graphql-go-tools v1.6.2-0.20240325095122-27642576e0c2
    +github.com/TykTechnologies/graphql-go-tools vX.Y.Z
     
    Best practice
    Use go mod tidy to clean up the go.sum file after updating dependencies.

    After updating dependencies in go.mod, run go mod tidy to clean up the go.sum file and
    remove any unnecessary checksums for unused dependencies.

    go.sum [50-55]

    -github.com/TykTechnologies/graphql-go-tools v1.6.2-0.20240325095122-27642576e0c2 h1:3txS7U6fY4sNtSzhdDhTQYXZz6kEZOjs3+4OLAolpac=
    -github.com/TykTechnologies/graphql-go-tools v1.6.2-0.20240325095122-27642576e0c2/go.mod h1:DCYkq1ZoUZ/pGESE+j3C7wuyDPSt1Mlu0jVgIoDABJY=
    -github.com/TykTechnologies/graphql-translator v0.0.0-20240319092712-4ba87e4c06ff h1:kFA240S1Y4snsEL4Ng4Ch1Ib2N04A15Y+9KYumK6uCg=
    -github.com/TykTechnologies/graphql-translator v0.0.0-20240319092712-4ba87e4c06ff/go.mod h1:K3KhGG9CmvXv1lJhKZpnLb1tC8N1oIzXTunQsc6N9og=
    +"Run `go mod tidy` to clean up unnecessary checksums."
     

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

    @github-actions

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/apidef/adapter/openapi.go b/apidef/adapter/openapi.go
    index dd5b054..fa7278b 100644
    --- a/apidef/adapter/openapi.go
    +++ b/apidef/adapter/openapi.go
    @@ -9,11 +9,12 @@ import (
     	"net/url"
     	"path"
     
    +	"github.com/getkin/kin-openapi/openapi3"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/astprinter"
     	"github.com/TykTechnologies/graphql-go-tools/pkg/operationreport"
     	"github.com/TykTechnologies/graphql-translator/openapi"
     	"github.com/TykTechnologies/tyk/apidef"
    -	"github.com/getkin/kin-openapi/openapi3"
     )
     
     const defaultRequestBodyMimeType = "application/json"

    Please look at the run or in the Checks tab.

    1 similar comment
    @github-actions

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/apidef/adapter/openapi.go b/apidef/adapter/openapi.go
    index dd5b054..fa7278b 100644
    --- a/apidef/adapter/openapi.go
    +++ b/apidef/adapter/openapi.go
    @@ -9,11 +9,12 @@ import (
     	"net/url"
     	"path"
     
    +	"github.com/getkin/kin-openapi/openapi3"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/astprinter"
     	"github.com/TykTechnologies/graphql-go-tools/pkg/operationreport"
     	"github.com/TykTechnologies/graphql-translator/openapi"
     	"github.com/TykTechnologies/tyk/apidef"
    -	"github.com/getkin/kin-openapi/openapi3"
     )
     
     const defaultRequestBodyMimeType = "application/json"

    Please look at the run or in the Checks tab.

    @github-actions

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/apidef/adapter/openapi.go b/apidef/adapter/openapi.go
    index dd5b054..fa7278b 100644
    --- a/apidef/adapter/openapi.go
    +++ b/apidef/adapter/openapi.go
    @@ -9,11 +9,12 @@ import (
     	"net/url"
     	"path"
     
    +	"github.com/getkin/kin-openapi/openapi3"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/astprinter"
     	"github.com/TykTechnologies/graphql-go-tools/pkg/operationreport"
     	"github.com/TykTechnologies/graphql-translator/openapi"
     	"github.com/TykTechnologies/tyk/apidef"
    -	"github.com/getkin/kin-openapi/openapi3"
     )
     
     const defaultRequestBodyMimeType = "application/json"

    Please look at the run or in the Checks tab.

    1 similar comment
    @github-actions

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/apidef/adapter/openapi.go b/apidef/adapter/openapi.go
    index dd5b054..fa7278b 100644
    --- a/apidef/adapter/openapi.go
    +++ b/apidef/adapter/openapi.go
    @@ -9,11 +9,12 @@ import (
     	"net/url"
     	"path"
     
    +	"github.com/getkin/kin-openapi/openapi3"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/astprinter"
     	"github.com/TykTechnologies/graphql-go-tools/pkg/operationreport"
     	"github.com/TykTechnologies/graphql-translator/openapi"
     	"github.com/TykTechnologies/tyk/apidef"
    -	"github.com/getkin/kin-openapi/openapi3"
     )
     
     const defaultRequestBodyMimeType = "application/json"

    Please look at the run or in the Checks tab.

    @sonarqubecloud

    Copy link
    Copy Markdown

    Quality Gate Passed Quality Gate passed

    Issues
    0 New issues
    0 Accepted issues

    Measures
    0 Security Hotspots
    No data about Coverage
    0.0% Duplication on New Code

    See analysis details on SonarCloud

    @buraksezer
    buraksezer merged commit d6309e7 into master Mar 26, 2024
    @buraksezer
    buraksezer deleted the feat/TT-11684/OAS-to-UDG-converter-import-paths-cleanup branch March 26, 2024 07:31
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    dependencies Pull requests that update a dependency file enhancement Review effort [1-5]: 2

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants