Skip to content
This repository was archived by the owner on Feb 8, 2026. It is now read-only.

Add custom scripts to swagger-ui template#94

Merged
ReneWerner87 merged 5 commits intogofiber:mainfrom
uvulpos:feat/add-custom-scripts-to-swaggerui-template
Jul 4, 2024
Merged

Add custom scripts to swagger-ui template#94
ReneWerner87 merged 5 commits intogofiber:mainfrom
uvulpos:feat/add-custom-scripts-to-swaggerui-template

Conversation

@uvulpos
Copy link
Copy Markdown
Contributor

@uvulpos uvulpos commented Jul 3, 2024

improves workarounds like #76
enables to customize swagger ui further

workaround for swagger-api/swagger-ui#7521

Summary by CodeRabbit

  • New Features
    • Added support for custom JavaScript scripts in configuration to enhance flexibility.
    • Custom scripts are now conditionally included in HTML templates, similar to custom styles.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jul 3, 2024

Walkthrough

The changes add a new field CustomScript to the Config struct, enabling the inclusion of custom JavaScript in the HTML template. Conditional blocks have been inserted into index.go to allow this custom script to be included based on specific conditions, enhancing the flexibility and customization capabilities of the template rendering process.

Changes

File Change Summary
config.go Added a new field CustomScript of type template.JS to the Config struct for custom scripts.
index.go Updated the HTML template functionality to conditionally insert custom scripts in addition to styles.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Server
    participant Config
    participant HTMLTemplate

    User->>Server: Request Page
    Server->>Config: Fetch Configuration
    Config-->>Server: Send Config (with CustomScript)
    Server->>HTMLTemplate: Render Template (with CustomScript if available)
    HTMLTemplate-->>Server: Compiled HTML
    Server-->>User: Send Compiled HTML
Loading

Poem

In the code where changes sweep,
New scripts in HTML do creep.🖥️
Custom scripts with thoughts so clear,
Enhance the templates, bring in cheer.
Customize, adapt, and then deploy,
A coder's craft, a user's joy. 💻✨

Tip

AI model upgrade

gpt-4o model for reviews and chat is now live

OpenAI claims that this model is better at understanding and generating code than the previous models. Please join our Discord Community to provide any feedback or to report any issues.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fce41f4 and d0b5aeb.

Files selected for processing (2)
  • config.go (1 hunks)
  • index.go (1 hunks)
Additional comments not posted (2)
index.go (1)

19-22: Add support for custom scripts in the HTML template.

The inclusion of custom scripts enhances the customization capabilities of the Swagger UI.

config.go (1)

182-185: Add new field CustomScript to the Config struct.

This new field allows for the inclusion of custom JavaScript scripts in the Swagger UI configuration.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d0b5aeb and 206a185.

Files selected for processing (1)
  • index.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • index.go

gaby
gaby previously requested changes Jul 3, 2024
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 206a185 and e7bf351.

Files selected for processing (1)
  • index.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • index.go

@ReneWerner87 ReneWerner87 added the ✏️ Feature New feature or request label Jul 4, 2024
@ReneWerner87 ReneWerner87 dismissed gaby’s stale review July 4, 2024 06:48

review points are solved

@ReneWerner87 ReneWerner87 merged commit 2ea0393 into gofiber:main Jul 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

✏️ Feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants