Validate that required fields can't be hidden in views

This commit is contained in:
Adria Navarro 2024-06-03 12:43:51 +02:00
parent 91c20213dc
commit c1b760ca9e
1 changed files with 9 additions and 1 deletions

View File

@ -74,7 +74,15 @@ async function guardViewSchema(
}
const viewSchemaField = viewSchema[field.name]
if (viewSchemaField?.readonly) {
if (!viewSchemaField?.visible) {
throw new HTTPError(
`You can't hide the required field "${field.name}"`,
400
)
}
if (viewSchemaField.readonly) {
throw new HTTPError(
`You can't make read only the required field "${field.name}"`,
400