openapi-jsonrpc-jsdoc 1.5.3 → 1.5.4
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 +16 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -29,6 +29,15 @@ function isBigInt64(n) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
function normalizeString(s) {
|
|
33
|
+
if (
|
|
34
|
+
(s.startsWith("'") && s.endsWith("'"))
|
|
35
|
+
|| (s.startsWith('"') && s.endsWith('"'))
|
|
36
|
+
) {
|
|
37
|
+
return s.slice(1, -1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
function resolveSchemaFromTypeNames(names) {
|
|
33
42
|
let type;
|
|
34
43
|
let format;
|
|
@@ -92,8 +101,10 @@ function resolveSchemaFromTypeNames(names) {
|
|
|
92
101
|
return Number(n);
|
|
93
102
|
} else if (isBigInt64(n)) {
|
|
94
103
|
return n;
|
|
104
|
+
} else if (typeof n === 'string') {
|
|
105
|
+
return normalizeString(n)
|
|
95
106
|
}
|
|
96
|
-
return
|
|
107
|
+
return s;
|
|
97
108
|
});
|
|
98
109
|
|
|
99
110
|
if (enumData.every(n => Number.isSafeInteger(n))) {
|
|
@@ -349,16 +360,16 @@ export default async function openapiJsonrpcJsdoc({
|
|
|
349
360
|
},
|
|
350
361
|
};
|
|
351
362
|
if (module.params) {
|
|
352
|
-
|
|
363
|
+
let propertiesParameters = {};
|
|
364
|
+
let required = [];
|
|
365
|
+
|
|
353
366
|
if (module.examples?.length) {
|
|
354
367
|
const exampleJSON = JSON.parse(module.examples[0]);
|
|
355
368
|
if (exampleJSON) {
|
|
356
|
-
|
|
369
|
+
propertiesParameters['default'] = exampleJSON;
|
|
357
370
|
}
|
|
358
371
|
}
|
|
359
372
|
|
|
360
|
-
let propertiesParameters = {};
|
|
361
|
-
let required = [];
|
|
362
373
|
for (const parameter of module.params) {
|
|
363
374
|
if (parameter.name.startsWith('_')) {
|
|
364
375
|
continue;
|