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

[TT-14171] Update documentation for master Dashboard #6062

Closed
wants to merge 1 commit into from

Conversation

buger
Copy link
Member

@buger buger commented Mar 4, 2025

User description

Triggered by: lghiur

Included:

Tyk Gateway: false
Tyk Dashboard: true
Tyk MDCB false
Tyk Pump false

Intended for: master
Changes sourced from: release-5.8.0
Config info generator branch: main

Note: Docs updates for dashboard 5.8.0 (branch suffix: docs)

JIRA: https://tyktech.atlassian.net/browse/TT-14171


PR Type

  • Enhancement
  • Documentation

Description

  • Enhanced dashboard swagger with proxy and migration endpoints.

  • Updated examples, headers, and response content in API spec.

  • Extended dashboard configuration docs with new env variables.

  • Added comprehensive OPA rules documentation for dashboard.


Changes walkthrough 📝

Relevant files
Enhancement
dashboard-swagger.yml
Update Swagger endpoints and add migration features.         

tyk-docs/assets/others/dashboard-swagger.yml

  • Change listen_path values for test endpoints.
  • Add a new /api/proxy endpoint with detailed examples.
  • Introduce /api/apis/migrate endpoint for API migrations.
  • Update header requirements and response examples.
  • +450/-60
    Documentation
    dashboard-config.md
    Extend dashboard configuration documentation.                       

    tyk-docs/content/shared/dashboard-config.md

  • Document new database type and connection parameters.
  • Add configuration for table sharding in storage settings.
  • Update Redis cluster and TLS documentation links.
  • +163/-4 
    opa-rules.md
    Add comprehensive OPA rules documentation.                             

    tyk-docs/content/tyk-dashboard/opa-rules.md

  • Introduce new OPA rules for dashboard user permissions.
  • Provide default, demo, and advanced OPA rule examples.
  • +223/-0 

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • Copy link
    Contributor

    github-actions bot commented Mar 4, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Migration Endpoint

    The newly introduced /api/apis/migrate endpoint should be reviewed for comprehensive error handling and detailed response behaviors in various migration scenarios.

    /api/apis/migrate:
      post:
        description: Migrate APIs between Classic and OAS formats. The endpoint supports different migration modes including dry run, staging, promotion and direct migration.
        operationId: migrateAPI
        requestBody:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MigrateAPIRequest'
              example:
                mode: "dryRun"
                apiIDs: [ "api123", "api456" ]
                abortOnFailure: true
        responses:
          "200":
            description: Migration completed
            content:
              application/json:
                schema:
                  $ref: '#/components/schemas/MigrateAPIResponse'
          "400":
            description: Bad request - validation failed
            content:
              application/json:
                schema:
                  $ref: '#/components/schemas/ApiResponse'
          "401":
            description: Unauthorized
            content:
              application/json:
                schema:
                  $ref: '#/components/schemas/ApiResponse'
        summary: Migrate APIs between Classic and OAS formats
        tags:
        - MigrateOAS
    
    Schema Definitions

    The additions of new schema definitions (e.g., ProxyRequest, ProxyResponse, ErrorResponse, MigrateAPIRequest, and MigrateAPIResponse) should be validated to ensure they align with the intended API contract and include necessary validations.

        in: query
        name: start_day
        schema:
          format: date
          type: string
    schemas:
      ProxyRequest:
        type: object
        required:
          - method
          - url
        properties:
          method:
            type: string
            description: HTTP method for the proxy request (GET, POST, PUT, DELETE, etc.)
          url:
            type: string
            description: Full URL for the proxy request (valid Gateway url), including scheme, host, and path
          headers:
            type: object
            additionalProperties:
              type: string
            description: Headers to be sent with the proxy request
          body:
            type: object
            description: Body of the proxy request, typically used for POST or PUT requests
      ProxyResponse:
        type: object
        properties:
          status_code:
            type: integer
            description: HTTP status code of the proxied response
          headers:
            type: object
            additionalProperties:
              type: string
            description: Headers received from the proxied response
          body:
            type: object
            description: Body of the proxied response, parsed as JSON if possible
      ErrorResponse:
        type: object
        properties:
          Status:
            type: string
            description: Error status, typically "Error"
          Message:
            type: string
            description: Detailed error message explaining what went wrong
          Meta:
            type: object
            nullable: true
            description: Additional metadata about the error, if available
      APICertificateStatusMessage:
    Documentation Consistency

    The newly added configuration sections for various database parameters need to be checked for consistency with existing docs and ensure that all ENV variable examples and descriptions are accurate and easy to follow.

    ### storage.main
    Main database where the dashboard resources are stored (users, orgs, policies, etc)
    
    ### storage.main.type
    ENV: <b>TYK_DB_STORAGE_MAIN_TYPE</b><br />
    Type: `DBType`<br />
    
    Type is the type of the database.
    Possible values are:
      - "mongo": Use MongoDB.
      - "postgres": Use PostgreSQL.
      - "mysql": Use MySQL.
    
    ### storage.main.connection_string
    ENV: <b>TYK_DB_STORAGE_MAIN_CONNECTIONSTRING</b><br />
    Type: `string`<br />
    
    ConnectionString is the connection string for the database.
    Overrides ReadConnectionString and WriteConnectionString.
    
    ### storage.main.read_connection_string
    ENV: <b>TYK_DB_STORAGE_MAIN_READCONNECTIONSTRING</b><br />
    Type: `string`<br />
    
    ReadConnectionString is the connection string for read operations.
    Only used if ConnectionString is not set.
    
    ### storage.main.write_connection_string
    ENV: <b>TYK_DB_STORAGE_MAIN_WRITECONNECTIONSTRING</b><br />
    Type: `string`<br />
    
    WriteConnectionString is the connection string for write operations.
    Only used if ConnectionString is not set.
    
    ### storage.main.mongo

    Copy link
    Contributor

    github-actions bot commented Mar 4, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Fix sprintf argument mismatch

    Update the sprintf format string in the deny rules so that the number of format
    specifiers matches the provided arguments.

    tyk-docs/content/tyk-dashboard/opa-rules.md [128]

    -x := sprintf("You do not have permission to carry out '%v' operation.", [request_intent, input.request.path])
    +x := sprintf("You do not have permission to carry out '%v' operation on '%v'.", [request_intent, input.request.path])
    Suggestion importance[1-10]: 8

    __

    Why: The suggestion correctly identifies the sprintf format mismatch, ensuring that the format string includes two placeholders to match the two arguments provided. This change improves the correctness of the rule and avoids potential runtime errors.

    Medium

    Copy link

    netlify bot commented Mar 4, 2025

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

    Name Link
    🔨 Latest commit 5054ff1
    🔍 Latest deploy log https://app.netlify.com/sites/tyk-docs/deploys/67c6e20afd05200008c0ee19
    😎 Deploy Preview https://deploy-preview-6062--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.

    1 similar comment
    Copy link

    netlify bot commented Mar 4, 2025

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

    Name Link
    🔨 Latest commit 5054ff1
    🔍 Latest deploy log https://app.netlify.com/sites/tyk-docs/deploys/67c6e20afd05200008c0ee19
    😎 Deploy Preview https://deploy-preview-6062--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.

    @lghiur lghiur changed the title [TT-14171] Update documentation for master [TT-14171] Update documentation for master Dashboard Mar 4, 2025
    Copy link
    Contributor

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

    Suggested improvements to wording. We shouldn't use the term "OAS API" when referring to a Tyk OAS API.

    @@ -3946,6 +4052,42 @@ paths:
    summary: List OAuth client tokens.
    tags:
    - Oauth
    /api/apis/migrate:
    post:
    description: Migrate APIs between Classic and OAS formats. The endpoint supports different migration modes including dry run, staging, promotion and direct migration.
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Suggested change
    description: Migrate APIs between Classic and OAS formats. The endpoint supports different migration modes including dry run, staging, promotion and direct migration.
    description: Migrate APIs from Tyk Classic to Tyk OAS format. The endpoint supports different migration modes including dry run, staging, promotion and direct migration.

    application/json:
    schema:
    $ref: '#/components/schemas/ApiResponse'
    summary: Migrate APIs between Classic and OAS formats
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Suggested change
    summary: Migrate APIs between Classic and OAS formats
    summary: Migrate APIs from Tyk Classic to Tyk OAS format

    scheme: bearer
    type: http
    info:
    description: This is a sample OAS.
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Suggested change
    description: This is a sample OAS.
    description: This is a sample OpenAPI description.

    type: http
    info:
    description: This is a sample OAS.
    title: OAS Sample
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Suggested change
    title: OAS Sample
    title: Sample OpenAPI description

    servers:
    - url: https://localhost:8080
    PatchOASExample:
    summary: Patch Tyk Oas Example
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Suggested change
    summary: Patch Tyk Oas Example
    summary: Patch Tyk OAS Example

    scheme: bearer
    type: http
    info:
    description: This is a sample OAS.
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Suggested change
    description: This is a sample OAS.
    description: This is a sample OpenAPI description.

    type: http
    info:
    description: This is a sample OAS.
    title: OAS Sample
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Suggested change
    title: OAS Sample
    title: Sample OpenAPI description

    @@ -916,6 +1066,15 @@ Type: `bool`<br />

    Temporary : Enable dev mode feature on UI

    ### ui.onboarding
    Onboarding section defines the information about the onboarding UI wizzard flow.
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Suggested change
    Onboarding section defines the information about the onboarding UI wizzard flow.
    Onboarding section controls the onboarding quick start wizard.

    ENV: <b>TYK_DB_UI_ONBOARDING_ENABLED</b><br />
    Type: `bool`<br />

    Enabled is a boolean flag that enables the onboarding UI wizzard flow.
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Suggested change
    Enabled is a boolean flag that enables the onboarding UI wizzard flow.
    Enabled is a boolean flag that enables the onboarding quick start wizard.

    @@ -110,6 +110,37 @@ This option allows you to store different types of data in different databases.
    ### storage.main
    Main database where the dashboard resources are stored (users, orgs, policies, etc)

    ### storage.main.type
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Hey, @lghiur

    Could you check why the streaming configuration isn't available here? I'm specifically looking for this variable, TYK_DB_STREAMING_ENABLED. There's also a Jira ticket open for the same issue.

    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    @lghiur, were you able to check the issue?

    @@ -0,0 +1,223 @@
    ---
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    During docs consolidation, this page was removed, and the content was moved to this page.

    I'll fix this part.

    Copy link
    Member

    Choose a reason for hiding this comment

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

    @sharadregoti you need to update the script the moves the files over to docs. is this how you're planning to fix it?

    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Hey, Can you point me to the Github Action /Script that generates opa-rules file? I cannot find it in the tyk-config-generator repo

    Copy link
    Member

    Choose a reason for hiding this comment

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

    requestBody:
    content:
    application/json:
    examples:
    ImportByUrl:
    summary: Import By Url
    value:
    url: https://gist.githubusercontent.com/Keithwachira/e4f11baefb68f2ace5dd2297b7ccc3e0/raw/bd0aeee05d1bd380535af7a8d5d59aa30f9b5aad/tykOas.json
    url: https://gist.githubusercontent.com/yurisasuke/e4f11baefb68f2ace5dd2297b7ccc3e0/raw/bb476fa4d4a48874b26d9df9bf62094d1a07f040/tykOas.json
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Should we use personal github URLs like this?

    Copy link
    Member

    Choose a reason for hiding this comment

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

    the previous one was also on private gist, would say to revise this at a later point

    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Ok, can you create a Jira ticket for the same? in the product board

    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    @sharadregoti
    Copy link
    Contributor

    Closing this in favor of #6084

    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