Fix(studio): add check for incorrect suggestions, fix incorrect suggestion which breaks setting a 'marker'

This commit is contained in:
Pieter Vander Vennet 2025-01-19 22:45:03 +01:00
parent 3bfdc1838c
commit 143dd70973
2 changed files with 19 additions and 4 deletions

View file

@ -208,13 +208,27 @@ function extractHintsFrom(
validators: Validators,
Constants: Constants,
})
if (hints["suggestions"]?.indexOf(null) >= 0) {
const evaluatedSuggestions = hints["suggestions"]
if (evaluatedSuggestions?.indexOf(null) >= 0) {
throw (
"A suggestion generated 'null' for " +
path.join(".") +
". Check the docstring, specifically 'suggestions'. Pay attention to double commas"
)
}
console.log(evaluatedSuggestions)
for (const hintElement of evaluatedSuggestions ?? []) {
if (typeof hintElement === "string") {
throw (
"A suggestion generated a string for " +
path.join(".") +
". Remember that you should use {'if': 'value=[actual_value]', 'then': '[some explanation]'}"
)
}
}
}
return hints
}