-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
type: bugcode to address defects in shipped codecode to address defects in shipped code
Description
Describe the bug
object or list widgets, that are nested inside parent object widget don't pass validation anymore.
Object has all fields optional, but is detected as required.
Empty list is detected as invalid. Adding and removing one item solves issue and empty list is then detected as valid.
To Reproduce
config.yml settings for fields:
{name: usefulInfo, label: useful info, widget: object, i18n: true, collapsed: true, summary: '{{fields.title}}', fields: [
{name: title, widget: string, i18n: true, required: false},
{name: text, widget: markdown, minimal: true, required: false, editor_components: []},
{name: button, widget: object, i18n: true, fields: [
{name: text, widget: string, i18n: true, required: false},
{name: href, widget: string, i18n: true, required: false},
]},
{name: linksTitle, label: links title, widget: string, i18n: true, required: false},
{name: links, widget: list, label_singular: link, i18n: true, fields: [{name: text, widget: string, i18n: true}, {name: href, widget: string, i18n: true}]},
]}
try saving entry with empty optional fields
Expected behavior
- object with optional fields should be valid if empty.
- empty list (of object that has required fields) should be valid
Applicable Versions:
- Decap CMS version: 3.6.0
- Browser version: Chrome
CMS configuration
backend:
name: test-repo
publish_mode: editorial_workflow
media_folder: assets/uploads
local_backend: true
collections:
- name: pages # a nested collection
label: Pages
label_singular: 'Page'
folder: _pages
create: true
nested: { depth: 100 }
fields: [
{name: usefulInfo, label: useful info, widget: object, i18n: true, collapsed: true, summary: '{{fields.title}}', fields: [
{name: title, widget: string, i18n: true, required: false},
{name: text, widget: markdown, minimal: true, required: false, editor_components: []},
{name: button, widget: object, i18n: true, fields: [
{name: text, widget: string, i18n: true, required: false},
{name: href, widget: string, i18n: true, required: false},
]},
{name: linksTitle, label: links title, widget: string, i18n: true, required: false},
{name: links, widget: list, label_singular: link, i18n: true, fields: [{name: text, widget: string, i18n: true}, {name: href, widget: string, i18n: true}]},
]}]
Additional context
could be caused by #7374
mirhamasala
Metadata
Metadata
Assignees
Labels
type: bugcode to address defects in shipped codecode to address defects in shipped code