Skip to content
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

fix: $ref interaction with $recursiveAnchor in Draft 2019-09 #607

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixed

- Infinite recursion in some cases. [#146](https://github.com/Stranger6667/jsonschema-rs/issues/146)
- `$ref` interaction with `$recursiveAnchor` in Draft 2019-09.

## [0.24.1] - 2024-10-21

Expand Down
1 change: 1 addition & 0 deletions crates/jsonschema-py/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixed

- Infinite recursion in some cases. [#146](https://github.com/Stranger6667/jsonschema-rs/issues/146)
- `$ref` interaction with `$recursiveAnchor` in Draft 2019-09.

## [0.24.1] - 2024-10-22

Expand Down
2 changes: 1 addition & 1 deletion crates/jsonschema-py/tests-py/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def mock_server():
"4": ("bignum.json",),
"6": ("bignum.json",),
"7": ("bignum.json",),
"2019-09": ("bignum.json", "ref.json", "unevaluatedProperties.json"),
"2019-09": ("bignum.json", "unevaluatedProperties.json"),
"2020-12": ("bignum.json", "unevaluatedProperties.json"),
}

Expand Down
6 changes: 1 addition & 5 deletions crates/jsonschema/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,7 @@ impl<'a> Context<'a> {
reference: &str,
is_recursive: bool,
) -> Result<Option<ResolverComponents>, ValidationError<'static>> {
let resolved = if reference == "#" {
// Known & simple recursive reference
// It may also use some additional logic from the `$recursiveAnchor` keyword
self.resolver.lookup_recursive_ref()?
} else if self.is_circular_reference(reference)? {
let resolved = if self.is_circular_reference(reference)? {
// Otherwise we need to manually check whether this location has already been explored
self.resolver.lookup(reference)?
} else {
Expand Down
1 change: 0 additions & 1 deletion crates/jsonschema/tests/suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ mod tests {
xfail = [
"draft4::optional::bignum::integer::a_bignum_is_an_integer",
"draft4::optional::bignum::integer::a_negative_bignum_is_an_integer",
"draft2019-09::r#ref::ref_with_recursive_anchor::extra_items_allowed_for_inner_arrays",
"draft2019-09::unevaluated_properties::unevaluated_properties_with_recursive_ref::with_no_unevaluated_properties_10",
"draft2020-12::unevaluated_properties::unevaluated_properties_with_dynamic_ref::with_no_unevaluated_properties_21",
]
Expand Down