Skip to content

Validation fails when optional object field has required fields #7748

@tpluscode

Description

@tpluscode

I think this similar but not the same as #7383

Describe the bug

When an object field is optional but has a required field, it fails validation when all its fields are empty.

To Reproduce

Add this field to a collection:

      - name: submittedBy
        label: Submitted by
        widget: object
        summary: '{{fields.name}}'
        required: false
        i18n: false
        fields:
          - name: name
            label: Name
            widget: string
          - name: url
            label: Url (separate multiple entries with a comma)
            widget: list
            required: false

Try to save an item without setting submittedBy.name

Expected behavior

Validation should pass, and item be saved without subittedBy

Screenshots

Instead:

Image

Applicable Versions:

  • Decap CMS version: 3.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugcode to address defects in shipped code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions