jsonschema_rs 0.55.1 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -1
- data/Cargo.toml +2 -2
- data/ext/jsonschema/Cargo.lock +13 -13
- data/ext/jsonschema/Cargo.toml +3 -3
- data/lib/jsonschema/version.rb +1 -1
- data/sig/jsonschema.rbs +15 -0
- data/src/canonical.rs +30 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e5e2046dda10b3b0e6109b3f7a55667f9d6cb86a38b0f7ddbb80e7d9bc67b25d
|
|
4
|
+
data.tar.gz: f3eed3727e42c284573978507158cdd966691a0d55add5a12102bbf206440db3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0632192b1860a29b067638bd11e1c70d71e58d39ff5a100514ae72b183c9f46784a466ef59ee80ab5f151e700df4eb8b3a10e3b2a2b7b062b301094b653c07f9'
|
|
7
|
+
data.tar.gz: b9155ae7dae3ce0b2559733bc53c938f0129a696dc43d7a7913cfc850967583d9144a0c6f63940b44ec2c45b2d3b7b14ec110263f0daed0027a581174630474c
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.56.0] - 2026-09-10
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `JSONSchema::Canonical::RawReason`, what stopped a run from modeling a document, and `RawView#reason` and `RawView#pointer`, carrying it beside the subschema the run stopped on.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Canonicalization of a `oneOf` whose branches share a region too wide to expand, which spent the document's whole intersection allowance on that choice and kept the document `Raw`.
|
|
14
|
+
|
|
15
|
+
### Performance
|
|
16
|
+
|
|
17
|
+
- Preparing or building a schema that names no base URI parses the default one once for the process instead of once per schema.
|
|
18
|
+
- Canonicalization reads the facets no checker covers once per node instead of once per containment query.
|
|
19
|
+
|
|
5
20
|
## [0.55.1] - 2026-09-08
|
|
6
21
|
|
|
7
22
|
### Changed
|
|
@@ -552,7 +567,8 @@
|
|
|
552
567
|
|
|
553
568
|
- Initial public release
|
|
554
569
|
|
|
555
|
-
[Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.
|
|
570
|
+
[Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.56.0...HEAD
|
|
571
|
+
[0.56.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.55.1...ruby-v0.56.0
|
|
556
572
|
[0.55.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.55.0...ruby-v0.55.1
|
|
557
573
|
[0.55.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.54.0...ruby-v0.55.0
|
|
558
574
|
[0.54.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.53.0...ruby-v0.54.0
|
data/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "jsonschema-rb"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.56.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
authors = ["Dmitry Dygalo <dmitry@dygalo.dev>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -14,7 +14,7 @@ crate-type = ["cdylib"]
|
|
|
14
14
|
|
|
15
15
|
[dependencies]
|
|
16
16
|
strum = "0.28.0"
|
|
17
|
-
jsonschema = { version = "0.
|
|
17
|
+
jsonschema = { version = "0.56.0", default-features = false, features = ["magnus", "arbitrary-precision", "resolve-http", "resolve-file", "tls-ring", "macros", "idna"] }
|
|
18
18
|
magnus = { version = "0.8", features = ["rb-sys"] }
|
|
19
19
|
rb-sys = "0.9"
|
|
20
20
|
serde = { workspace = true }
|
data/ext/jsonschema/Cargo.lock
CHANGED
|
@@ -693,9 +693,9 @@ dependencies = [
|
|
|
693
693
|
|
|
694
694
|
[[package]]
|
|
695
695
|
name = "jsonschema"
|
|
696
|
-
version = "0.
|
|
696
|
+
version = "0.56.0"
|
|
697
697
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
698
|
-
checksum = "
|
|
698
|
+
checksum = "b6a806f80c1f5560431009ce5ec29b59d38f950e0cd7db5f1b8925e6d8104e21"
|
|
699
699
|
dependencies = [
|
|
700
700
|
"ahash",
|
|
701
701
|
"bytecount",
|
|
@@ -726,9 +726,9 @@ dependencies = [
|
|
|
726
726
|
|
|
727
727
|
[[package]]
|
|
728
728
|
name = "jsonschema-macros"
|
|
729
|
-
version = "0.
|
|
729
|
+
version = "0.56.0"
|
|
730
730
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
731
|
-
checksum = "
|
|
731
|
+
checksum = "97ac41a7411c029f7f9971881ccf12c8190411a0ab5caf53c07b07eabbea253e"
|
|
732
732
|
dependencies = [
|
|
733
733
|
"jsonschema-macros-core",
|
|
734
734
|
"proc-macro2",
|
|
@@ -736,9 +736,9 @@ dependencies = [
|
|
|
736
736
|
|
|
737
737
|
[[package]]
|
|
738
738
|
name = "jsonschema-macros-core"
|
|
739
|
-
version = "0.
|
|
739
|
+
version = "0.56.0"
|
|
740
740
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
741
|
-
checksum = "
|
|
741
|
+
checksum = "b29ab02b2d2d1b26f9c7709c7985ced2d163cb570dedd38bd8467ef31e5dbc3c"
|
|
742
742
|
dependencies = [
|
|
743
743
|
"fancy-regex",
|
|
744
744
|
"indexmap",
|
|
@@ -755,7 +755,7 @@ dependencies = [
|
|
|
755
755
|
|
|
756
756
|
[[package]]
|
|
757
757
|
name = "jsonschema-rb-ext"
|
|
758
|
-
version = "0.
|
|
758
|
+
version = "0.56.0"
|
|
759
759
|
dependencies = [
|
|
760
760
|
"jsonschema",
|
|
761
761
|
"magnus",
|
|
@@ -769,18 +769,18 @@ dependencies = [
|
|
|
769
769
|
|
|
770
770
|
[[package]]
|
|
771
771
|
name = "jsonschema-regex"
|
|
772
|
-
version = "0.
|
|
772
|
+
version = "0.56.0"
|
|
773
773
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
774
|
-
checksum = "
|
|
774
|
+
checksum = "cb862addfa7782108933abcf842fe25334523a9df5b89ea4d9620e3dd7b42181"
|
|
775
775
|
dependencies = [
|
|
776
776
|
"regex-syntax",
|
|
777
777
|
]
|
|
778
778
|
|
|
779
779
|
[[package]]
|
|
780
780
|
name = "jsonschema-value"
|
|
781
|
-
version = "0.
|
|
781
|
+
version = "0.56.0"
|
|
782
782
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
783
|
-
checksum = "
|
|
783
|
+
checksum = "a05cd404c5ff6e2731dbbf7e290a27417750acfb59e329560a1d0af384c93fb0"
|
|
784
784
|
dependencies = [
|
|
785
785
|
"ahash",
|
|
786
786
|
"bytecount",
|
|
@@ -1135,9 +1135,9 @@ dependencies = [
|
|
|
1135
1135
|
|
|
1136
1136
|
[[package]]
|
|
1137
1137
|
name = "referencing"
|
|
1138
|
-
version = "0.
|
|
1138
|
+
version = "0.56.0"
|
|
1139
1139
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1140
|
-
checksum = "
|
|
1140
|
+
checksum = "a3b4a92fac7e28c27de3ad26df2ecb9e652f227b258e845af034052e5b22c96c"
|
|
1141
1141
|
dependencies = [
|
|
1142
1142
|
"ahash",
|
|
1143
1143
|
"fluent-uri",
|
data/ext/jsonschema/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "jsonschema-rb-ext"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.56.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
publish = false
|
|
6
6
|
|
|
@@ -10,10 +10,10 @@ name = "jsonschema_rb"
|
|
|
10
10
|
path = "../../src/lib.rs"
|
|
11
11
|
|
|
12
12
|
[dependencies]
|
|
13
|
-
jsonschema = { version = "0.
|
|
13
|
+
jsonschema = { version = "0.56.0", default-features = false, features = ["magnus", "arbitrary-precision", "resolve-http", "resolve-file", "tls-ring", "macros", "idna"] }
|
|
14
14
|
magnus = { version = "0.8", features = ["rb-sys"] }
|
|
15
15
|
rb-sys = "0.9"
|
|
16
|
-
referencing = "0.
|
|
16
|
+
referencing = "0.56.0"
|
|
17
17
|
serde = { version = "1", features = ["derive"] }
|
|
18
18
|
serde_json = { version = "1", features = ["arbitrary_precision"] }
|
|
19
19
|
strum = "0.28.0"
|
data/lib/jsonschema/version.rb
CHANGED
data/sig/jsonschema.rbs
CHANGED
|
@@ -23,6 +23,10 @@ module JSONSchema
|
|
|
23
23
|
# What an array requires of its elements: all distinct, some repeated, or neither.
|
|
24
24
|
type distinctness = :unconstrained | :all_distinct | :some_repeated
|
|
25
25
|
|
|
26
|
+
# What stopped a run from modeling a document.
|
|
27
|
+
type raw_reason = :unknown_dialect | :unmodeled | :outgrew_intersections
|
|
28
|
+
| :outgrew_cases | :inexact_intersection
|
|
29
|
+
|
|
26
30
|
# Whether one schema admits every value another does. Only `:yes` proves containment: test
|
|
27
31
|
# for `:yes`, and treat `:unknown` like `:no`.
|
|
28
32
|
type containment = :yes | :no | :unknown
|
|
@@ -57,6 +61,15 @@ module JSONSchema
|
|
|
57
61
|
ALL: Array[distinctness]
|
|
58
62
|
end
|
|
59
63
|
|
|
64
|
+
module RawReason
|
|
65
|
+
UNKNOWN_DIALECT: :unknown_dialect
|
|
66
|
+
UNMODELED: :unmodeled
|
|
67
|
+
OUTGREW_INTERSECTIONS: :outgrew_intersections
|
|
68
|
+
OUTGREW_CASES: :outgrew_cases
|
|
69
|
+
INEXACT_INTERSECTION: :inexact_intersection
|
|
70
|
+
ALL: Array[raw_reason]
|
|
71
|
+
end
|
|
72
|
+
|
|
60
73
|
module Kind
|
|
61
74
|
MULTI_TYPE: :multi_type
|
|
62
75
|
TYPED_GROUP: :typed_group
|
|
@@ -288,6 +301,8 @@ module JSONSchema
|
|
|
288
301
|
# A schema the canonical form does not support structurally, kept verbatim.
|
|
289
302
|
class RawView
|
|
290
303
|
def schema: () -> untyped
|
|
304
|
+
def reason: () -> raw_reason
|
|
305
|
+
def pointer: () -> String?
|
|
291
306
|
def inspect: () -> String
|
|
292
307
|
def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
|
|
293
308
|
end
|
data/src/canonical.rs
CHANGED
|
@@ -2,7 +2,7 @@ use jsonschema::{
|
|
|
2
2
|
canonical::{
|
|
3
3
|
CanonicalKind, CanonicalSchema, CanonicalView, CanonicalizationError, Containment,
|
|
4
4
|
ContainsView as CoreContainsView, Distinctness,
|
|
5
|
-
ObjectViolationView as CoreObjectViolationView, Satisfiability,
|
|
5
|
+
ObjectViolationView as CoreObjectViolationView, RawReason, Satisfiability,
|
|
6
6
|
},
|
|
7
7
|
JsonType,
|
|
8
8
|
};
|
|
@@ -226,7 +226,13 @@ impl RbCanonicalSchema {
|
|
|
226
226
|
CanonicalView::AnyOf(branches) => ruby.obj_wrap(AnyOfView { branches }).as_value(),
|
|
227
227
|
CanonicalView::OneOf(branches) => ruby.obj_wrap(OneOfView { branches }).as_value(),
|
|
228
228
|
CanonicalView::Reference(uri) => ruby.obj_wrap(ReferenceView { uri }).as_value(),
|
|
229
|
-
CanonicalView::Raw(
|
|
229
|
+
CanonicalView::Raw(raw) => ruby
|
|
230
|
+
.obj_wrap(RawView {
|
|
231
|
+
schema: raw.schema,
|
|
232
|
+
reason: raw.reason,
|
|
233
|
+
pointer: raw.pointer,
|
|
234
|
+
})
|
|
235
|
+
.as_value(),
|
|
230
236
|
}
|
|
231
237
|
}
|
|
232
238
|
|
|
@@ -293,6 +299,8 @@ impl RbCanonicalSchema {
|
|
|
293
299
|
#[magnus(class = "JSONSchema::Canonical::RawView", free_immediately)]
|
|
294
300
|
pub struct RawView {
|
|
295
301
|
schema: serde_json::Value,
|
|
302
|
+
reason: RawReason,
|
|
303
|
+
pointer: Option<String>,
|
|
296
304
|
}
|
|
297
305
|
|
|
298
306
|
impl DataTypeFunctions for RawView {}
|
|
@@ -302,10 +310,23 @@ impl RawView {
|
|
|
302
310
|
value_to_ruby(ruby, &rb_self.schema)
|
|
303
311
|
}
|
|
304
312
|
|
|
313
|
+
fn reason(ruby: &Ruby, rb_self: &Self) -> Value {
|
|
314
|
+
ruby.sym_new(rb_self.reason.as_str()).as_value()
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
fn pointer(ruby: &Ruby, rb_self: &Self) -> Value {
|
|
318
|
+
rb_self.pointer.as_ref().map_or_else(
|
|
319
|
+
|| ruby.qnil().as_value(),
|
|
320
|
+
|pointer| ruby.str_new(pointer).as_value(),
|
|
321
|
+
)
|
|
322
|
+
}
|
|
323
|
+
|
|
305
324
|
fn inspect(ruby: &Ruby, rb_self: &Self) -> Result<String, Error> {
|
|
306
325
|
Ok(format!(
|
|
307
|
-
"#<JSONSchema::Canonical::RawView schema={}>",
|
|
308
|
-
Self::schema(ruby, rb_self)?.inspect()
|
|
326
|
+
"#<JSONSchema::Canonical::RawView schema={} reason={} pointer={}>",
|
|
327
|
+
Self::schema(ruby, rb_self)?.inspect(),
|
|
328
|
+
Self::reason(ruby, rb_self).inspect(),
|
|
329
|
+
Self::pointer(ruby, rb_self).inspect()
|
|
309
330
|
))
|
|
310
331
|
}
|
|
311
332
|
|
|
@@ -315,6 +336,8 @@ impl RawView {
|
|
|
315
336
|
ruby.sym_new("schema"),
|
|
316
337
|
value_to_ruby(ruby, &rb_self.schema)?,
|
|
317
338
|
)?;
|
|
339
|
+
hash.aset(ruby.sym_new("reason"), Self::reason(ruby, rb_self))?;
|
|
340
|
+
hash.aset(ruby.sym_new("pointer"), Self::pointer(ruby, rb_self))?;
|
|
318
341
|
Ok(hash)
|
|
319
342
|
}
|
|
320
343
|
}
|
|
@@ -1467,6 +1490,7 @@ pub(crate) fn init_canonical(ruby: &Ruby, module: &RModule) -> Result<(), Error>
|
|
|
1467
1490
|
Distinctness::VARIANTS,
|
|
1468
1491
|
)?;
|
|
1469
1492
|
define_labels(ruby, &canonical_module, "Kind", CanonicalKind::VARIANTS)?;
|
|
1493
|
+
define_labels(ruby, &canonical_module, "RawReason", RawReason::VARIANTS)?;
|
|
1470
1494
|
|
|
1471
1495
|
let canonical_schema = canonical_module.define_class("CanonicalSchema", ruby.class_object())?;
|
|
1472
1496
|
canonical_schema.define_method(
|
|
@@ -1687,6 +1711,8 @@ pub(crate) fn init_canonical(ruby: &Ruby, module: &RModule) -> Result<(), Error>
|
|
|
1687
1711
|
|
|
1688
1712
|
let raw_view = canonical_module.define_class("RawView", ruby.class_object())?;
|
|
1689
1713
|
raw_view.define_method("schema", method!(RawView::schema, 0))?;
|
|
1714
|
+
raw_view.define_method("reason", method!(RawView::reason, 0))?;
|
|
1715
|
+
raw_view.define_method("pointer", method!(RawView::pointer, 0))?;
|
|
1690
1716
|
raw_view.define_method("inspect", method!(RawView::inspect, 0))?;
|
|
1691
1717
|
raw_view.define_method("deconstruct_keys", method!(RawView::deconstruct_keys, 1))?;
|
|
1692
1718
|
|