@penkov/swagger-code-gen 1.8.2 → 1.8.3

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.
@@ -22,7 +22,7 @@ export class NameUtils {
22
22
  return `$${n}`;
23
23
  }
24
24
  else {
25
- return n;
25
+ return n.replace(/\./g, '_');
26
26
  }
27
27
  }
28
28
  }
package/dist/parameter.js CHANGED
@@ -19,7 +19,14 @@ export class Parameter {
19
19
  const inValue = def.in;
20
20
  const desc = option(def.description);
21
21
  let defaultValue = none;
22
- const schema = SchemaFactory.build(def.name, def.schema, schemas, options);
22
+ const schema = def.schema ?
23
+ SchemaFactory.build(def.name, def.schema, schemas, options) :
24
+ Property.fromDefinition(name, {
25
+ ...def,
26
+ type: def['type'],
27
+ required: option(def.required).filter(x => typeof x === 'boolean')
28
+ .map(x => x).orUndefined
29
+ }, schemas, options);
23
30
  let jsType;
24
31
  if (schema instanceof SchemaObject) {
25
32
  jsType = schema.type;
@@ -53,7 +60,7 @@ export class Parameter {
53
60
  throw new Error('Unknown schema type');
54
61
  }
55
62
  const required = option(def.required).exists(identity) || defaultValue.nonEmpty;
56
- const isArray = def.schema.type === 'array';
63
+ const isArray = def?.schema?.type === 'array';
57
64
  return new Parameter(name, name, inValue, jsType, required, isArray, defaultValue, desc);
58
65
  }
59
66
  static toJSName(path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@penkov/swagger-code-gen",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "generate-client": "./dist/cli.mjs"