openapi-jsonrpc-jsdoc 1.2.5 → 1.2.6
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 +15 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -167,21 +167,30 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
|
|
|
167
167
|
}
|
|
168
168
|
let items;
|
|
169
169
|
let enumData;
|
|
170
|
+
let oneOf;
|
|
170
171
|
|
|
171
172
|
switch (type) {
|
|
172
173
|
case 'Array.<string>': {
|
|
173
174
|
type = 'array';
|
|
174
|
-
items = { type: '
|
|
175
|
+
items = { type: 'string' };
|
|
175
176
|
break;
|
|
176
177
|
}
|
|
177
178
|
case 'Array.<number>': {
|
|
178
179
|
type = 'array';
|
|
179
|
-
items = { type: '
|
|
180
|
+
items = { type: 'number' };
|
|
180
181
|
break;
|
|
181
182
|
}
|
|
182
183
|
case 'enum': {
|
|
183
184
|
enumData = parameter.type.names;
|
|
184
|
-
|
|
185
|
+
oneOf = parameter.type.names.map((n) => {
|
|
186
|
+
if (!Number.isNaN(Number(n))) {
|
|
187
|
+
return Number(n);
|
|
188
|
+
}
|
|
189
|
+
return n;
|
|
190
|
+
});
|
|
191
|
+
if (parameter.type.names.every(n => Number.isInteger(Number(n)))) {
|
|
192
|
+
type = 'integer';
|
|
193
|
+
} else if (parameter.type.names.every(n => !Number.isNaN(Number(n)))) {
|
|
185
194
|
type = 'number';
|
|
186
195
|
} else {
|
|
187
196
|
type = 'string';
|
|
@@ -215,6 +224,9 @@ async function openapiJsonrpcJsdoc({ files, securitySchemes = {}, packageUrl, se
|
|
|
215
224
|
if (enumData) {
|
|
216
225
|
accumulator.properties[name].enum = enumData;
|
|
217
226
|
}
|
|
227
|
+
if (oneOf) {
|
|
228
|
+
accumulator.properties[name].oneOf = oneOf;
|
|
229
|
+
}
|
|
218
230
|
|
|
219
231
|
return accumulator;
|
|
220
232
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-jsonrpc-jsdoc",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
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": {
|