Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with an optional array and minItems #123

Open
jw35 opened this issue Apr 5, 2018 · 0 comments
Open

Problem with an optional array and minItems #123

jw35 opened this issue Apr 5, 2018 · 0 comments

Comments

@jw35
Copy link

jw35 commented Apr 5, 2018

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.

{
  "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.

FYI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant