You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When validating an invalid JSON document (truncated), I would expect Validate() to return an appropriate ValidationError. Instead it throws a JsonReaderException (thrown by JsonTextReader):
Newtonsoft.Json.JsonReaderException: Unterminated string. Expected delimiter: ". Path 'blah', line 3, position 64.
at Newtonsoft.Json.JsonTextReader.ReadStringIntoBuffer(Char quote)
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.Linq.JContainer.ReadContentFrom(JsonReader r, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JContainer.ReadTokenFrom(JsonReader reader, JsonLoadSettings options)
at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JToken.ReadFrom(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JToken.Parse(String json, JsonLoadSettings settings)
at NJsonSchema.JsonSchema4.Validate(String jsonData)
Suggest catching this exception, and adding a new ValidationErrorKind.
The text was updated successfully, but these errors were encountered:
Looking at this in more detail, this doesn't really fit in with what the ValidationError encapsulates (i.e. an error with a specific property). JsonReaderException doesn't map cleanly to this, so I think it's nicer to leave it as it is.
I'm happy for this to be resolved as "Won't fix", and perhaps just update documentation?
When validating an invalid JSON document (truncated), I would expect Validate() to return an appropriate
ValidationError
. Instead it throws aJsonReaderException
(thrown byJsonTextReader
):Suggest catching this exception, and adding a new
ValidationErrorKind
.The text was updated successfully, but these errors were encountered: