openapi-ts-generator 5.221.5 → 5.221.7
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
|
@@ -152,11 +152,11 @@ var OpenApiDocConverter = /** @class */ (function () {
|
|
|
152
152
|
};
|
|
153
153
|
};
|
|
154
154
|
OpenApiDocConverter.prototype.getInitialValue = function (propertyName, schemaWrapperInfo) {
|
|
155
|
-
var _a
|
|
155
|
+
var _a;
|
|
156
156
|
var typescriptType = this.getPropertyTypeScriptType(schemaWrapperInfo);
|
|
157
157
|
var isRequired = this.getIsRequired(propertyName, schemaWrapperInfo);
|
|
158
|
-
var
|
|
159
|
-
|
|
158
|
+
var refObject = (((_a = this.apiDocument.components) === null || _a === void 0 ? void 0 : _a.schemas) || {})[schemaWrapperInfo.propertyReferenceObject['$ref']];
|
|
159
|
+
var defaultValue = (schemaWrapperInfo.componentSchemaObject.default || (refObject === null || refObject === void 0 ? void 0 : refObject.default) || ((refObject === null || refObject === void 0 ? void 0 : refObject.enum) || [])[0]);
|
|
160
160
|
if (defaultValue) {
|
|
161
161
|
return "'".concat(defaultValue.split(' ').pop(), "'");
|
|
162
162
|
}
|
|
@@ -185,13 +185,15 @@ var OpenApiDocConverter = /** @class */ (function () {
|
|
|
185
185
|
var required = this.getIsRequired(propertyName, schemaWrapperInfo);
|
|
186
186
|
var validatorCount = this.getValidatorCount(propertyName, schemaWrapperInfo);
|
|
187
187
|
var initialValue = this.getInitialValue(propertyName, schemaWrapperInfo);
|
|
188
|
+
var typeName = this.parseRef(schemaWrapperInfo);
|
|
188
189
|
return {
|
|
189
190
|
required: required,
|
|
190
191
|
name: propertyName,
|
|
191
192
|
initialValue: initialValue,
|
|
192
193
|
snakeCaseName: _.snakeCase(propertyName).toUpperCase(),
|
|
193
|
-
referenceTypeName:
|
|
194
|
-
typeScriptType:
|
|
194
|
+
referenceTypeName: typeName,
|
|
195
|
+
typeScriptType: typeName,
|
|
196
|
+
kebabCasedTypeScriptType: (0, lodash_1.kebabCase)(typeName),
|
|
195
197
|
isArray: false,
|
|
196
198
|
isEnum: (propertySchema.enum || []).length > 0,
|
|
197
199
|
hasValidators: validatorCount > 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-ts-generator",
|
|
3
|
-
"version": "5.221.
|
|
3
|
+
"version": "5.221.7",
|
|
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",
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* For issues or feature request, visit the repo: https://github.com/ikemtz/openapi-ts-generator
|
|
7
7
|
* Do not edit.
|
|
8
8
|
*/
|
|
9
|
-
import { FormControl, FormArray, FormGroup, Validators } from '@angular/forms'; //NOSONAR{{#
|
|
10
|
-
import { {{
|
|
11
|
-
import { I{{
|
|
9
|
+
import { FormControl, FormArray, FormGroup, Validators } from '@angular/forms'; //NOSONAR{{#referenceProperties}}{{#unless isArray}}{{#if isEnum}}
|
|
10
|
+
import { {{typeScriptType}} } from './{{kebabCasedTypeScriptType}}.enum';{{else}}
|
|
11
|
+
import { I{{typeScriptType}} } from './{{kebabCasedTypeScriptType}}.model';{{/if}}{{/unless}}{{/referenceProperties}}
|
|
12
12
|
|
|
13
13
|
export function {{name}}FormGroupFac(): FormGroup {
|
|
14
14
|
return new FormGroup({
|