Composition with allOf, anyOf or oneOf gives unexpected validation errors
Issue #271
new
This is a known problem in JSON schema and also explained in the FAQ. However, just ignoring the additional properties defies the purpose of validation when composition has been extensively used.
Opening an issue to discuss alternative ways to handle this problem.
Thanks for raising. As you point out, it is a known (and fairly fundamental) problem with JSON schema. Definitely happy to discuss options for how to deal with it.
To be clear, all other schema validation will take place - it is only the validation that no additional fields have been supplied that will be disabled. While I understand that this is useful I would argue that it doesn’t really negate the benefit of the validation. For example, you will still fail validation if you are missing required fields or supplying fields in the wrong format etc. which are arguably more valuable to know about early.
As I say though, happy to discuss how to handle this in a nicer way.
One option I have thought about in the past is to detect the use of composition and disable the additional properties validation automatically. My concern with that was it would obscure that fact from consumers, but perhaps it’s worth it to avoid the confusion that inevitably arises when the unexpected errors are encountered.