@twin.org/data-json-ld 0.0.1-next.33 → 0.0.1-next.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.
@@ -1962,11 +1962,17 @@ class JsonLdHelper {
1962
1962
  }
1963
1963
  else if (core.Is.object(document)) {
1964
1964
  // Expand the document to ensure we have the full context for types
1965
- // As the data types in the factories are not always fully qualified
1966
- const expandedDoc = await JsonLdProcessor.expand(document);
1967
- const expandedDataType = core.ArrayHelper.fromObjectOrArray(expandedDoc[0]["@type"]);
1968
- if (core.Is.arrayValue(expandedDataType)) {
1969
- await dataCore.DataTypeHelper.validate("document", expandedDataType[0], document, validationFailures, options);
1965
+ // As the data types in the factories are always fully qualified
1966
+ const expandedDocs = await JsonLdProcessor.expand(document);
1967
+ if (core.Is.arrayValue(expandedDocs)) {
1968
+ for (const expandedDoc of expandedDocs) {
1969
+ const expandedDataTypes = core.ArrayHelper.fromObjectOrArray(expandedDoc["@type"]);
1970
+ if (core.Is.arrayValue(expandedDataTypes)) {
1971
+ for (const expandedDataType of expandedDataTypes) {
1972
+ await dataCore.DataTypeHelper.validate("document", expandedDataType, document, validationFailures, options);
1973
+ }
1974
+ }
1975
+ }
1970
1976
  }
1971
1977
  }
1972
1978
  return validationFailures.length === 0;
@@ -1960,11 +1960,17 @@ class JsonLdHelper {
1960
1960
  }
1961
1961
  else if (Is.object(document)) {
1962
1962
  // Expand the document to ensure we have the full context for types
1963
- // As the data types in the factories are not always fully qualified
1964
- const expandedDoc = await JsonLdProcessor.expand(document);
1965
- const expandedDataType = ArrayHelper.fromObjectOrArray(expandedDoc[0]["@type"]);
1966
- if (Is.arrayValue(expandedDataType)) {
1967
- await DataTypeHelper.validate("document", expandedDataType[0], document, validationFailures, options);
1963
+ // As the data types in the factories are always fully qualified
1964
+ const expandedDocs = await JsonLdProcessor.expand(document);
1965
+ if (Is.arrayValue(expandedDocs)) {
1966
+ for (const expandedDoc of expandedDocs) {
1967
+ const expandedDataTypes = ArrayHelper.fromObjectOrArray(expandedDoc["@type"]);
1968
+ if (Is.arrayValue(expandedDataTypes)) {
1969
+ for (const expandedDataType of expandedDataTypes) {
1970
+ await DataTypeHelper.validate("document", expandedDataType, document, validationFailures, options);
1971
+ }
1972
+ }
1973
+ }
1968
1974
  }
1969
1975
  }
1970
1976
  return validationFailures.length === 0;
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @twin.org/data-json-ld - Changelog
2
2
 
3
+ ## [0.0.1-next.34](https://github.com/twinfoundation/data/compare/data-json-ld-v0.0.1-next.33...data-json-ld-v0.0.1-next.34) (2025-06-02)
4
+
5
+
6
+ ### Features
7
+
8
+ * support multiple type JSON-LD ([8f0d530](https://github.com/twinfoundation/data/commit/8f0d530f66302ab19413ecf968f170f97456e31e))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/data-core bumped from 0.0.1-next.33 to 0.0.1-next.34
16
+
3
17
  ## [0.0.1-next.33](https://github.com/twinfoundation/data/compare/data-json-ld-v0.0.1-next.32...data-json-ld-v0.0.1-next.33) (2025-06-02)
4
18
 
5
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/data-json-ld",
3
- "version": "0.0.1-next.33",
3
+ "version": "0.0.1-next.34",
4
4
  "description": "Models which define the structure of JSON LD",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@twin.org/core": "next",
18
- "@twin.org/data-core": "0.0.1-next.33",
18
+ "@twin.org/data-core": "0.0.1-next.34",
19
19
  "@twin.org/entity": "next",
20
20
  "@twin.org/nameof": "next",
21
21
  "@twin.org/web": "next",