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.
Files changed (2) hide show
  1. package/index.mjs +16 -5
  2. 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 String(n);
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
- const prevObject = {};
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
- prevObject['default'] = exampleJSON;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-jsonrpc-jsdoc",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "Transform JSDoc-annotated JSON-RPC 2.0 methods into OpenAPI specifications.",
5
5
  "main": "index.mjs",
6
6
  "type": "module",