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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2514fe367de6ec6e45655fb8a9a06b0e10edb78f2a795f4cc7db63c223435ae5
4
- data.tar.gz: 79027de8d2b2ffcda419cd3248b22f956f259a49d52dd9961f813ca6b10d31ff
3
+ metadata.gz: e5e2046dda10b3b0e6109b3f7a55667f9d6cb86a38b0f7ddbb80e7d9bc67b25d
4
+ data.tar.gz: f3eed3727e42c284573978507158cdd966691a0d55add5a12102bbf206440db3
5
5
  SHA512:
6
- metadata.gz: a2d648f5826ce9490f9ec562015ece34eac2f296a5566d746d380de601ce1799d4acdf91aa99014e8aec1a5d1d79d65f5ec9cced8e4bbae9412e672e55fb5e9a
7
- data.tar.gz: 6387cb7a07b4f4bf260109770e3e81aff8ff7c31ec560231cdb0abf9abb592876046e0fec456754c413d5ff85dcb5085e25eac6bf858d7ad0cf853933c4d8bf6
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.55.1...HEAD
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.55.1"
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.55.1", default-features = false, features = ["magnus", "arbitrary-precision", "resolve-http", "resolve-file", "tls-ring", "macros", "idna"] }
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 }
@@ -693,9 +693,9 @@ dependencies = [
693
693
 
694
694
  [[package]]
695
695
  name = "jsonschema"
696
- version = "0.55.1"
696
+ version = "0.56.0"
697
697
  source = "registry+https://github.com/rust-lang/crates.io-index"
698
- checksum = "b68339c3d874e48151d74ffe256d93a58cffa240983cb0967d3cbaea083a44fe"
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.55.1"
729
+ version = "0.56.0"
730
730
  source = "registry+https://github.com/rust-lang/crates.io-index"
731
- checksum = "0ee1d26bd968d4f88b291615dada57b6acc38662bae4e2244c6c9fc31e70bacc"
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.55.1"
739
+ version = "0.56.0"
740
740
  source = "registry+https://github.com/rust-lang/crates.io-index"
741
- checksum = "676d45db449ae16bce2582dcff3e7b2dfb177a3c2f885af072257815bc8825c4"
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.55.1"
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.55.1"
772
+ version = "0.56.0"
773
773
  source = "registry+https://github.com/rust-lang/crates.io-index"
774
- checksum = "6307b5b51216ec9b941b52244c74043fa0b1d6b657b56199f57cb1416d3641c5"
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.55.1"
781
+ version = "0.56.0"
782
782
  source = "registry+https://github.com/rust-lang/crates.io-index"
783
- checksum = "0230ac05e09c6111e96c147b75c390579f5cbd45654b980c68ac60fe17b3f129"
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.55.1"
1138
+ version = "0.56.0"
1139
1139
  source = "registry+https://github.com/rust-lang/crates.io-index"
1140
- checksum = "a196a5b4a8a12f46b6353174df865a05d41a6055aff212ec30877492788618b6"
1140
+ checksum = "a3b4a92fac7e28c27de3ad26df2ecb9e652f227b258e845af034052e5b22c96c"
1141
1141
  dependencies = [
1142
1142
  "ahash",
1143
1143
  "fluent-uri",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "jsonschema-rb-ext"
3
- version = "0.55.1"
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.55.1", default-features = false, features = ["magnus", "arbitrary-precision", "resolve-http", "resolve-file", "tls-ring", "macros", "idna"] }
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.55.1"
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"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSONSchema
4
- VERSION = "0.55.1"
4
+ VERSION = "0.56.0"
5
5
  end
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(schema) => ruby.obj_wrap(RawView { schema }).as_value(),
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonschema_rs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.55.1
4
+ version: 0.56.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Dygalo