fix: harden phase summary open questions
This commit is contained in:
@@ -115,6 +115,17 @@ function validatePhaseSummaryV2(data) {
|
||||
if (data.tables !== undefined && !isArray(data.tables)) {
|
||||
errors.push("tables deve essere un array se presente.");
|
||||
}
|
||||
if (data.open_questions !== undefined) {
|
||||
if (!isArray(data.open_questions)) {
|
||||
errors.push("open_questions deve essere un array di stringhe se presente.");
|
||||
} else {
|
||||
data.open_questions.forEach((question, i) => {
|
||||
if (typeof question !== "string") {
|
||||
errors.push(`open_questions[${i}] deve essere una stringa.`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return { ok: errors.length === 0, errors };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user