@@ -128,7 +128,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
128
128
/**
129
129
* @param {ConstructorOptions= } [opts={}]
130
130
*/
131
- constructor ( opts = { } ) {
131
+ constructor ( opts = { } ) {
132
132
super ( ) ;
133
133
/**
134
134
* An array of properties for which view model is to be generated.
@@ -220,7 +220,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
220
220
result [ result . length ] = data ;
221
221
}
222
222
} else if ( this . _hasType ( items , this . ns . aml . vocabularies . shapes . UnionShape ) ) {
223
- result = this . _modelForUnion ( items ) ;
223
+ result = this . _modelForUnion ( items ) ;
224
224
}
225
225
return result ;
226
226
}
@@ -338,6 +338,9 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
338
338
if ( ! this . noDocs ) {
339
339
schemaItem . description = this . _computeDescription ( amfItem ) ;
340
340
}
341
+ if ( schemaItem . isBool ) {
342
+ result . value = schemaItem . defaultValue
343
+ }
341
344
const valueDelimiter = this . _computeValueDelimiter ( binding ) ;
342
345
const decodeValues = this . _computeDecodeValues ( binding ) ;
343
346
const processOptions = {
@@ -453,7 +456,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
453
456
* @param {ProcessOptions= } processOptions
454
457
* @return {AmfFormItem[] } View model for items.
455
458
*/
456
- modelForRawObject ( model , processOptions = { } ) {
459
+ modelForRawObject ( model , processOptions = { } ) {
457
460
const result = [ ] ;
458
461
const keys = Object . keys ( model ) ;
459
462
const dataKey = this . _getAmfKey ( this . ns . raml . vocabularies . data . toString ( ) ) ;
@@ -625,8 +628,8 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
625
628
}
626
629
if ( item . schema . required && typeof item . schema . defaultValue !== 'undefined' ) {
627
630
item . value = item . schema . isArray ?
628
- this . _parseArrayExample ( /** @type {string } */ ( item . schema . defaultValue ) , processOptions ) :
629
- this . _exampleAsValue ( /** @type {string } */ ( item . schema . defaultValue ) , processOptions ) ;
631
+ this . _parseArrayExample ( /** @type {string } */ ( item . schema . defaultValue ) , processOptions ) :
632
+ this . _exampleAsValue ( /** @type {string } */ ( item . schema . defaultValue ) , processOptions ) ;
630
633
}
631
634
if ( typeof item . value === 'undefined' && item . schema . required ) {
632
635
const { examples } = item . schema ;
@@ -1181,10 +1184,10 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
1181
1184
_computeInputType ( type ) {
1182
1185
if ( type && NUMBER_INPUT_TYPES . indexOf ( type ) !== - 1 ) {
1183
1186
return 'number' ;
1184
- }
1187
+ }
1185
1188
if ( type === 'boolean' ) {
1186
1189
return 'boolean' ;
1187
- }
1190
+ }
1188
1191
if ( type === 'date-only' || type === 'date' ) {
1189
1192
return 'date' ;
1190
1193
} /* else if (type === 'time-only' || type === 'time') {
@@ -1268,7 +1271,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
1268
1271
* @param {string= } binding
1269
1272
* @return {AmfFormItem } Generated basic view model.
1270
1273
*/
1271
- buildProperty ( defaults = {
1274
+ buildProperty ( defaults = {
1272
1275
name : undefined ,
1273
1276
value : undefined ,
1274
1277
enabled : true ,
@@ -1367,7 +1370,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
1367
1370
return false ;
1368
1371
}
1369
1372
for ( let i = 0 , len = values . length ; i < len ; i ++ ) {
1370
- const id = this . _ensureAmfPrefix ( /** @type string */ ( this . _getValue ( values [ i ] , '@id' ) ) ) ;
1373
+ const id = this . _ensureAmfPrefix ( /** @type string */ ( this . _getValue ( values [ i ] , '@id' ) ) ) ;
1371
1374
const node = shape [ id ] ;
1372
1375
const extensionNameKey = this . _getAmfKey ( this . ns . aml . vocabularies . core . extensionName ) ;
1373
1376
if ( this . _getValue ( node , extensionNameKey ) === 'no-auto-encoding' ) {
@@ -1378,8 +1381,8 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
1378
1381
}
1379
1382
1380
1383
/**
1381
- *
1382
- * @param {string } id
1384
+ *
1385
+ * @param {string } id
1383
1386
* @return {string }
1384
1387
*/
1385
1388
_ensureAmfPrefix ( id ) {
0 commit comments