@@ -128,7 +128,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
128128 /**
129129 * @param {ConstructorOptions= } [opts={}]
130130 */
131- constructor ( opts = { } ) {
131+ constructor ( opts = { } ) {
132132 super ( ) ;
133133 /**
134134 * An array of properties for which view model is to be generated.
@@ -220,7 +220,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
220220 result [ result . length ] = data ;
221221 }
222222 } else if ( this . _hasType ( items , this . ns . aml . vocabularies . shapes . UnionShape ) ) {
223- result = this . _modelForUnion ( items ) ;
223+ result = this . _modelForUnion ( items ) ;
224224 }
225225 return result ;
226226 }
@@ -338,6 +338,9 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
338338 if ( ! this . noDocs ) {
339339 schemaItem . description = this . _computeDescription ( amfItem ) ;
340340 }
341+ if ( schemaItem . isBool ) {
342+ result . value = schemaItem . defaultValue
343+ }
341344 const valueDelimiter = this . _computeValueDelimiter ( binding ) ;
342345 const decodeValues = this . _computeDecodeValues ( binding ) ;
343346 const processOptions = {
@@ -453,7 +456,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
453456 * @param {ProcessOptions= } processOptions
454457 * @return {AmfFormItem[] } View model for items.
455458 */
456- modelForRawObject ( model , processOptions = { } ) {
459+ modelForRawObject ( model , processOptions = { } ) {
457460 const result = [ ] ;
458461 const keys = Object . keys ( model ) ;
459462 const dataKey = this . _getAmfKey ( this . ns . raml . vocabularies . data . toString ( ) ) ;
@@ -625,8 +628,8 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
625628 }
626629 if ( item . schema . required && typeof item . schema . defaultValue !== 'undefined' ) {
627630 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 ) ;
630633 }
631634 if ( typeof item . value === 'undefined' && item . schema . required ) {
632635 const { examples } = item . schema ;
@@ -1181,10 +1184,10 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
11811184 _computeInputType ( type ) {
11821185 if ( type && NUMBER_INPUT_TYPES . indexOf ( type ) !== - 1 ) {
11831186 return 'number' ;
1184- }
1187+ }
11851188 if ( type === 'boolean' ) {
11861189 return 'boolean' ;
1187- }
1190+ }
11881191 if ( type === 'date-only' || type === 'date' ) {
11891192 return 'date' ;
11901193 } /* else if (type === 'time-only' || type === 'time') {
@@ -1268,7 +1271,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
12681271 * @param {string= } binding
12691272 * @return {AmfFormItem } Generated basic view model.
12701273 */
1271- buildProperty ( defaults = {
1274+ buildProperty ( defaults = {
12721275 name : undefined ,
12731276 value : undefined ,
12741277 enabled : true ,
@@ -1367,7 +1370,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
13671370 return false ;
13681371 }
13691372 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' ) ) ) ;
13711374 const node = shape [ id ] ;
13721375 const extensionNameKey = this . _getAmfKey ( this . ns . aml . vocabularies . core . extensionName ) ;
13731376 if ( this . _getValue ( node , extensionNameKey ) === 'no-auto-encoding' ) {
@@ -1378,8 +1381,8 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
13781381 }
13791382
13801383 /**
1381- *
1382- * @param {string } id
1384+ *
1385+ * @param {string } id
13831386 * @return {string }
13841387 */
13851388 _ensureAmfPrefix ( id ) {
0 commit comments