fix(dsl): forbid invalid field names

This commit is contained in:
Will Lillis 2026-06-24 01:49:11 -04:00
parent 99bc36b857
commit fbf3049dc0

View file

@ -34,6 +34,9 @@ function blank() {
}
function field(name, rule) {
if (typeof name !== "string" || !/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name)) {
throw new Error(`Invalid field name '${name}': field names must start with a letter or underscore, followed by letters, digits, or underscores`);
}
return {
type: "FIELD",
name,