Moving case check to parsing

This commit is contained in:
Knut Sveidqvist 2024-09-13 14:18:46 +02:00
parent 4c26fe224b
commit 44561f57d3
2 changed files with 5 additions and 3 deletions

View File

@ -133,6 +133,10 @@ export const addVertex = function (
}
// console.log('yamlData', yamlData);
const doc = yaml.load(yamlData, { schema: yaml.JSON_SCHEMA }) as NodeMetaData;
if (doc.shape && doc.shape !== doc.shape.toLowerCase()) {
throw new Error(`No such shape: ${node.shape}. Shape names should be lowercase.`);
}
// console.log('yamlData doc', doc);
if (doc?.shape) {
vertex.type = doc?.shape;

View File

@ -321,9 +321,7 @@ export const insertNode = async (elem, node, renderOptions) => {
if (!shapes[node.shape]) {
throw new Error(`No such shape: ${node.shape}. Please check your syntax.`);
}
if (node.shape !== node.shape.toLowerCase()) {
throw new Error(`No such shape: ${node.shape}. Shape names should be lowercase.`);
}
if (node.link) {
// Add link when appropriate
let target;