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 1
1
{
2
2
"name" : " @api-components/api-forms" ,
3
3
"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 " ,
5
5
"license" : " Apache-2.0" ,
6
6
"main" : " index.js" ,
7
7
"module" : " index.js" ,
20
20
],
21
21
"repository" : {
22
22
"type" : " git" ,
23
- "url" : " git://github.com/advanced-rest-client/arc-headers .git"
23
+ "url" : " git://github.com/advanced-rest-client/api-forms .git"
24
24
},
25
25
"bugs" : {
26
- "url" : " https://github.com/advanced-rest-client/arc-headers /issues"
26
+ "url" : " https://github.com/advanced-rest-client/api-forms /issues"
27
27
},
28
28
"dependencies" : {
29
29
"@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) {
266
266
return result ;
267
267
}
268
268
269
+ _toBoolean ( value ) {
270
+ if ( typeof value === 'boolean' ) {
271
+ return value
272
+ }
273
+ return value === 'true'
274
+ }
275
+
269
276
/**
270
277
* Creates a UI model item from AMF json/ld model for a parameter.
271
278
* @param {any } amfItem AMF model with schema for
@@ -276,7 +283,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
276
283
amfItem = this . _resolve ( amfItem ) ;
277
284
const binding = /** @type string */ ( this . _getValue ( amfItem , this . ns . aml . vocabularies . apiContract . binding ) )
278
285
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 ) )
280
287
const schemaItem = /** @type AmfFormItemSchema */ ( {
281
288
required,
282
289
} ) ;
@@ -726,7 +733,7 @@ export class ApiViewModel extends AmfHelperMixin(Object) {
726
733
_computeRequiredPropertyShape ( model ) {
727
734
const key = this . ns . w3 . shacl . minCount ;
728
735
const result = this . _getValue ( model , key ) ;
729
- return result === 1 ;
736
+ return Number ( result ) === 1 ;
730
737
}
731
738
732
739
/**
You can’t perform that action at this time.
0 commit comments