@api-components/api-type-document 4.2.26 → 4.2.28
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
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.28",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"module": "index.js",
|
package/src/ApiTypeDocument.d.ts
CHANGED
package/src/ApiTypeDocument.js
CHANGED
|
@@ -167,6 +167,8 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
|
|
|
167
167
|
* applicable.
|
|
168
168
|
*/
|
|
169
169
|
noMediaSelector: { type: Boolean },
|
|
170
|
+
|
|
171
|
+
noArrayInfo: { type: Boolean },
|
|
170
172
|
};
|
|
171
173
|
}
|
|
172
174
|
|
|
@@ -685,13 +687,16 @@ export class ApiTypeDocument extends PropertyDocumentMixin(LitElement) {
|
|
|
685
687
|
}
|
|
686
688
|
|
|
687
689
|
_arrayPropertiesTemplate() {
|
|
688
|
-
|
|
689
|
-
|
|
690
|
+
if (!this.noArrayInfo) {
|
|
691
|
+
const minCount = this._getValue(this._resolvedType, this.ns.w3.shacl.minCount)
|
|
692
|
+
const maxCount = this._getValue(this._resolvedType, this.ns.w3.shacl.maxCount)
|
|
690
693
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
694
|
+
return html`
|
|
695
|
+
${minCount !== undefined ? this._arrayPropertyTemplate('Minimum array length:', minCount, 'Minimum amount of items in array') : ''}
|
|
696
|
+
${maxCount !== undefined ? this._arrayPropertyTemplate('Maximum array length:', maxCount, 'Maximum amount of items in array') : ''}
|
|
697
|
+
`
|
|
698
|
+
}
|
|
699
|
+
return html``
|
|
695
700
|
}
|
|
696
701
|
|
|
697
702
|
/**
|
|
@@ -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;
|
|
@@ -574,6 +582,7 @@ export class PropertyShapeDocument extends PropertyDocumentMixin(LitElement) {
|
|
|
574
582
|
?compatibility="${this.compatibility}"
|
|
575
583
|
?noExamplesActions="${this.noExamplesActions}"
|
|
576
584
|
noMainExample
|
|
585
|
+
noArrayInfo
|
|
577
586
|
.mediaType="${this.mediaType}"
|
|
578
587
|
?graph="${this.graph}"
|
|
579
588
|
></api-type-document>`;
|