openapi-jsonrpc-jsdoc 1.2.0 → 1.2.1
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/README.md +1 -0
- package/index.js +15 -7
- package/package.json +1 -1
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -13,7 +13,7 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
|
|
|
13
13
|
dictionaries: ['jsdoc'],
|
|
14
14
|
hierarchy: true,
|
|
15
15
|
});
|
|
16
|
-
const tags =
|
|
16
|
+
const tags = new Set();
|
|
17
17
|
const temporaryDocument = {
|
|
18
18
|
'x-send-defaults': true,
|
|
19
19
|
'openapi': '3.0.0',
|
|
@@ -59,17 +59,25 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
|
|
|
59
59
|
BasicAuth: [],
|
|
60
60
|
},
|
|
61
61
|
],
|
|
62
|
-
'tags':
|
|
62
|
+
'tags': [],
|
|
63
63
|
};
|
|
64
64
|
const requiredSchema = ['method', 'id', 'jsonrpc'];
|
|
65
|
-
for (const module of documents) {
|
|
66
|
-
|
|
65
|
+
prepare: for (const module of documents) {
|
|
66
|
+
let isJsonRpc = false;
|
|
67
67
|
|
|
68
68
|
if (module.tags && Array.isArray(module.tags)) {
|
|
69
|
-
for (const
|
|
70
|
-
|
|
69
|
+
for (const {title, value} of module.tags) {
|
|
70
|
+
if (title === 'json-rpc') {
|
|
71
|
+
isJsonRpc = true;
|
|
72
|
+
} else if (title === 'tags' && value) {
|
|
73
|
+
value.split(',').map(t => t.trim()).forEach(t => tags.add(t));
|
|
74
|
+
}
|
|
71
75
|
}
|
|
72
76
|
}
|
|
77
|
+
if (!isJsonRpc) {
|
|
78
|
+
continue prepare;
|
|
79
|
+
}
|
|
80
|
+
const apiName = module.meta.filename.replace(/.js$/, '');
|
|
73
81
|
|
|
74
82
|
const schema = {
|
|
75
83
|
post: {
|
|
@@ -77,7 +85,7 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
|
|
|
77
85
|
deprecated: module.deprecated || false,
|
|
78
86
|
summary: `/${apiName}`,
|
|
79
87
|
description: module.description,
|
|
80
|
-
tags: tags,
|
|
88
|
+
tags: Array.from(tags),
|
|
81
89
|
parameters: [],
|
|
82
90
|
responses: {
|
|
83
91
|
'200': {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-jsonrpc-jsdoc",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Transform JSDoc-annotated JSON-RPC 2.0 methods into OpenAPI 3.0 specifications. Auto-generates REST API documentation with complete schemas, parameters, and endpoint definitions.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|