maxserver 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/setupDocs.js +39 -15
package/package.json
CHANGED
package/src/setupDocs.js
CHANGED
|
@@ -5,31 +5,25 @@ import apiReference from "@scalar/fastify-api-reference";
|
|
|
5
5
|
|
|
6
6
|
const schema = {
|
|
7
7
|
summary: "OpenAPI Specification",
|
|
8
|
-
description: "Returns the full OpenAPI 3.0 specification
|
|
8
|
+
description: "Returns the full OpenAPI 3.0 specification.",
|
|
9
9
|
tags: ["Docs"],
|
|
10
10
|
response: {
|
|
11
11
|
200: {
|
|
12
12
|
type: "object",
|
|
13
13
|
additionalProperties: true,
|
|
14
|
+
required: ["openapi", "info", "paths"],
|
|
14
15
|
properties: {
|
|
15
|
-
openapi: {
|
|
16
|
-
type: "string",
|
|
17
|
-
example: "3.0.3"
|
|
18
|
-
},
|
|
16
|
+
openapi: { type: "string", example: "3.0.3" },
|
|
19
17
|
info: {
|
|
20
18
|
type: "object",
|
|
19
|
+
required: ["title", "version"],
|
|
21
20
|
properties: {
|
|
22
|
-
title: { type: "string", example: "
|
|
21
|
+
title: { type: "string", example: "API" },
|
|
23
22
|
version: { type: "string", example: "1.0.0" }
|
|
24
|
-
}
|
|
25
|
-
required: ["title", "version"]
|
|
23
|
+
}
|
|
26
24
|
},
|
|
27
|
-
paths: {
|
|
28
|
-
|
|
29
|
-
example: {}
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
required: ["openapi", "info", "paths"]
|
|
25
|
+
paths: { type: "object", example: {} }
|
|
26
|
+
}
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
29
|
};
|
|
@@ -63,7 +57,37 @@ export async function setupDocs(app) {
|
|
|
63
57
|
app.get("/openapi.json", { schema }, () => app.swagger());
|
|
64
58
|
|
|
65
59
|
if (app.maxserver.docs !== false)
|
|
66
|
-
await app.register(apiReference, {
|
|
60
|
+
await app.register(apiReference, {
|
|
61
|
+
"routePrefix": "/docs",
|
|
62
|
+
"openapi": true,
|
|
63
|
+
"layout": "modern",
|
|
64
|
+
"hideClientButton": true,
|
|
65
|
+
"hideSearch": true,
|
|
66
|
+
"defaultOpenAllTags": true,
|
|
67
|
+
"showSidebar": true,
|
|
68
|
+
"showDeveloperTools": false,
|
|
69
|
+
"showToolbar": false,
|
|
70
|
+
"operationTitleSource": "summary",
|
|
71
|
+
"theme": "default",
|
|
72
|
+
"persistAuth": false,
|
|
73
|
+
"telemetry": false,
|
|
74
|
+
"isEditable": false,
|
|
75
|
+
"isLoading": false,
|
|
76
|
+
"hideModels": false,
|
|
77
|
+
"documentDownloadType": "both",
|
|
78
|
+
"hideTestRequestButton": false,
|
|
79
|
+
"showOperationId": false,
|
|
80
|
+
"hideDarkModeToggle": false,
|
|
81
|
+
"withDefaultFonts": true,
|
|
82
|
+
"expandAllModelSections": false,
|
|
83
|
+
"expandAllResponses": false,
|
|
84
|
+
"orderSchemaPropertiesBy": "alpha",
|
|
85
|
+
"orderRequiredPropertiesFirst": true,
|
|
86
|
+
"_integration": "fastify",
|
|
87
|
+
"default": false,
|
|
88
|
+
"slug": "api-1",
|
|
89
|
+
"title": "API #1"
|
|
90
|
+
});
|
|
67
91
|
|
|
68
92
|
app.addHook("onRoute", (route) => {
|
|
69
93
|
const auth = route.config?.auth;
|