@penkov/swagger-code-gen 1.8.1 → 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.
- package/dist/name.utils.js +1 -1
- package/dist/parameter.js +9 -2
- package/dist/property.js +2 -0
- package/package.json +1 -1
package/dist/name.utils.js
CHANGED
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 =
|
|
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
|
|
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/dist/property.js
CHANGED
|
@@ -95,6 +95,8 @@ export class Property {
|
|
|
95
95
|
}
|
|
96
96
|
static toJsType(tpe, itemTpe = 'any', format = none) {
|
|
97
97
|
switch (tpe) {
|
|
98
|
+
case 'boolean': return 'boolean';
|
|
99
|
+
case 'number': return 'number';
|
|
98
100
|
case 'integer': return 'number';
|
|
99
101
|
case 'file': return 'File';
|
|
100
102
|
case 'any': return 'any';
|