RicoSuter/NJsonSchema

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

Aperta

#742 aperta il 11 lug 2018

 (2 commenti) (0 reazioni) (0 assegnatari)C# (549 fork)github user discovery
help wantedtype: bug

Metriche repository

Star
 (1581 stelle)
Metriche merge PR
 (Merge medio 39g 6h) (1 PR mergiata in 30 g)

Descrizione

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?

Guida contributor