openapi-jsonrpc-jsdoc 1.3.0 → 1.3.2
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/index.mjs +24 -23
- package/package.json +2 -2
package/index.mjs
CHANGED
|
@@ -13,7 +13,6 @@ export default async function openapiJsonrpcJsdoc({ files, securitySchemes = {},
|
|
|
13
13
|
dictionaries: ['jsdoc'],
|
|
14
14
|
hierarchy: true,
|
|
15
15
|
});
|
|
16
|
-
const tags = new Set();
|
|
17
16
|
const temporaryDocument = {
|
|
18
17
|
'x-send-defaults': true,
|
|
19
18
|
'openapi': '3.0.0',
|
|
@@ -35,22 +34,22 @@ export default async function openapiJsonrpcJsdoc({ files, securitySchemes = {},
|
|
|
35
34
|
schemas: {
|
|
36
35
|
Error: {
|
|
37
36
|
required: [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
'error',
|
|
38
|
+
'id',
|
|
39
|
+
'jsonrpc',
|
|
41
40
|
],
|
|
42
41
|
properties: {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
id: {
|
|
43
|
+
type: 'integer',
|
|
44
|
+
format: 'int32',
|
|
46
45
|
},
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
error: {
|
|
47
|
+
type: 'object',
|
|
49
48
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
}
|
|
49
|
+
jsonrpc: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
54
53
|
},
|
|
55
54
|
}
|
|
56
55
|
},
|
|
@@ -64,12 +63,13 @@ export default async function openapiJsonrpcJsdoc({ files, securitySchemes = {},
|
|
|
64
63
|
const requiredSchema = ['method', 'jsonrpc'];
|
|
65
64
|
prepare: for (const module of documents) {
|
|
66
65
|
let isJsonRpc = false;
|
|
66
|
+
const tags = new Set();
|
|
67
67
|
|
|
68
68
|
if (module.tags && Array.isArray(module.tags)) {
|
|
69
69
|
for (const {title, value} of module.tags) {
|
|
70
70
|
if (title === 'json-rpc') {
|
|
71
71
|
isJsonRpc = true;
|
|
72
|
-
} else if (
|
|
72
|
+
} else if (value && ['tags', 'tag'].includes(title)) {
|
|
73
73
|
value.split(',').map(t => t.trim()).forEach(t => tags.add(t));
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -77,11 +77,12 @@ export default async function openapiJsonrpcJsdoc({ files, securitySchemes = {},
|
|
|
77
77
|
if (!isJsonRpc) {
|
|
78
78
|
continue prepare;
|
|
79
79
|
}
|
|
80
|
-
const
|
|
80
|
+
const {filename} = module.meta;
|
|
81
|
+
const apiName = filename.replace(/\.js$/, '');
|
|
81
82
|
|
|
82
83
|
const schema = {
|
|
83
84
|
post: {
|
|
84
|
-
operationId:
|
|
85
|
+
operationId: filename,
|
|
85
86
|
deprecated: module.deprecated || false,
|
|
86
87
|
summary: `/${apiName}`,
|
|
87
88
|
description: module.description,
|
|
@@ -90,13 +91,13 @@ export default async function openapiJsonrpcJsdoc({ files, securitySchemes = {},
|
|
|
90
91
|
responses: {
|
|
91
92
|
'200': {
|
|
92
93
|
description: 'OK',
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
94
|
+
content: {
|
|
95
|
+
'application/json': {
|
|
96
|
+
schema: {
|
|
97
|
+
type: 'object',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
100
101
|
},
|
|
101
102
|
default: {
|
|
102
103
|
description: 'unexpected error',
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-jsonrpc-jsdoc",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Transform JSDoc-annotated JSON-RPC 2.0 methods into OpenAPI specifications.",
|
|
5
|
-
"main": "index.
|
|
5
|
+
"main": "index.mjs",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "NODE_NO_WARNINGS=1 ava test/*.test.js"
|