-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
compare anyOf based on handmade diff score #32
Merged
+284
−33
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6c59eec
fill subschemas on length mismatch
6293 47ed7cd
compare anyOf based on handmade diff score
6293 e3d2f8e
add test on multiple number schemas within anyOf
6293 b0ff30c
use `diff` to compute the score
6293 deb50d9
`hungarian` is dead; use `pathfinding` instead
6293 0ebbfe3
make use of `Vec::resize`
6293 7b4cc56
make `Diffwalker` take a callback
6293 35fa7c1
make generic
untitaker 6b315ac
fmt
untitaker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"lhs": { | ||
"anyOf": [ | ||
{"type": "number", "maximum": 10}, | ||
{"type": "number", "minimum": 1}, | ||
{"type": "number", "minimum": 100, "maximum": 200} | ||
] | ||
}, | ||
"rhs": { | ||
"anyOf": [ | ||
{"type": "number", "minimum": 7, "maximum": 14}, | ||
{"type": "number", "maximum": 3}, | ||
{"type": "number", "minimum": 2} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"lhs": { | ||
"anyOf": [ | ||
{"properties": {"foo": {}}}, | ||
{"properties": {"type": {"const": "bar"}}} | ||
] | ||
}, | ||
"rhs": { | ||
"anyOf": [ | ||
{ | ||
"title": "replay_recording", | ||
"type": "object", | ||
"properties": {"foo": {}} | ||
}, | ||
{"properties": {"type": {"const": "bar"}}} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"lhs": { | ||
"anyOf": [ | ||
{"properties": {"foo": {}}}, | ||
{"properties": {"type": {"const": "bar"}}} | ||
] | ||
}, | ||
"rhs": { | ||
"anyOf": [ | ||
{ "type": "boolean" }, | ||
{ | ||
"title": "replay_recording", | ||
"type": "object", | ||
"properties": {"foo": {}} | ||
}, | ||
{"properties": {"type": {"const": "bar"}}} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"lhs": { | ||
"anyOf": [ | ||
{ "type": "boolean" }, | ||
{"properties": {"foo": {}}}, | ||
{"properties": {"type": {"const": "bar"}}} | ||
] | ||
}, | ||
"rhs": { | ||
"anyOf": [ | ||
{ | ||
"title": "replay_recording", | ||
"type": "object", | ||
"properties": {"foo": {}} | ||
}, | ||
{"properties": {"type": {"const": "bar"}}} | ||
] | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
tests/snapshots/test__from_fixtures@any_of__number_1.json.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
source: tests/test.rs | ||
expression: diff | ||
info: | ||
lhs: | ||
anyOf: | ||
- maximum: 10 | ||
type: number | ||
- minimum: 1 | ||
type: number | ||
- maximum: 200 | ||
minimum: 100 | ||
type: number | ||
rhs: | ||
anyOf: | ||
- maximum: 14 | ||
minimum: 7 | ||
type: number | ||
- maximum: 3 | ||
type: number | ||
- minimum: 2 | ||
type: number | ||
input_file: tests/fixtures/any_of/number_1.json | ||
--- | ||
[ | ||
Change { | ||
path: ".<anyOf:1>", | ||
change: RangeChange { | ||
changed: Maximum, | ||
old_value: 10.0, | ||
new_value: 3.0, | ||
}, | ||
}, | ||
Change { | ||
path: ".<anyOf:2>", | ||
change: RangeChange { | ||
changed: Minimum, | ||
old_value: 1.0, | ||
new_value: 2.0, | ||
}, | ||
}, | ||
Change { | ||
path: ".<anyOf:0>", | ||
change: RangeChange { | ||
changed: Minimum, | ||
old_value: 100.0, | ||
new_value: 7.0, | ||
}, | ||
}, | ||
Change { | ||
path: ".<anyOf:0>", | ||
change: RangeChange { | ||
changed: Maximum, | ||
old_value: 200.0, | ||
new_value: 14.0, | ||
}, | ||
}, | ||
] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
it seems you're trying to get the vectors to be the same length by padding the shorter one with
false
.if that is the case I think you can do this: