File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @api-components/api-forms" ,
33 "description" : " A library containing helper classes to compute API data from the AMF web API model." ,
4- "version" : " 0.2.5 " ,
4+ "version" : " 0.2.6 " ,
55 "license" : " Apache-2.0" ,
66 "main" : " index.js" ,
77 "module" : " index.js" ,
2020 ],
2121 "repository" : {
2222 "type" : " git" ,
23- "url" : " git://github.com/advanced-rest-client/arc-headers .git"
23+ "url" : " git://github.com/advanced-rest-client/api-forms .git"
2424 },
2525 "bugs" : {
26- "url" : " https://github.com/advanced-rest-client/arc-headers /issues"
26+ "url" : " https://github.com/advanced-rest-client/api-forms /issues"
2727 },
2828 "dependencies" : {
2929 "@advanced-rest-client/arc-icons" : " ^3.3.3" ,
Original file line number Diff line number Diff line change @@ -266,6 +266,13 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
266266 return result ;
267267 }
268268
269+ _toBoolean ( value ) {
270+ if ( typeof value === 'boolean' ) {
271+ return value
272+ }
273+ return value === 'true'
274+ }
275+
269276 /**
270277 * Creates a UI model item from AMF json/ld model for a parameter.
271278 * @param {any } amfItem AMF model with schema for
@@ -276,7 +283,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
276283 amfItem = this . _resolve ( amfItem ) ;
277284 const binding = /** @type string */ ( this . _getValue ( amfItem , this . ns . aml . vocabularies . apiContract . binding ) )
278285 const name = this . _computeFormName ( amfItem ) ;
279- const required = /** @type boolean */ ( this . _getValue ( amfItem , this . ns . aml . vocabularies . apiContract . required ) )
286+ const required = this . _toBoolean ( this . _getValue ( amfItem , this . ns . aml . vocabularies . apiContract . required ) )
280287 const schemaItem = /** @type AmfFormItemSchema */ ( {
281288 required,
282289 } ) ;
@@ -726,7 +733,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
726733 _computeRequiredPropertyShape ( model ) {
727734 const key = this . ns . w3 . shacl . minCount ;
728735 const result = this . _getValue ( model , key ) ;
729- return result === 1 ;
736+ return Number ( result ) === 1 ;
730737 }
731738
732739 /**
You can’t perform that action at this time.
0 commit comments