Fix unexpected key types

This commit is contained in:
barsdeveloper
2023-04-03 19:12:00 +02:00
parent 3eec5b5e1c
commit 62b3968af3
6 changed files with 25 additions and 5 deletions

14
dist/ueblueprint.js vendored
View File

@@ -935,8 +935,9 @@ class IEntity {
if (!suppressWarns) {
if (!(attributeName in attributes)) {
const typeName = value instanceof Array ? `[${value[0].constructor.name}]` : value.constructor.name;
console.warn(
`UEBlueprint: Attribute ${attributeName} in the serialized data is not defined in `
`UEBlueprint: Attribute ${attributeName} (of type ${typeName}) in the serialized data is not defined in `
+ `${this.constructor.name}.attributes`
);
} else if (
@@ -1231,7 +1232,7 @@ class FormatTextEntity extends IEntity {
static lookbehind = "LOCGEN_FORMAT_NAMED"
static attributes = {
value: {
type: [new UnionType(LocalizedTextEntity, InvariantTextEntity, FormatTextEntity)],
type: [new UnionType(LocalizedTextEntity, String, InvariantTextEntity, FormatTextEntity)],
},
}
@@ -2025,6 +2026,14 @@ class PinEntity extends IEntity {
type: [PinReferenceEntity],
showDefault: false,
},
SubPins: {
type: [PinReferenceEntity],
showDefault: false,
},
ParentPin: {
type: PinReferenceEntity,
showDefault: false,
},
DefaultValue: {
/** @param {PinEntity} pinEntity */
type: new ComputedType(pinEntity => pinEntity.getEntityType(true) ?? String),
@@ -3704,6 +3713,7 @@ class Grammar {
this.objectReferenceEntity,
this.unknownKeysEntity,
this.symbol,
this.grammarFor(undefined, [PinReferenceEntity]),
)
)

File diff suppressed because one or more lines are too long

View File

@@ -8,7 +8,7 @@ export default class FormatTextEntity extends IEntity {
static lookbehind = "LOCGEN_FORMAT_NAMED"
static attributes = {
value: {
type: [new UnionType(LocalizedTextEntity, InvariantTextEntity, FormatTextEntity)],
type: [new UnionType(LocalizedTextEntity, String, InvariantTextEntity, FormatTextEntity)],
},
}

View File

@@ -59,8 +59,9 @@ export default class IEntity {
if (!suppressWarns) {
if (!(attributeName in attributes)) {
const typeName = value instanceof Array ? `[${value[0].constructor.name}]` : value.constructor.name
console.warn(
`UEBlueprint: Attribute ${attributeName} in the serialized data is not defined in `
`UEBlueprint: Attribute ${attributeName} (of type ${typeName}) in the serialized data is not defined in `
+ `${this.constructor.name}.attributes`
)
} else if (

View File

@@ -110,6 +110,14 @@ export default class PinEntity extends IEntity {
type: [PinReferenceEntity],
showDefault: false,
},
SubPins: {
type: [PinReferenceEntity],
showDefault: false,
},
ParentPin: {
type: PinReferenceEntity,
showDefault: false,
},
DefaultValue: {
/** @param {PinEntity} pinEntity */
type: new ComputedType(pinEntity => pinEntity.getEntityType(true) ?? String),

View File

@@ -531,6 +531,7 @@ export default class Grammar {
this.objectReferenceEntity,
this.unknownKeysEntity,
this.symbol,
this.grammarFor(undefined, [PinReferenceEntity]),
)
)