Skip to content

Required validation issue #2521

@gerakon

Description

@gerakon

Describe the bug

Used libraries:
@jsonforms/core: ^3.7.0.
@jsonforms/react: ^3.7.0.
@jsonforms/material-renderers: ^3.7.0.

If a nested object has the same property name as its parent object, the "is a required property" message is not displayed.

Expected behavior

An error message should be displayed ("is a required property").

Steps to reproduce the issue

Use these:

  1. Schema:
{
    type: 'object',
    properties: {
        name: {
            type: 'object',
            properties: { name: { type: 'string' } },
            required: ['name']
        }
    }
}
  1. UI Schema { type: 'Control', scope: '#/properties/name/properties/name', label: 'Name' }
  2. Data { name: {} }
  3. JsonForms
<JsonForms
    data={data}
    schema={dataSchema}
    uischema={uiSchema}
    renderers={materialRenderers}
    cells={materialCells}
/>

Out of interest, this issue goes away if you rename the inner name property to something other than 'name'.

Screenshots

No response

Which Version of JSON Forms are you using?

v3.7.0

Package

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions