@api-components/api-type-document 4.2.26 → 4.2.27
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/package.json +1 -1
- package/src/PropertyShapeDocument.js +10 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@api-components/api-type-document",
|
|
3
3
|
"description": "A documentation table for type (resource) properties. Works with AMF data model",
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.27",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"module": "index.js",
|
|
@@ -390,6 +390,13 @@ export class PropertyShapeDocument extends PropertyDocumentMixin(LitElement) {
|
|
|
390
390
|
return !!parentTypeName;
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
+
_toBoolean(value) {
|
|
394
|
+
if (typeof value === 'boolean') {
|
|
395
|
+
return value
|
|
396
|
+
}
|
|
397
|
+
return value === 'true'
|
|
398
|
+
}
|
|
399
|
+
|
|
393
400
|
/**
|
|
394
401
|
* Computes value for `isRequired` property.
|
|
395
402
|
* In AMF model a property is required when `http://www.w3.org/ns/shacl#minCount`
|
|
@@ -404,10 +411,11 @@ export class PropertyShapeDocument extends PropertyDocumentMixin(LitElement) {
|
|
|
404
411
|
}
|
|
405
412
|
shape = this._resolve(shape);
|
|
406
413
|
if (this._hasType(shape, this.ns.aml.vocabularies.apiContract.Parameter)) {
|
|
407
|
-
|
|
414
|
+
const required = this._getValue(
|
|
408
415
|
shape,
|
|
409
416
|
this.ns.aml.vocabularies.apiContract.required
|
|
410
|
-
)
|
|
417
|
+
)
|
|
418
|
+
return this._toBoolean(required);
|
|
411
419
|
}
|
|
412
420
|
const data = this._getValue(shape, this.ns.w3.shacl.minCount);
|
|
413
421
|
return data !== undefined && Number(data) !== 0;
|