@api-components/api-type-document 4.2.33 → 4.2.34

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.33",
4
+ "version": "4.2.34",
5
5
  "license": "Apache-2.0",
6
6
  "main": "index.js",
7
7
  "module": "index.js",
@@ -753,6 +753,24 @@ export class PropertyShapeDocument extends PropertyDocumentMixin(LitElement) {
753
753
  ></api-type-document>`;
754
754
  }
755
755
 
756
+ _extractElementsDataType(namespaceKey){
757
+ const key = this._getAmfKey(namespaceKey)
758
+ const dataTypes = this.range[key]
759
+ if(!dataTypes){
760
+ return 'Any'
761
+ }
762
+ let dataType = ''
763
+ for(const dataTypeValue of dataTypes){
764
+ const computeDataType = this._computeRangeDataType(dataTypeValue)
765
+
766
+ if(dataType!=='' && dataType!==computeDataType){
767
+ return 'Any'
768
+ }
769
+ dataType = String(computeDataType)
770
+ }
771
+ return dataType
772
+ }
773
+
756
774
  _getTypeLabelData(){
757
775
  const { propertyDataType, avroValue } = this;
758
776
  if(avroValue==='map'){
@@ -761,6 +779,15 @@ export class PropertyShapeDocument extends PropertyDocumentMixin(LitElement) {
761
779
  if(propertyDataType==='Unknown type' && avroValue){
762
780
  return {dataType:avroValue,customValue:true}
763
781
  }
782
+
783
+ if(this.isAllOf){
784
+ const dataType = this._extractElementsDataType(this.ns.w3.shacl.and)
785
+ return {dataType,customValue:false}
786
+ }
787
+ if(this.isAnyOf){
788
+ const dataType = this._extractElementsDataType(this.ns.w3.shacl.or)
789
+ return {dataType,customValue:false}
790
+ }
764
791
  return {dataType:propertyDataType,customValue:false}
765
792
  }
766
793