netmail-open / wjelement

advanced, flexible JSON manipulation in C
GNU Lesser General Public License v3.0
108 stars 56 forks source link

Spurious validation errors when using combining keywords #70

Closed agners closed 7 years ago

agners commented 7 years ago

When validating against a JSON schema with combining keywords, spurious errors might appear. In the pass case this is not a big problem since errors can be simply ignored. However, in case the validation fails, the library user can no longer tell which validation issues are actually relevant.

The attached example leads to this spurious error when using the validate example application:

...
schema: good
(root): required member 'name' not found.
validation: PASS

example.zip

penduin commented 7 years ago

interesting. i'm not sure if i'll have a chance this weekend but i'll dig into this as soon as i can.

later, -Owen

On Aug 3, 2017 19:52, "Stefan Agner" notifications@github.com wrote:

When validating against a JSON schema with combining keywords, spurious errors might appear. In the pass case this is not a big problem since errors can be simply ignored. However, in case the validation fails, the library user can no longer tell which validation issues are actually relevant.

The attached example leads to this spurious error when using the validate example application:

... schema: good (root): required member 'name' not found. validation: PASS

example.zip https://github.com/netmail-open/wjelement/files/1198951/example.zip

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/netmail-open/wjelement/issues/70, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJq0zkt6ZrWywCFcZAmIimXArutmcqdks5sUmtEgaJpZM4OtJ1c .

penduin commented 7 years ago

sorry this is taking so long to get around to! i have no progress to report but i have not forgotten. :^)

agners commented 7 years ago

Thanks for staying on-top of this issue. It is not urgent from my point of view.

The issue came up while evaluating JSON schema validators. We ended up using Valijson for other reasons (header only, worked well with the JSON parser we use). Btw, I did came across a similar issue in Valijson (https://github.com/tristanpenman/valijson/issues/50).

penduin commented 7 years ago

Finally got around to it! Didn't take long to sort out that our "oneOf" validation should not use the general-purpose error-reporting callback; we want all but one case to fail. Thank you @falstaff84 for finding this, and for your patience!