brutusin / brutusin/json-forms

Problem with an optional array and minItems

Open
#123 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
618
Forks
171
PR merge metrics
No merged PRs in 30d

Description

I appreciate https://github.com/brutusin/json-forms/blob/master/README.md#status. For the benefit of anyone else who trips over this or who knows how to fix it:

I think this schema defines an object that contains an optional array element which, if present, must have at least one element.

```json
{
"type": "object",
"properties": {
"list": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
}
}
}
}
```

I think that an empty object should validate against this. The validator at https://jsonschemalint.com/ seems to agree. json-forms throws a validation error ("At least `1` items are required") even if the list property is missing. See [this JSfidle example](https://jsfiddle.net/jw35/7ouvbhf8/3/).

FYI.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.