Skip to content

Commit 6de32e5

Browse files
committed
fix: array spread issue
1 parent ccb4fad commit 6de32e5

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/schema-parser/base-schema-parsers/jsonld-context.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class JsonLdContextSchemaParser extends MonoSchemaParser {
99
// Handle string context (URI reference)
1010
if (typeof contextSchema === "string") {
1111
return {
12-
...(typeof this.schema === "object" ? this.schema : {}),
12+
...(typeof this.schema === "object" && !Array.isArray(this.schema) ? this.schema : {}),
1313
$schemaPath: this.schemaPath.slice(),
1414
$parsedSchema: true,
1515
schemaType: SCHEMA_TYPES.JSONLD_CONTEXT,
@@ -24,7 +24,7 @@ export class JsonLdContextSchemaParser extends MonoSchemaParser {
2424
// Handle array context
2525
if (Array.isArray(contextSchema)) {
2626
return {
27-
...(typeof this.schema === "object" ? this.schema : {}),
27+
...(typeof this.schema === "object" && !Array.isArray(this.schema) ? this.schema : {}),
2828
$schemaPath: this.schemaPath.slice(),
2929
$parsedSchema: true,
3030
schemaType: SCHEMA_TYPES.JSONLD_CONTEXT,
@@ -49,7 +49,7 @@ export class JsonLdContextSchemaParser extends MonoSchemaParser {
4949
const contextProperties = this.getContextSchemaContent(contextSchema);
5050

5151
return {
52-
...(typeof this.schema === "object" ? this.schema : {}),
52+
...(typeof this.schema === "object" && !Array.isArray(this.schema) ? this.schema : {}),
5353
$schemaPath: this.schemaPath.slice(),
5454
$parsedSchema: true,
5555
schemaType: SCHEMA_TYPES.JSONLD_CONTEXT,

src/schema-parser/base-schema-parsers/jsonld-entity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class JsonLdEntitySchemaParser extends MonoSchemaParser {
2020
entityName = entityName || "JsonLdEntity";
2121

2222
return {
23-
...(typeof this.schema === "object" ? this.schema : {}),
23+
...(typeof this.schema === "object" && !Array.isArray(this.schema) ? this.schema : {}),
2424
$schemaPath: this.schemaPath.slice(),
2525
$parsedSchema: true,
2626
schemaType: SCHEMA_TYPES.JSONLD_ENTITY,

src/schema-parser/base-schema-parsers/jsonld-type.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class JsonLdTypeSchemaParser extends MonoSchemaParser {
88
// Handle single type
99
if (typeof typeSchema === "string") {
1010
return {
11-
...(typeof this.schema === "object" ? this.schema : {}),
11+
...(typeof this.schema === "object" && !Array.isArray(this.schema) ? this.schema : {}),
1212
$schemaPath: this.schemaPath.slice(),
1313
$parsedSchema: true,
1414
schemaType: SCHEMA_TYPES.JSONLD_TYPE,
@@ -27,7 +27,7 @@ export class JsonLdTypeSchemaParser extends MonoSchemaParser {
2727
);
2828

2929
return {
30-
...(typeof this.schema === "object" ? this.schema : {}),
30+
...(typeof this.schema === "object" && !Array.isArray(this.schema) ? this.schema : {}),
3131
$schemaPath: this.schemaPath.slice(),
3232
$parsedSchema: true,
3333
schemaType: SCHEMA_TYPES.JSONLD_TYPE,
@@ -50,7 +50,7 @@ export class JsonLdTypeSchemaParser extends MonoSchemaParser {
5050
);
5151

5252
return {
53-
...(typeof this.schema === "object" ? this.schema : {}),
53+
...(typeof this.schema === "object" && !Array.isArray(this.schema) ? this.schema : {}),
5454
$schemaPath: this.schemaPath.slice(),
5555
$parsedSchema: true,
5656
schemaType: SCHEMA_TYPES.JSONLD_TYPE,

0 commit comments

Comments
 (0)