webiny-js
webiny-js copied to clipboard
CMS: Validation and pre-defined values check doesn't work for fields inside an object field
Version
5.18.3
Operating System
MacOS
Browser
Chrome
What steps will reproduce the bug?
Create a content model with few field with predefined values
and validators
inside an object
field.
For example, here is a definition of such a model:
{
"name": "Workflow",
"modelId": "workflow",
"fields": [
{
"label": "Title",
"type": "text",
"multipleValues": false,
"predefinedValues": {
"enabled": false,
"values": []
},
"settings": {}
},
{
"label": "App",
"type": "text",
"multipleValues": false,
"predefinedValues": {
"enabled": true,
"values": [
{
"label": "Page Builder",
"value": "pageBuilder"
},
{
"label": "CMS",
"value": "cms"
}
]
},
"settings": {}
},
{
"label": "Scope",
"type": "object",
"multipleValues": false,
"predefinedValues": {
"enabled": false,
"values": []
},
"settings": {
"fields": [
{
"renderer": {
"name": "select-box"
},
"predefinedValues": {
"enabled": true,
"values": [
{
"value": "default",
"label": "Default"
},
{
"value": "pb",
"label": "Page Builder"
},
{
"value": "cms",
"label": "CMS"
}
]
},
"label": "Type",
"id": "33wJFMsY5",
"type": "text",
"validation": [
{
"name": "required",
"message": "Value is required."
}
],
"fieldId": "type"
}
],
"layout": [
[
"33wJFMsY5"
]
]
}
}
]
}
Then try creating few entries via API and you will see:
-
No validation error for empty values:
-
No validation error even when we input random values instead of pre-defined ones:
What is the expected behavior?
Nested fields that are inside an object
field should be validated as any other field.
For example,

What do you see instead?
No response
Additional information
No response
Possible solution
No response
This issue is stale because it was opened 120 days with no activity. Remove the "stale-issue" label or leave a comment to revive the issue. Otherwise, it will be closed in 7 days.
This issue is stale because it was opened 120 days with no activity. Remove the "stale-issue" label or leave a comment to revive the issue. Otherwise, it will be closed in 7 days.