FIX: Error not being raised for required typed categories property (#26443)

Why this change?

For a schema like this:

```
schema = {
  name: "section",
  properties: {
    category_property: {
      type: "categories",
      required: true,
    },
  },
}
```

When the value of the property is set to an empty array, we are not
raising an error which we should because the property is marked as
required.
This commit is contained in:
Alan Guo Xiang Tan
2024-04-01 10:11:40 +08:00
committed by GitHub
parent 6cfeb62c29
commit a84757fd91
2 changed files with 18 additions and 2 deletions

View File

@@ -208,7 +208,7 @@ class ThemeSettingsObjectValidator
end
def is_property_present?(property_name)
if @object[property_name].nil?
if @object[property_name].blank?
add_error(property_name, :required)
false
else