RicoSuter/NJsonSchema

NJsonSchema reports validation error on a missing constrained but not required array

Open

#742 opened on Jul 11, 2018

View on GitHub
 (2 comments) (0 reactions) (0 assignees)C# (550 forks)github user discovery
help wantedtype: bug

Repository metrics

Stars
 (1,578 stars)
PR merge metrics
 (Avg merge 39d 6h) (1 merged PR in 30d)

Description

Hi,

I am using NJosnSchema to validate json events for an API. One of schemas provided by API is this. Note it has an array field 'prohibited' which is NOT marked as required, but has a constraint imposed on it - if it's present, it must have at least one item.

Now, I try to validate this json using that schema - and it presents me with a validation error: ArrayExpected: #/message.prohibited

I'd expect that should not be the case?

Contributor guide