java-json-tools/json-schema-core

Work around ObjectReader's bizarre behaviour

Closed this issue · 1 comments

fge commented

There are two of them. The first not being that much of a concern, but the second is a huge concern.

The first: duplicate members do not raise an error. That is, with input:

{ "a": "b", "a": "c" }

then whatever is associated with member a is undefined. That is understandable since this is not even valid JSON as per RFC 4627, which says that objects SHOULD NOT have duplicate member names. So, we can live with that. Still, it'd be nice it this could raise an error.

The second is rather embarrassing. This input WILL NOT raise an error:

{} garbage here

It will stop after } and declare the job done!

But the input IS NOT EVEN VALID JSON.

This is quite embarrassing for an API validating JSON. And to work around it, I have to use a JsonParser and build the tree myself :(

fge commented

Fixed in 1.1.11