Skip to content

Commit

Permalink
fix: $ref interaction with $recursiveAnchor in Draft 2019-09
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Dygalo <[email protected]>
  • Loading branch information
Stranger6667 committed Oct 23, 2024
1 parent 1a6e41a commit 6046dce
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
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
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

0 comments on commit 6046dce

Please sign in to comment.