-
-
Notifications
You must be signed in to change notification settings - Fork 32
Bug in IfThenElse #163
Comments
I think removing the PropertyNames != null seems to do the trick |
By the way i noticed the sub validation error messages from if then else gets swallowed. Would it make sense to return the underlying sub validation error messages instead? On a separate note, it would be good if there is a way to include the full property path since in theory you can have 2 of the same properties but in different paths eg. A.B, B.B C.B will all print as B is required but i am not sure which B is the correct B |
Regarding the error messaging, the exception has a I'll check into the validation issue. Could you post your schema and test JSON? I pass the official schema test suite. They may be interested in adding your case. |
I took it from here: But if you notice i tweaked the schema in my test cases because i think there are still variations in how it is being implemented. Look at this particular case where the "minimum" of the "power" property is 9000. In their example, an empty object is considered valid. But I personally believe it should not be valid because it'll fall into the "then" validation since the "if" validation is valid. And even if it isn't, it should at least fall into the "else" validation but in the example, they are treating it as valid. |
What i noticed is that the validation error comes out as: |
@handrews (the primary author of JSON Schema, currently) and I both agree with your assessment of this example. I can also add your test cases. On the topic of messaging, I'll try to incorporate the error messages from the failed subschema. |
I have identified a bug in that I also still need to pull in your tests. I'm having some issues with running my tests right now. I think it's just a local issue; the server build seems to run fine, but I don't want to rely on it. |
@jinhong- you may be interested in #112 and json-schema-org/json-schema-spec#530. I think this will open up the mechanism to customizing the error messages. I'm closing this issue in favor of that one since the |
@jinhong- you may be interested in the available prerelease of v10. The schema implementation has been completely reworked, including the output format. I think you'll find that the new format is more explicit as to what the actual failure is. |
Hi, I found an issue when using IfThenElse. Looks like it's unable to validate dependent properties. I also noticed the Validator Selector does not select the validator governing the required validation because the schema does not have PropertyNames.
Check out my unit tests below:
master...jinhong-:master
The text was updated successfully, but these errors were encountered: