openapi-jsonrpc-jsdoc 1.2.1 → 1.2.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.js +20 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -61,7 +61,7 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
|
|
|
61
61
|
],
|
|
62
62
|
'tags': [],
|
|
63
63
|
};
|
|
64
|
-
const requiredSchema = ['method', '
|
|
64
|
+
const requiredSchema = ['method', 'jsonrpc'];
|
|
65
65
|
prepare: for (const module of documents) {
|
|
66
66
|
let isJsonRpc = false;
|
|
67
67
|
|
|
@@ -121,7 +121,6 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
|
|
|
121
121
|
default: apiName,
|
|
122
122
|
description: `API method ${apiName}`,
|
|
123
123
|
},
|
|
124
|
-
// todo делать разграничение для notification request (без id)
|
|
125
124
|
id: {
|
|
126
125
|
type: 'integer',
|
|
127
126
|
default: 1,
|
|
@@ -155,7 +154,23 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
|
|
|
155
154
|
if (parameter.type.names[0] === 'object') {
|
|
156
155
|
return accumulator;
|
|
157
156
|
}
|
|
158
|
-
|
|
157
|
+
let [type] = parameter.type.names;
|
|
158
|
+
let items;
|
|
159
|
+
switch (type) {
|
|
160
|
+
case 'Array.<string>': {
|
|
161
|
+
type = 'array';
|
|
162
|
+
items = { type: 'number' };
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
case 'Array.<number>': {
|
|
166
|
+
type = 'array';
|
|
167
|
+
items = { type: 'string' };
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
default: {
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
159
174
|
const description = parameter.description;
|
|
160
175
|
let name;
|
|
161
176
|
try {
|
|
@@ -171,6 +186,7 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
|
|
|
171
186
|
[name]: {
|
|
172
187
|
type,
|
|
173
188
|
description,
|
|
189
|
+
items,
|
|
174
190
|
},
|
|
175
191
|
};
|
|
176
192
|
return accumulator;
|
|
@@ -179,12 +195,11 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
|
|
|
179
195
|
title: 'Parameters',
|
|
180
196
|
type: 'object',
|
|
181
197
|
'default': exampleJSON,
|
|
182
|
-
required:
|
|
198
|
+
required: [],
|
|
183
199
|
properties: {},
|
|
184
200
|
},
|
|
185
201
|
);
|
|
186
202
|
const schemaPostJsdoc = schema.post.requestBody.content['application/json'].schema;
|
|
187
|
-
schemaPostJsdoc.required.push('params');
|
|
188
203
|
schemaPostJsdoc.properties.params = propertiesParameters;
|
|
189
204
|
}
|
|
190
205
|
temporaryDocument.paths[`${api}${apiName}`] = schema;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-jsonrpc-jsdoc",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
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": {
|