Skip to content

Nested non-required object validation does not work #2103

@selaux

Description

@selaux

Describe the bug

When an non-required object inside an object has required fields, the object widgets validation ignores the non-required attribute of the object and highlights the required sub fields of the non-required object as required.

To Reproduce

  1. Use configuration below
  2. Create New Something
  3. Only fill title string

Expected behavior

Entry saved correctly because some-metadata-property is not required.

Current behavior

Entry is not saved and property-specific-string is shown as required.

Screenshots

output

Applicable Versions:

  • Netlify CMS version: 2.4.2

CMS configuration

backend:
  name: test-repo
media_folder: assets
collections: # A list of collections the CMS should be able to edit
  - name: something
    label: 'Something'
    folder: nested
    create: true
    fields:
      - name: title
        widget: string
      - name: metadata
        widget: object
        fields:
          - name: some-metadata-property
            widget: object
            required: false
            fields:
              - name: property-specific-string
                widget: string

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions