Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions scalar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
---
id: scalar
title: Scalar
---

# Scalar

Copy link
Member

Choose a reason for hiding this comment

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

Scalar middleware for [Fiber](https://github.com/gofiber/fiber). The middleware handles Scalar UI.

**Note: Requires Go 1.23.0 and above**

### Table of Contents
- [Signatures](#signatures)
- [Installation](#installation)
- [Examples](#examples)
- [Config](#config)
- [Default Config](#default-config)

### Signatures
```go
func New(config ...scalar.Config) fiber.Handler
```

### Installation
Scalar is tested on the latest [Go versions](https://golang.org/dl/) with support for modules. So make sure to initialize one first if you didn't do that yet:
```bash
go mod init github.com/<user>/<repo>
```
And then install the Scalar middleware:
```bash
go get github.com/gofiber/contrib/scalar
```

### Examples
Import the middleware package
```go
import (
"github.com/gofiber/fiber/v2"
"github.com/gofiber/contrib/scalar"
)
```

Using swaggo to generate documents default output path is `(root)/docs`:
```bash
swag init -v3.1
```

Using the default config:
```go
app.Use(scalar.New())
```

Using a custom config:
```go
cfg := scalar.Config{
BasePath: "/",
FilePath: "./docs/swagger.json",
Path: "swagger",
Title: "Swagger API Docs",
}

app.Use(scalar.New(cfg))
```

Use program data for Swagger content:
```go
cfg := scalar.Config{
BasePath: "/",
FilePath: "./docs/swagger.json",
FileContent: mySwaggerByteSlice,
Path: "swagger",
Title: "Swagger API Docs",
}

app.Use(scalar.New(cfg))
```

### Config
```go
type Config struct {
// Next defines a function to skip this middleware when returned true.
//
// Optional. Default: nil
Next func(c *fiber.Ctx) bool

// BasePath for the UI path
//
// Optional. Default: /
BasePath string

// FilePath for the swagger.json or swagger.yaml file
//
// Optional. Default: ./docs/swagger.json
FilePath string

// FileContent for the content of the swagger.json or swagger.yaml file.
// If provided, FilePath will not be read.
//
// Optional. Default: nil
FileContent []byte

// Path combines with BasePath for the full UI path
//
// Optional. Default: docs
Path string

// Title for the documentation site
//
// Optional. Default: Fiber API documentation
Title string

// CacheAge defines the max-age for the Cache-Control header in seconds.
//
// Optional. Default: 0 (no cache)
CacheAge int
}
```

### Default Config
```go
var ConfigDefault = Config{
Next: nil,
BasePath: "/",
FilePath: "./docs/swagger.json",
Path: "docs",
Title: "Fiber API documentation",
CacheAge: 0,
}
```
65 changes: 65 additions & 0 deletions scalar/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package scalar

import (
"html/template"

"github.com/gofiber/fiber/v2"
)

// Config defines the config for middleware.
type Config struct {
// Next defines a function to skip this middleware when returned true.
//
// Optional. Default: nil
Next func(c *fiber.Ctx) bool

// BasePath for the UI path
//
// Optional. Default: /
BasePath string

// FilePath for the swagger.json or swagger.yaml file
//
// Optional. Default: ./docs/swagger.json
FilePath string

// FileContent for the content of the swagger.json or swagger.yaml file.
// If provided, FilePath will not be read.
//
// Optional. Default: nil
FileContent []byte

// FileContent for the content of the swagger.json or swagger.yaml file.
// If provided, FilePath will not be read.
//
// Optional. Default: nil
FileContentString string

// Path combines with BasePath for the full UI path
//
// Optional. Default: docs
Path string

// Title for the documentation site
//
// Optional. Default: Fiber API documentation
Title string

// Custom Scalar Style
// Ref: https://github.com/scalar/scalar/blob/main/packages/themes/src/variables.css
// Optional. Default: ""
CustomStyle template.CSS

// Proxy to avoid CORS issues
// Optional. Default: "https://proxy.scalar.com"
ProxyUrl string
Copy link
Contributor

@coderabbitai coderabbitai bot May 3, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix URL field naming to follow Go conventions.

The field names ProxyUrl and RawSpecUrl don't follow Go conventions for acronyms. They should be ProxyURL and RawSpecURL.

 // Proxy to avoid CORS issues
 // Optional. Default: "https://proxy.scalar.com"
-ProxyUrl string
+ProxyURL string

 // Raw Space Url
 // Optional. Default: doc.json
-RawSpecUrl string
+RawSpecURL string

Don't forget to update all references to these fields in scalar.go and the README.md file.

Also applies to: 52-52

🤖 Prompt for AI Agents (early access)
In scalar/config.go at lines 48 and 52, rename the struct fields from ProxyUrl to ProxyURL and RawSpecUrl to RawSpecURL to follow Go naming conventions for acronyms. After renaming, update all references to these fields throughout scalar.go and the README.md file to ensure consistency and prevent build errors.

Copy link
Member

Choose a reason for hiding this comment

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

Apply this change

Copy link
Contributor

Choose a reason for hiding this comment

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

🧩 Analysis chain

@gaby I'll apply this change to rename the struct fields to follow Go naming conventions for acronyms.

flowchart TB
    A[Task: Rename URL fields to follow Go conventions]
    A --> B[Search for all references to ProxyUrl and RawSpecUrl]
    A --> C[Update field names in scalar/config.go]
    A --> D[Update all references in scalar.go]
    A --> E[Update any references in README.md]
    B --> F[Find usages with rg command]
    C --> G[Change ProxyUrl to ProxyURL]
    C --> H[Change RawSpecUrl to RawSpecURL]
    D --> I[Update struct field access]
    E --> J[Update documentation references]
Loading

🏁 Script executed:

#!/bin/bash
# Find all references to ProxyUrl and RawSpecUrl in the codebase
echo "=== Searching for ProxyUrl references ==="
rg "ProxyUrl" -A 2 -B 2

echo "=== Searching for RawSpecUrl references ==="
rg "RawSpecUrl" -A 2 -B 2

echo "=== List all Go files in scalar directory ==="
fd "\.go$" scalar/

echo "=== Check if README.md exists ==="
fd "README\.md" .

Length of output: 2776



🏁 Script executed:

#!/bin/bash
# Check main README.md for references
echo "=== Searching main README.md for ProxyUrl and RawSpecUrl references ==="
rg "ProxyUrl|RawSpecUrl" README.md || echo "No references found in main README.md"

# Check if there's a scalar-specific README
echo "=== Checking for scalar README ==="
fd "README\.md" scalar/ || echo "No README found in scalar directory"

Length of output: 379


Perfect! I found all the references and there are no README updates needed. Now I can provide all the necessary code changes:

flowchart TB
    A["Task: Rename URL fields to follow Go conventions"]
    A --o B["Update field names in scalar/config.go"]
    A --o C["Update references in scalar/scalar.go"] 
    A --o D["Update template in scalar/index.go"]
    A --o E["Update test files in scalar/scalar_test.go"]
    
    B --o F["ProxyUrl → ProxyURL"]
    B --o G["RawSpecUrl → RawSpecURL"] 
    B --o H["Update configDefault"]
    C --o I["Update field access in logic"]
    D --o J["Update template variables"]
    E --o K["Update test configurations"]
Loading

The changes will rename ProxyUrl to ProxyURL and RawSpecUrl to RawSpecURL throughout the codebase to follow Go naming conventions for acronyms. This affects 4 files total with no README updates needed.


⏳ Preparing changes...

Copy link
Contributor

Choose a reason for hiding this comment

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

A summary of the edits CodeRabbit can apply:

All occurrences of the struct fields ProxyUrl and RawSpecUrl will be renamed to ProxyURL and RawSpecURL across the scalar codebase to follow Go conventions for acronyms.

Rename ProxyUrl to ProxyURL and RawSpecUrl to RawSpecURL across scalar/config.go, scalar/scalar.go, scalar/index.go, and scalar/scalar_test.go (no README.md changes required).

Will identify all references to ProxyUrl and RawSpecUrl in the repository.

We will search for all occurrences of ProxyUrl and RawSpecUrl across the repository to determine every location that must be renamed.

A plan of each step that CodeRabbit will take in order to execute the edits for each file (with inline rough draft snippets):

📄 .

In scalar/config.go, update the struct definition and default values as follows:

--- a/scalar/config.go
+++ b/scalar/config.go
@@ type Config struct {
-    // Proxy to avoid CORS issues
-    // Optional.
-    ProxyUrl string
+    // Proxy to avoid CORS issues
+    // Optional. Default: ""
+    ProxyURL string

-    // Raw Space Url
-    // Optional. Default: doc.json
-    RawSpecUrl string
+    // Raw Space Url
+    // Optional. Default: doc.json
+    RawSpecURL string
@@ var configDefault = Config{
-    RawSpecUrl:       "doc.json",
+    RawSpecURL:       "doc.json",
 }

In scalar/scalar.go, update all references to RawSpecUrl to RawSpecURL:

--- a/scalar/scalar.go
+++ b/scalar/scalar.go
@@ if len(cfg.RawSpecUrl) == 0 {
-       if len(cfg.RawSpecUrl) == 0 {
-           cfg.RawSpecUrl = configDefault.RawSpecUrl
+       if len(cfg.RawSpecURL) == 0 {
+           cfg.RawSpecURL = configDefault.RawSpecURL
        }
@@
-    specURL := path.Join(scalarUIPath, cfg.RawSpecUrl)
+    specURL := path.Join(scalarUIPath, cfg.RawSpecURL)

In scalar/index.go, update the template to use ProxyURL instead of ProxyUrl:

--- a/scalar/index.go
+++ b/scalar/index.go
@@ Scalar.createApiReference('#app', {
-            {{- if .ProxyUrl}}
-            proxyUrl: "{{.ProxyUrl}}",
+            {{- if .ProxyURL}}
+            proxyUrl: "{{.ProxyURL}}",
             {{ end }}

In scalar/scalar_test.go, update test configurations to use RawSpecURL:

--- a/scalar/scalar_test.go
+++ b/scalar/scalar_test.go
@@ app.Use(New(Config{
-       RawSpecUrl: "swagger.json",
+       RawSpecURL: "swagger.json",
@@
-       RawSpecUrl: "openapi.json",
+       RawSpecURL: "openapi.json",

Run a final search to verify no leftover references in documentation:

rg --include="*.md" "ProxyUrl|RawSpecUrl" .

Since this returns no matches, no README.md updates are required.

A summary of the context that CodeRabbit is considering across the codebase:

We need to identify all references to ProxyUrl and RawSpecUrl to ensure complete renaming; though user provided shell output, integrate it into context.

  • ✅ Create PR with these edits
  • 📌 Create commit in current branch
  • 📋 Get copyable edits

Copy link
Contributor

Choose a reason for hiding this comment

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

A summary of the edits CodeRabbit can apply:

Rename struct fields ProxyUrl to ProxyURL and RawSpecUrl to RawSpecURL across the scalar package and update all code references.

Rename ProxyUrl to ProxyURL and RawSpecUrl to RawSpecURL across the scalar package and update all affected code and tests.

Rename ProxyUrl to ProxyURL and RawSpecUrl to RawSpecURL across the Scalar module to follow Go acronym conventions.

Update ProxyUrl to ProxyURL in the Go template within scalar/index.go

A plan of each step that CodeRabbit will take in order to execute the edits for each file (with inline rough draft snippets):

✏️ scalar/config.go

In scalar/config.go, update the Config struct definition. Replace the ProxyUrl and RawSpecUrl declarations as follows:

 	// Proxy to avoid CORS issues
-	// Optional.
+	// Optional. Default: ""
-	ProxyUrl string
+	ProxyURL string

 	// Raw Space Url
 	// Optional. Default: doc.json
-	RawSpecUrl string
+	RawSpecURL string

Also in scalar/config.go, update the configDefault block to use RawSpecURL:

 var configDefault = Config{
     Next:             nil,
     BasePath:         "/",
     Path:             "docs",
     Title:            "Fiber API documentation",
     CacheAge:         60,
-    RawSpecUrl:       "doc.json",
+    RawSpecURL:       "doc.json",
     ForceOffline:     true,
     FallbackCacheAge: 86400,
 }

In scalar/scalar.go, update all references to RawSpecUrl to RawSpecURL:

-    if len(cfg.RawSpecUrl) == 0 {
-        cfg.RawSpecUrl = configDefault.RawSpecUrl
+    if len(cfg.RawSpecURL) == 0 {
+        cfg.RawSpecURL = configDefault.RawSpecURL
     }

     scalarUIPath := path.Join(cfg.BasePath, cfg.Path)
-    specURL := path.Join(scalarUIPath, cfg.RawSpecUrl)
+    specURL := path.Join(scalarUIPath, cfg.RawSpecURL)

In scalar/index.go, update the template variable ProxyUrl to ProxyURL:

            Scalar.createApiReference('#app', {
              content: {{.FileContentString}},
-            {{- if .ProxyUrl}}
-            proxyUrl: "{{.ProxyUrl}}",
+            {{- if .ProxyURL}}
+            proxyUrl: "{{.ProxyURL}}",
              {{ end }}
            });

In scalar/scalar_test.go, rename RawSpecUrl to RawSpecURL in all Config initializations:

     app := setupApp()
     app.Use(New(Config{
-        RawSpecUrl: "swagger.json",
+        RawSpecURL: "swagger.json",
     }))

         BasePath:   "/api",
         Path:       "swagger",
-        RawSpecUrl: "openapi.json",
+        RawSpecURL: "openapi.json",
         CacheAge:   3600,
     }))

Run a final search to ensure no old field names remain:

rg -n "ProxyUrl|RawSpecUrl" .
✏️ scalar/index.go

Change the conditional check from {{- if .ProxyUrl}} to {{- if .ProxyURL}}.


Update the property line from proxyUrl: "{{.ProxyUrl}}", to proxyUrl: "{{.ProxyURL}}",.


Save the file and run go build (or appropriate template compilation) to confirm the template compiles and references the correct field name.

A summary of the context that CodeRabbit is considering across the codebase:

We need to identify all occurrences of ProxyUrl and RawSpecUrl to determine every file that requires updating.

Locate occurrences of the outdated .ProxyUrl reference in the Go HTML template so we know exactly which lines to update.

  • ✅ Create PR with these edits
  • 📌 Create commit in current branch
  • 📋 Get copyable edits

}

var ConfigDefault = Config{
Next: nil,
BasePath: "/",
FilePath: "./docs/swagger.json",
Path: "docs",
Title: "Fiber API documentation",
ProxyUrl: "https://proxy.scalar.com",
}
25 changes: 25 additions & 0 deletions scalar/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module github.com/gofiber/contrib/scalar

go 1.23.0

require (
github.com/gofiber/fiber/v2 v2.52.6
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.51.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
golang.org/x/sys v0.28.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
)
44 changes: 44 additions & 0 deletions scalar/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/gofiber/fiber/v2 v2.52.6 h1:Rfp+ILPiYSvvVuIPvxrBns+HJp8qGLDnLJawAu27XVI=
github.com/gofiber/fiber/v2 v2.52.6/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA=
github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
54 changes: 54 additions & 0 deletions scalar/index.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package scalar

const templateHTML = `
<!doctype html>
<html>
<head>
<title>{{.Title}}</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

{{- if .CustomStyle }}
<style>
:root {
{{ .CustomStyle }}
}
</style>
{{ end }}
</head>

<body>
<div id="app"></div>

<script>
if (!navigator.onLine) {
var script = document.createElement('script');
script.src = '/js/scalar.min.js';
script.onload = initScalar;
document.head.appendChild(script);
} else {
var cdn = document.createElement('script');
cdn.src = 'https://cdn.jsdelivr.net/npm/@scalar/api-reference';
cdn.onload = initScalar;
cdn.onerror = function () {
var fallback = document.createElement('script');
fallback.src = '/js/api-reference.min.js';
fallback.onload = initScalar;
document.head.appendChild(fallback);
};
document.head.appendChild(cdn);
}

function initScalar() {
if (typeof Scalar !== 'undefined') {
Scalar.createApiReference('#app', {
content: {{.FileContentString}},
{{- if .ProxyUrl}}
proxyUrl: "{{.ProxyUrl}}",
{{ end }}
});
}
}
</script>
</body>
</html>`
Loading