maxserver 0.2.2 → 0.2.3

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/.github/README.md CHANGED
@@ -97,8 +97,9 @@ If you don't want to autoregister some files, then simply don't add that magic c
97
97
  Files ending with **`.schema.js`** will be auto registered.
98
98
  For example: **hello.js** and **hello.schema.js**
99
99
 
100
+ Schemas are optional.
100
101
  Besides the basic validation fields we can set fields like `tags`, `summary` and description,
101
- which will appear in the docs.
102
+ which will appear in the docs. Only if a schema exists the route will be added to the documentation.
102
103
 
103
104
 
104
105
  ```js
@@ -217,6 +218,10 @@ Rule of thumb: make the message something you would want to see at 03:00 in logs
217
218
 
218
219
 
219
220
 
221
+ ## Note
222
+ On loading routes - possible side effects execute.
223
+ Means you can eg declare globals.
224
+
220
225
  ## About
221
226
  - Dependencies: original fastify packages + scalar/fastify-api-reference
222
227
  - The source is simple. Everyone can read, understand and modify if needed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maxserver",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Node server setup based fastify",
5
5
  "author": "Max Matinpalo",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -17,7 +17,6 @@ import { setupDevSounds } from "./devSounds.js";
17
17
 
18
18
  export default async function maxserver(config = {}) {
19
19
 
20
- console.log("local one running 3");
21
20
 
22
21
  const {
23
22
 
package/src/setupDocs.js CHANGED
@@ -52,6 +52,12 @@ export async function setupDocs(app) {
52
52
  },
53
53
  },
54
54
  },
55
+ // Only consider for documentation routes which have a schema
56
+ transform: ({ schema, url }) => {
57
+ const isDefined = schema && (schema.summary || schema.response || schema.body);
58
+ if (!isDefined) return { schema: { hide: true }, url };
59
+ return { schema, url };
60
+ }
55
61
  });
56
62
 
57
63
  // not needed, the scalar extension provides it by default on /docs/openapi.json
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "checkJs": true,
4
+ "module": "ES2020",
5
+ "target": "ES2020",
6
+ "moduleResolution": "bundler",
7
+ "jsx": "react-jsx",
8
+ "strict": false,
9
+ "noUnusedParameters": false,
10
+ "noUnusedLocals": false,
11
+ "noImplicitAny": false,
12
+ // new attempt to reduce noise
13
+ "skipLibCheck": true,
14
+ //"baseUrl": ".",
15
+ "paths": {
16
+ "*": [
17
+ "./src/*"
18
+ ],
19
+ },
20
+ "types": [
21
+ "node",
22
+ "maxserver"
23
+ ]
24
+ },
25
+ "include": [
26
+ "src"
27
+ ],
28
+ "exclude": [
29
+ "node_modules",
30
+ ],
31
+ }