Skip to content

Commit 4f3b8aa

Browse files
feat: update openapi-ui bundle, support default theme
1 parent 03ef6f6 commit 4f3b8aa

File tree

4 files changed

+450
-458
lines changed

4 files changed

+450
-458
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ doc := doc.Doc{
1919
SpecFile: "./openapi.json", // "./openapi.yaml"
2020
SpecPath: "/openapi.json", // "/openapi.yaml"
2121
DocsPath: "/docs",
22+
Theme: "light", // default is light, support light or dark
2223
}
2324
```
2425

pkg/doc/assets/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</style>
1414
</head>
1515
<body>
16-
<div id="openapi-ui-container" spec-url="{{ .url }}"></div>
16+
<div id="openapi-ui-container" spec-url="{{ .url }}" theme="{{ .theme }}"></div>
1717
<script>{{ .body }}</script>
1818
</body>
1919
</html>

pkg/doc/assets/openapi-ui.umd.js

Lines changed: 446 additions & 457 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/doc/doc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type Doc struct {
2121
SpecFS *embed.FS
2222
Title string
2323
Description string
24+
Theme string
2425
}
2526

2627
// HTML represents the openapi-ui index.html page
@@ -46,6 +47,7 @@ func (r Doc) Body() ([]byte, error) {
4647
"title": r.Title,
4748
"url": r.SpecPath,
4849
"description": r.Description,
50+
"theme": r.Theme,
4951
}); err != nil {
5052
return nil, err
5153
}

0 commit comments

Comments
 (0)