openapi-ts-generator 5.223.11 → 5.223.18
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/openapidoc-converter.js
CHANGED
|
@@ -268,6 +268,7 @@ var OpenApiDocConverter = /** @class */ (function () {
|
|
|
268
268
|
kebabCasedTypeName: (0, lodash_1.kebabCase)(value),
|
|
269
269
|
isEnum: (refSchema.enum || []).length > 0,
|
|
270
270
|
areAllArrays: props.every(function (val) { return val.type === 'array'; }),
|
|
271
|
+
hasArrays: props.some(function (val) { return val.type === 'array'; }),
|
|
271
272
|
isSelfReferencing: entityName === value,
|
|
272
273
|
};
|
|
273
274
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-ts-generator",
|
|
3
|
-
"version": "5.223.
|
|
3
|
+
"version": "5.223.18",
|
|
4
4
|
"description": "Based on swagger-ts-generator, this is a type script model generator specifically for services with OpenApi spec documentation.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -8,19 +8,20 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { FormControl, FormArray, FormGroup, Validators } from '@angular/forms'; //NOSONAR{{#if importTypes}}{{#importTypes}}{{#unless areAllArrays}}{{#if isEnum}}
|
|
10
10
|
import { {{name}} } from './{{kebabCasedTypeName}}.enum';{{else}}
|
|
11
|
-
import { I{{name}} } from './{{kebabCasedTypeName}}.model';{{/if}}{{/unless}}{{
|
|
11
|
+
import { I{{name}} } from './{{kebabCasedTypeName}}.model';{{/if}}{{/unless}}{{#if hasArrays}}
|
|
12
|
+
import { I{{name}}Form } from './{{kebabCasedTypeName}}.form-group-fac';{{/if}}{{/importTypes}}{{/if}}
|
|
12
13
|
|
|
13
14
|
export interface I{{name}}Form {
|
|
14
15
|
{{#valueProperties}}
|
|
15
16
|
{{#if isArray}}
|
|
16
|
-
{{name}}: FormArray
|
|
17
|
+
{{name}}: FormArray<FormControl<{{typeScriptType}}>>;
|
|
17
18
|
{{else}}
|
|
18
19
|
{{name}}: FormControl<{{typeScriptType}}{{#unless required}} | null{{/unless}}>;
|
|
19
20
|
{{/if}}
|
|
20
21
|
{{/valueProperties}}
|
|
21
22
|
{{#referenceProperties}}
|
|
22
23
|
{{#if isArray}}
|
|
23
|
-
{{name}}: FormArray
|
|
24
|
+
{{name}}: FormArray<FormGroup<I{{typeScriptType}}Form>>;
|
|
24
25
|
{{else}}
|
|
25
26
|
{{name}}: FormControl<{{#unless isEnum}}I{{/unless}}{{typeScriptType}}{{#unless required}} | null{{/unless}}>;
|
|
26
27
|
{{/if}}
|
|
@@ -32,9 +33,9 @@ export function {{name}}FormGroupFac(): FormGroup<I{{name}}Form> {
|
|
|
32
33
|
{{#valueProperties}}
|
|
33
34
|
{{#if isArray}}
|
|
34
35
|
{{#if hasMultipleValidators}}
|
|
35
|
-
{{name}}: new FormArray([], { validators: Validators.compose([{{#if required}}Validators.required, {{/if}}{{minLengthValidator "valueProperties"}}{{maxLengthValidator "valueProperties"}}{{minimumValidator "valueProperties"}}{{maximumValidator "valueProperties"}}{{minItemsValidator "valueProperties"}}{{maxItemsValidator "valueProperties"}}{{{patternValidator "valueProperties"}}}]) })),
|
|
36
|
+
{{name}}: new FormArray<FormControl<{{typeScriptType}}>>([], { validators: Validators.compose([{{#if required}}Validators.required, {{/if}}{{minLengthValidator "valueProperties"}}{{maxLengthValidator "valueProperties"}}{{minimumValidator "valueProperties"}}{{maximumValidator "valueProperties"}}{{minItemsValidator "valueProperties"}}{{maxItemsValidator "valueProperties"}}{{{patternValidator "valueProperties"}}}]) })),
|
|
36
37
|
{{else}}
|
|
37
|
-
{{name}}: new FormArray([]{{#if hasValidators}}, { validators: {{#if required}}Validators.required{{/if}}{{minLengthValidator "valueProperties"}}{{maxLengthValidator "valueProperties"}}{{minimumValidator "valueProperties"}}{{maximumValidator "valueProperties"}}{{minItemsValidator "valueProperties"}}{{maxItemsValidator "valueProperties"}}{{{patternValidator "valueProperties"}}} }{{/if}}),
|
|
38
|
+
{{name}}: new FormArray<FormControl<{{typeScriptType}}>>([]{{#if hasValidators}}, { validators: {{#if required}}Validators.required{{/if}}{{minLengthValidator "valueProperties"}}{{maxLengthValidator "valueProperties"}}{{minimumValidator "valueProperties"}}{{maximumValidator "valueProperties"}}{{minItemsValidator "valueProperties"}}{{maxItemsValidator "valueProperties"}}{{{patternValidator "valueProperties"}}} }{{/if}}),
|
|
38
39
|
{{/if}}
|
|
39
40
|
{{else}}
|
|
40
41
|
{{#if hasMultipleValidators}}
|
|
@@ -47,9 +48,9 @@ export function {{name}}FormGroupFac(): FormGroup<I{{name}}Form> {
|
|
|
47
48
|
{{#referenceProperties}}
|
|
48
49
|
{{#if isArray}}
|
|
49
50
|
{{#if hasMultipleValidators}}
|
|
50
|
-
{{name}}: new FormArray([], { validators: Validators.compose([{{#if required}}Validators.required, {{/if}}{{minLengthValidator "referenceProperties"}}{{maxLengthValidator "referenceProperties"}}{{minimumValidator "referenceProperties"}}{{maximumValidator "referenceProperties"}}{{minItemsValidator "referenceProperties"}}{{maxItemsValidator "referenceProperties"}}{{{patternValidator "referenceProperties"}}}]) }),
|
|
51
|
+
{{name}}: new FormArray<FormGroup<I{{typeScriptType}}Form>>([], { validators: Validators.compose([{{#if required}}Validators.required, {{/if}}{{minLengthValidator "referenceProperties"}}{{maxLengthValidator "referenceProperties"}}{{minimumValidator "referenceProperties"}}{{maximumValidator "referenceProperties"}}{{minItemsValidator "referenceProperties"}}{{maxItemsValidator "referenceProperties"}}{{{patternValidator "referenceProperties"}}}]) }),
|
|
51
52
|
{{else}}
|
|
52
|
-
{{name}}: new FormArray([]{{#if hasValidators}}, { validators: {{#if required}}Validators.required{{/if}}{{minLengthValidator "referenceProperties"}}{{maxLengthValidator "referenceProperties"}}{{minimumValidator "referenceProperties"}}{{maximumValidator "referenceProperties"}}{{minItemsValidator "referenceProperties"}}{{maxItemsValidator "referenceProperties"}}{{{patternValidator "referenceProperties"}}} } {{/if}}),
|
|
53
|
+
{{name}}: new FormArray<FormGroup<I{{typeScriptType}}Form>>([]{{#if hasValidators}}, { validators: {{#if required}}Validators.required{{/if}}{{minLengthValidator "referenceProperties"}}{{maxLengthValidator "referenceProperties"}}{{minimumValidator "referenceProperties"}}{{maximumValidator "referenceProperties"}}{{minItemsValidator "referenceProperties"}}{{maxItemsValidator "referenceProperties"}}{{{patternValidator "referenceProperties"}}} } {{/if}}),
|
|
53
54
|
{{/if}}
|
|
54
55
|
{{else}}
|
|
55
56
|
{{#if hasMultipleValidators}}
|
package/templates/model.ts.hbs
CHANGED
|
@@ -18,9 +18,9 @@ export interface I{{{name}}} {
|
|
|
18
18
|
* {{description}}
|
|
19
19
|
*/
|
|
20
20
|
{{/if}}
|
|
21
|
-
{{name}}?: {{typeScriptType}}{{#if isArray}}[]{{/if}};
|
|
21
|
+
{{name}}?: {{typeScriptType}}{{#if isArray}}[]{{/if}} | null;
|
|
22
22
|
{{/valueProperties}}
|
|
23
23
|
{{#referenceProperties}}
|
|
24
|
-
{{name}}?: {{#unless isEnum}}I{{/unless}}{{referenceTypeName}}{{#if isArray}}[]{{/if}};
|
|
24
|
+
{{name}}?: {{#unless isEnum}}I{{/unless}}{{referenceTypeName}}{{#if isArray}}[]{{/if}} | null;
|
|
25
25
|
{{/referenceProperties}}
|
|
26
26
|
}
|