Skip to content

Commit b92bce5

Browse files
authored
fix: Add another failing test and fix licensing metadata (#8)
I tried some things to fix this bug with definitions, including vendoring jsonref crate (which caused me to look at licensing of this crate), but gave up for now.
1 parent 5f4f52c commit b92bce5

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ edition = "2021"
55
license = "Apache-2.0"
66
description = "Diff changes between JSON schema files."
77
repository = "https://github.com/getsentry/json-schema-diff"
8+
authors = ["Sentry <oss@sentry.io>"]
89

910
[lib]
1011
name = "json_schema_diff"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ assert_eq!(
4747

4848
## License
4949

50-
Licensed under Apache 2.0, see `./LICENSE`
50+
Licensed under Apache 2.0

src/lib.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,4 +891,41 @@ mod tests {
891891
]
892892
"###);
893893
}
894+
895+
#[test]
896+
#[ignore]
897+
fn add_property_in_array() {
898+
let lhs = json! {{
899+
"type": "array",
900+
"items": [
901+
{"const": "start_unmerge"},
902+
{"$ref": "#/definitions/Hello"}
903+
],
904+
"definitions": {
905+
"Hello": {
906+
"type": "object",
907+
}
908+
}
909+
}};
910+
911+
let rhs = json! {{
912+
"type": "array",
913+
"items": [
914+
{"const": "start_unmerge"},
915+
{"$ref": "#/definitions/Hello"}
916+
],
917+
"definitions": {
918+
"Hello": {
919+
"type": "object",
920+
"properties": {"transaction_id": {"type": "string"}}
921+
}
922+
}
923+
}};
924+
925+
let diff = diff(lhs, rhs).unwrap();
926+
927+
// TODO: buggy wrt array references. suggest to get rid of jsonref crate dependency, and
928+
// rewrite crate on top of schemars::schema::Schema
929+
assert_debug_snapshot!(diff, @"");
930+
}
894931
}

0 commit comments

Comments
 (0)