openapi-jsonrpc-jsdoc 1.3.2 → 1.4.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/index.mjs +9 -8
- package/package.json +3 -3
package/index.mjs
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import jsdoc from 'jsdoc-api';
|
|
2
2
|
|
|
3
3
|
export default async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, servers, api = '/' }) {
|
|
4
|
-
const
|
|
5
|
-
files,
|
|
4
|
+
const allData = await jsdoc.explain({
|
|
5
|
+
files: Array.isArray(files) ? files : [files],
|
|
6
6
|
package: packageUrl,
|
|
7
7
|
access: 'public',
|
|
8
8
|
encoding: 'utf8',
|
|
9
|
-
module: true,
|
|
10
9
|
undocumented: false,
|
|
11
|
-
sort: 'scope',
|
|
12
10
|
allowUnknownTags: true,
|
|
13
11
|
dictionaries: ['jsdoc'],
|
|
14
|
-
hierarchy: true,
|
|
15
12
|
});
|
|
13
|
+
const package_ = allData.find(item => item.kind === 'package');
|
|
14
|
+
const documents = allData.filter(item => item.kind !== 'package');
|
|
16
15
|
const temporaryDocument = {
|
|
17
16
|
'x-send-defaults': true,
|
|
18
17
|
'openapi': '3.0.0',
|
|
@@ -239,8 +238,10 @@ export default async function openapiJsonrpcJsdoc({ files, securitySchemes = {},
|
|
|
239
238
|
properties: {},
|
|
240
239
|
},
|
|
241
240
|
);
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
if (exampleJSON !== null) {
|
|
242
|
+
const schemaPostJsdoc = schema.post.requestBody.content['application/json'].schema;
|
|
243
|
+
schemaPostJsdoc.properties.params = propertiesParameters;
|
|
244
|
+
}
|
|
244
245
|
}
|
|
245
246
|
temporaryDocument.paths[`${api}${apiName}`] = schema;
|
|
246
247
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-jsonrpc-jsdoc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Transform JSDoc-annotated JSON-RPC 2.0 methods into OpenAPI specifications.",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/qertis/openapi-jsonrpc-jsdoc#readme",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"jsdoc-
|
|
32
|
+
"jsdoc-api": "~9.3.5"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"ava": "~6.4.1",
|
|
36
36
|
"express": "~5.2.1",
|
|
37
|
-
"express-openapi-validator": "~5.6.
|
|
37
|
+
"express-openapi-validator": "~5.6.2"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">= 22"
|