You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve error messages when failing to construct nodes
7
+
8
+
The error messages when constructing tree nodes have been improved.
9
+
Several cases now list not only the schema identifiers, but also schema names which can help when there are identifier collisions and make it easier to find the implementations.
10
+
Additionally some cases which did not include what schema were encountered and which were allowed now include both.
`A node with schema ${quotedSchemaIdentifierWithName(schema)} was provided where a node with that identifier is allowed, but the actual schema required (${quotedSchemaIdentifierWithName(expected)}) is not the same schema object.
93
+
TreeNodeSchema have significant object identity and thus the exact same object must be used as the schema when defining what nodes are allowed and when constructing the node to use.`,
94
+
);
95
+
}
96
+
thrownewUsageError(
97
+
`Expected insertable for one of ${quotedAllowedTypesWithNames(allowedTypes)}. Got node with schema ${quotedSchemaIdentifierWithName(schema)}.
98
+
Nodes are valid insertable objects, but only if their schema are in the allowed list.`,
99
+
);
100
+
}
101
+
102
+
/**
103
+
* Gets a description of a schema for use in error messages.
`The provided data is incompatible with all of the types allowed by the schema. The set of allowed types is: ${quotedAllowedTypesWithNames(allowedTypes)}.`,
118
161
);
119
162
}
120
163
if(!hasSingle(possibleTypes)){
121
164
thrownewUsageError(
122
165
`The provided data is compatible with more than one type allowed by the schema.
validateUsageError(`A node with schema "test.a" (name: "TestSchema2") was provided where a node with that identifier is allowed, but the actual schema required ("test.a" (name: "TestSchema")) is not the same schema object.
1268
+
TreeNodeSchema have significant object identity and thus the exact same object must be used as the schema when defining what nodes are allowed and when constructing the node to use.`),
1269
+
);
1270
+
});
1271
+
1272
+
it("Structurally valid data, but created with a different schema identifier",()=>{
`The provided data is incompatible with all of the types allowed by the schema. The set of allowed types is: ["test.a" (name: "A"), "test.b" (name: "B")].`,
0 commit comments