Skip to content

Not required nested object form fields validation #853

Open
@hlobit

Description

@hlobit

Enhancement

As a user, when I don't fill in any of the fields of a nested object I should be able to validate if schema does not specify this object as required.

Expected behaviour

I expected the model to be valid if it successfully validates with json schema.
For instance, tv4 validates the following model with schema :

{
  "name": "John Smith",
  "email": "john@smith.org"
}
{
  "type": "object",
  "title": "Newsletter subscription",
  "properties": {
    "name": {
      "title": "Name",
      "type": "string"
    },
    "email": {
      "title": "Email",
      "type": "string"
    },
    "comment": {
      "title": "Your comment (not required)",
      "type": "object",
          "properties": {
            "rate": {
              "title": "Rate",
              "type": "integer"
            },
            "review": {
              "title": "Review",
              "type": "string"
            }
          },
          "required": [
            "rate",
            "review"
          ]
    }
  },
  "required": [
    "name",
    "email"
  ]
}

Actual behaviour

Angular Schema Form considers the form invalid and highlights red the nested object form fields.

Demo

Click OK and see those errored fields

Related issues

I didn't find any issue related.

@json-schema-form/angular-schema-form-lead

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions