@penkov/swagger-code-gen 1.8.3 → 1.8.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/dist/parameter.js CHANGED
@@ -3,8 +3,9 @@ import { Collection, identity, none, option } from 'scats';
3
3
  import { Method } from './method.js';
4
4
  import { Property } from './property.js';
5
5
  export class Parameter {
6
- constructor(name, uniqueName, inValue, jsType, required, isArray, defaultValue, description) {
6
+ constructor(name, rawName, uniqueName, inValue, jsType, required, isArray, defaultValue, description) {
7
7
  this.name = name;
8
+ this.rawName = rawName;
8
9
  this.uniqueName = uniqueName;
9
10
  this.inValue = inValue;
10
11
  this.jsType = jsType;
@@ -16,6 +17,7 @@ export class Parameter {
16
17
  }
17
18
  static fromDefinition(def, schemas, options) {
18
19
  const name = Parameter.toJSName(def.name);
20
+ const rawName = def.name;
19
21
  const inValue = def.in;
20
22
  const desc = option(def.description);
21
23
  let defaultValue = none;
@@ -61,7 +63,7 @@ export class Parameter {
61
63
  }
62
64
  const required = option(def.required).exists(identity) || defaultValue.nonEmpty;
63
65
  const isArray = def?.schema?.type === 'array';
64
- return new Parameter(name, name, inValue, jsType, required, isArray, defaultValue, desc);
66
+ return new Parameter(name, rawName, name, inValue, jsType, required, isArray, defaultValue, desc);
65
67
  }
66
68
  static toJSName(path) {
67
69
  const tokens = Collection.from(path.split(/\W/)).filter(t => t.length > 0);
@@ -70,6 +72,6 @@ export class Parameter {
70
72
  }).mkString();
71
73
  }
72
74
  copy(p) {
73
- return new Parameter(option(p.name).getOrElseValue(this.name), option(p.uniqueName).getOrElseValue(this.uniqueName), option(p.in).getOrElseValue(this.in), option(p.jsType).getOrElseValue(this.jsType), option(p.required).getOrElseValue(this.required), option(p.isArray).getOrElseValue(this.isArray), option(p.defaultValue).getOrElseValue(this.defaultValue), option(p.description).getOrElseValue(this.description));
75
+ return new Parameter(option(p.name).getOrElseValue(this.name), option(p.rawName).getOrElseValue(this.rawName), option(p.uniqueName).getOrElseValue(this.uniqueName), option(p.in).getOrElseValue(this.in), option(p.jsType).getOrElseValue(this.jsType), option(p.required).getOrElseValue(this.required), option(p.isArray).getOrElseValue(this.isArray), option(p.defaultValue).getOrElseValue(this.defaultValue), option(p.description).getOrElseValue(this.description));
74
76
  }
75
77
  }
@@ -82,7 +82,7 @@ export async function <%= method.endpointName %><%= body.map(b => b.suffix).getO
82
82
  <%_ } -%>
83
83
  <%_ if (method.parameters.filter(x => x.in === 'header').nonEmpty) { -%>
84
84
  <%_ method.parameters.filter(x => x.in === 'header').foreach(p => { -%>
85
- <%= p.name %>: <%= method.wrapParamsInObject ? 'params.' : '' %><%= p.uniqueName %>,
85
+ '<%= p.rawName %>': <%= method.wrapParamsInObject ? 'params.' : '' %><%= p.uniqueName %>,
86
86
  <%_ }) -%>
87
87
  <%_ } -%>
88
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@penkov/swagger-code-gen",
3
- "version": "1.8.3",
3
+ "version": "1.8.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "generate-client": "./dist/cli.mjs"