Skip to content

Commit 0732f8a

Browse files
change scalar version
1 parent 931e548 commit 0732f8a

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ SWAGGER_REDOC_ENABLED=<TRUE/FALSE> # Enable or disable ReDoc UI
7676
SWAGGER_REDOC_PATH=<REDOC_PATH> # Path to access ReDoc UI (e.g., /redoc)
7777

7878
# Settings for your Scalar UI
79-
SCALAR_ENABLED=<TRUE/FALSE> # Enable or disable ReDoc UI
80-
SCALAR_PATH=<SCALAR_PATH> # Path to access ReDoc UI (e.g., /redoc)
79+
SCALAR_ENABLED=<TRUE/FALSE> # Enable or disable Scalar UI
80+
SCALAR_PATH=<SCALAR_PATH> # Path to access Scalar UI (e.g., /scalar)
8181

8282
# Settings for your Swagger UI
8383
SWAGGER_UI_ENABLED=<TRUE/FALSE> # Enable or disable Swagger UI

src/main/resources/templates/scalar.html

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
<head>
44
<meta charset="UTF-8"/>
55
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
6-
<title th:text="${title} ?: 'API Documentation (Scalar)'">API Docs</title>
7-
8-
<!-- Scalar API Reference -->
9-
<script id="scalar-script"
10-
src="https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/browser/standalone.min.js"></script>
6+
<title th:text="${title}">API Docs</title>
117

128
<style>
139
body {
@@ -41,18 +37,26 @@
4137
</head>
4238
<body>
4339
<div id="api-reference"></div>
44-
<script th:inline="javascript">
45-
const specUrl = [[${specUrl}]];
46-
document.addEventListener("DOMContentLoaded", function () {
40+
<script th:inline="javascript" type="module">
41+
/*<![CDATA[*/
42+
import {
43+
ScalarApiReference
44+
} from 'https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.38.1/dist/browser/standalone.module.js';
45+
46+
const specUrl = [[${specUrl}]] || '/v3/api-docs';
47+
const theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
48+
49+
document.addEventListener("DOMContentLoaded", () => {
4750
ScalarApiReference({
4851
element: "#api-reference",
49-
spec: {url: specUrl || "/v3/api-docs"},
50-
theme: window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light',
52+
spec: {url: specUrl},
53+
theme: theme,
5154
layout: "modern",
5255
hideDownloadButton: false,
5356
hideModels: false
5457
});
5558
});
59+
/*]]>*/
5660
</script>
5761
</body>
5862
</html>

0 commit comments

Comments
 (0)