-
-
Notifications
You must be signed in to change notification settings - Fork 11
oneOf tests for success-caused failures #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,95 @@ | |
| }, | ||
| "instance": "foo", | ||
| "errors": [] | ||
| }, | ||
| { | ||
| "description": "not fails with success explanation", | ||
| "schema": { | ||
| "not": { "pattern": "^a" } | ||
| }, | ||
| "instance": "apple", | ||
| "errors": [ | ||
| { | ||
| "messageId": "not-message", | ||
| "instanceLocation": "#", | ||
| "schemaLocations": ["#/not"], | ||
| "alternatives": [ | ||
| [ | ||
| { | ||
| "messageId": "pattern-success", | ||
| "messageParams": { | ||
| "pattern": "^a" | ||
| }, | ||
| "instanceLocation": "#", | ||
| "schemaLocations": ["#/not/pattern"] | ||
| } | ||
| ] | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "description": "not fails due to subschema match with success explanation", | ||
| "schema": { | ||
| "not": { | ||
| "required": ["a"] | ||
| } | ||
| }, | ||
| "instance": { "a": 1 }, | ||
| "errors": [ | ||
| { | ||
| "messageId": "not-message", | ||
| "instanceLocation": "#", | ||
| "schemaLocations": ["#/not"], | ||
| "alternatives": [ | ||
| [ | ||
| { | ||
| "messageId": "required-success", | ||
| "messageParams": { "property": "a" }, | ||
| "instanceLocation": "#", | ||
| "schemaLocations": ["#/not/required"] | ||
| } | ||
| ] | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "description": "not with nested schema producing a match", | ||
| "schema": { | ||
| "not": { | ||
| "oneOf":[ | ||
| { "required": ["a"] }, | ||
| { "required": ["b"] } | ||
| ] | ||
| } | ||
| }, | ||
| "instance": { "a": 1, "b": 2 }, | ||
| "errors": [ | ||
| { | ||
| "messageId": "not-message", | ||
| "instanceLocation": "#", | ||
| "schemaLocations": ["#/not"], | ||
| "alternatives": [ | ||
| [ | ||
| { | ||
| "messageId": "required-success", | ||
| "messageParams": { "property": "a" }, | ||
| "instanceLocation": "#", | ||
| "schemaLocations": ["#/not/oneOf/0/required"] | ||
| } | ||
| ], | ||
| [ | ||
| { | ||
| "messageId": "required-success", | ||
| "messageParams": { "property": "b" }, | ||
| "instanceLocation": "#", | ||
| "schemaLocations": ["#/not/oneOf/1/required"] | ||
| } | ||
| ] | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
|
Comment on lines
+80
to
116
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one's not quite correct. The My first thought was that I expected there to be a
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I got it. I should change the instance to
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think I agree. If
We can't say "matches a schema". That's the kind of thing we're trying to avoid with this project. The reader shouldn't have to know anything about schemas to understand what's wrong with the data. We can probably come up with a message for |
||
| ] | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no difference between this test and the one before it. The
notschemas are different, but there's nothing fundamentally different about what it's testing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for late reply I was travelling, yes this one and the previous one is fundamentally same except the not schema used here is
required.