jsonschema_rs 0.48.5 → 0.49.1

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: 60ae1d2ffaa7543f17f5a7953a2ed92520f3887f7e92c8c8ac632f7c56e515ef
4
- data.tar.gz: 8c3ac5d3f66016a881eed8a6f9f78327e32373e738ab453c39f0449365fce8a9
3
+ metadata.gz: 9d150c4402ac7014d11674fba8a3e7ae36638e1a671010b4b8494ede16c03858
4
+ data.tar.gz: 4af066e13c47db2d317113d3a6454eae0e2ad60f16c52b31648da7889055bef3
5
5
  SHA512:
6
- metadata.gz: 3878552e31d235939c2fc5f4a7665002fa7ee604d4fed06a899ea78679b5ea76183322524b828376e5d891c154426a2fb1167604444eefcb8509afda8b477501
7
- data.tar.gz: 9e6c6b67a2d3bea2ce93c31c1da0947832708ee55941950860ace90959ad4eb1d66c31e6a66273d17a3bd567f6fec739046c7b18deb6335e326cddfaab5fcdf1
6
+ metadata.gz: 75713f7e5827481f37962d21c00ed968c8386f020ad1ec054f33d742b7036ad13354741f62e35eba0b82eb161be1b189a83f71e3a99f3fceacd917c2f56d334c
7
+ data.tar.gz: a7e7405400ba4dbf94954510ab490372c52258c16c61fe423285d73edcf8837e839601d462fe163bc289a040312d5bb32b9c25a7cd78323bf55b96de52abb613
data/CHANGELOG.md CHANGED
@@ -2,6 +2,33 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.49.1] - 2026-07-25
6
+
7
+ ### Fixed
8
+
9
+ - `JSONSchema.canonicalize` rejecting `pattern_options` (it should take the same regex configuration as validators).
10
+ - `InvalidPattern` failures raising the base `CanonicalizationError` (they should raise `JSONSchema::Canonical::InvalidPattern`).
11
+
12
+ ## [0.49.0] - 2026-07-25
13
+
14
+ ### Added
15
+
16
+ - **EXPERIMENTAL**: Schema canonicalization via `jsonschema::canonicalize`. It reduces a reasonable subset of JSON Schemas to their normal forms.
17
+ - Validation of recursive Ruby objects.
18
+
19
+ ### Changed
20
+
21
+ - Invalid UTF-8, unsupported types, and nesting past the depth limit are reported only where a keyword reads the value.
22
+ - A hash keyed by both `:name` and `"name"` counts two properties (it previously collapsed them into one).
23
+
24
+ ### Fixed
25
+
26
+ - `multipleOf` incorrectly accepted integers past `u64` that are not multiples of the divisor.
27
+
28
+ ### Performance
29
+
30
+ - Up to 3x faster validation by working on Ruby objects directly instead of converting them to `serde_json`. [#239](https://github.com/Stranger6667/jsonschema/issues/239)
31
+
5
32
  ## [0.48.5] - 2026-07-22
6
33
 
7
34
  ### Performance
@@ -199,7 +226,9 @@
199
226
 
200
227
  - Initial public release
201
228
 
202
- [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.5...HEAD
229
+ [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.49.1...HEAD
230
+ [0.49.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.49.0...ruby-v0.49.1
231
+ [0.49.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.5...ruby-v0.49.0
203
232
  [0.48.5]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.2...ruby-v0.48.5
204
233
  [0.48.2]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.1...ruby-v0.48.2
205
234
  [0.48.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.0...ruby-v0.48.1
data/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "jsonschema-rb"
3
- version = "0.48.5"
3
+ version = "0.49.1"
4
4
  edition = "2021"
5
5
  authors = ["Dmitry Dygalo <dmitry@dygalo.dev>"]
6
6
  license = "MIT"
@@ -13,7 +13,7 @@ publish = false
13
13
  crate-type = ["cdylib"]
14
14
 
15
15
  [dependencies]
16
- jsonschema = { version = "0.48.5", default-features = false, features = ["arbitrary-precision", "resolve-http", "resolve-file", "tls-ring", "macros"] }
16
+ jsonschema = { version = "0.49.1", default-features = false, features = ["magnus", "arbitrary-precision", "resolve-http", "resolve-file", "tls-ring", "macros"] }
17
17
  magnus = { version = "0.8", features = ["rb-sys"] }
18
18
  rb-sys = "0.9"
19
19
  serde = { workspace = true }
@@ -693,9 +693,9 @@ dependencies = [
693
693
 
694
694
  [[package]]
695
695
  name = "jsonschema"
696
- version = "0.48.5"
696
+ version = "0.49.1"
697
697
  source = "registry+https://github.com/rust-lang/crates.io-index"
698
- checksum = "f05a6cff806294a7699d48761d4ae2bdebab7fa2eef05e4a0b83320f0ff46901"
698
+ checksum = "9cc9116a0f75b7336e55eb2a2a0ddef86c37cadf02924a571751aa123d5a0290"
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.48.5"
729
+ version = "0.49.1"
730
730
  source = "registry+https://github.com/rust-lang/crates.io-index"
731
- checksum = "40bda6e08b09b66cc0f70c0768118b51e8da7cef847036c88a68471b15101bcb"
731
+ checksum = "b78efbcc1da165d63e1944fa687b3c2c09e8e418e9481e25aeada6062160c1bf"
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.48.5"
739
+ version = "0.49.1"
740
740
  source = "registry+https://github.com/rust-lang/crates.io-index"
741
- checksum = "5f884bf73113c53f6b1d23f14c68a09faebf118854ce122a1afe91ce73d050d3"
741
+ checksum = "10c6550900b4a6be61392b8ddeb62b5c057975371ce93fca76d92542015f98bf"
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.48.5"
758
+ version = "0.49.1"
759
759
  dependencies = [
760
760
  "jsonschema",
761
761
  "magnus",
@@ -768,25 +768,27 @@ dependencies = [
768
768
 
769
769
  [[package]]
770
770
  name = "jsonschema-regex"
771
- version = "0.48.5"
771
+ version = "0.49.1"
772
772
  source = "registry+https://github.com/rust-lang/crates.io-index"
773
- checksum = "84708dd3f6c5327478a96f37378adb27deed6a626cf84d19de780d9e8ae84b17"
773
+ checksum = "628a1f02bda4651d9a6088ee6386a92f0ee96255b0c99e9dfe1be91bf83bd838"
774
774
  dependencies = [
775
775
  "regex-syntax",
776
776
  ]
777
777
 
778
778
  [[package]]
779
779
  name = "jsonschema-value"
780
- version = "0.48.5"
780
+ version = "0.49.1"
781
781
  source = "registry+https://github.com/rust-lang/crates.io-index"
782
- checksum = "fd8c04ab4ce60e42c4e302d3bd9d184652bb56f212495d2eea23573bcbf72556"
782
+ checksum = "75d94a372f8d81d070fd405065c6b1168d8248d1d6adad073ac708de254698c6"
783
783
  dependencies = [
784
784
  "ahash",
785
785
  "bytecount",
786
786
  "fraction",
787
+ "magnus",
787
788
  "num-bigint",
788
789
  "num-cmp",
789
790
  "num-traits",
791
+ "rb-sys",
790
792
  "serde_json",
791
793
  ]
792
794
 
@@ -1130,9 +1132,9 @@ dependencies = [
1130
1132
 
1131
1133
  [[package]]
1132
1134
  name = "referencing"
1133
- version = "0.48.5"
1135
+ version = "0.49.1"
1134
1136
  source = "registry+https://github.com/rust-lang/crates.io-index"
1135
- checksum = "980e77f5cfffc592c0e7dfb6d20770a0b96a6ab94d403de7454ed9799505e4ba"
1137
+ checksum = "978badf4419c9d0e1bc6e7466e99277f829d768257670c46d88121ca75e34bf7"
1136
1138
  dependencies = [
1137
1139
  "ahash",
1138
1140
  "fluent-uri",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "jsonschema-rb-ext"
3
- version = "0.48.5"
3
+ version = "0.49.1"
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.48.5", default-features = false, features = ["arbitrary-precision", "resolve-http", "resolve-file", "tls-ring", "macros"] }
13
+ jsonschema = { version = "0.49.1", default-features = false, features = ["magnus", "arbitrary-precision", "resolve-http", "resolve-file", "tls-ring", "macros"] }
14
14
  magnus = { version = "0.8", features = ["rb-sys"] }
15
15
  rb-sys = "0.9"
16
- referencing = "0.48.5"
16
+ referencing = "0.49.1"
17
17
  serde = { version = "1", features = ["derive"] }
18
18
  serde_json = { version = "1", features = ["arbitrary_precision"] }
19
19
  zmij = "1"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSONSchema
4
- VERSION = "0.48.5"
4
+ VERSION = "0.49.1"
5
5
  end
data/sig/jsonschema.rbs CHANGED
@@ -16,11 +16,12 @@ module JSONSchema
16
16
  end
17
17
 
18
18
  # Structural discriminant of a canonical schema, one per view class.
19
- type kind = :multi_type | :typed_group | :string | :integer | :const | :enum
20
- | :any_of | :true | :false | :raw
19
+ type kind = :multi_type | :typed_group | :string | :integer | :number | :array
20
+ | :object | :const | :enum | :any_of | :true | :false | :raw
21
21
 
22
22
  type view = TrueView | FalseView | MultiTypeView | TypedGroupView | StringView
23
- | IntegerView | AnyOfView | ConstView | EnumView | RawView
23
+ | IntegerView | NumberView | ArrayView | ObjectView | AnyOfView
24
+ | ConstView | EnumView | RawView
24
25
 
25
26
  class CanonicalizationError < StandardError
26
27
  end
@@ -28,6 +29,9 @@ module JSONSchema
28
29
  class InvalidSchemaType < CanonicalizationError
29
30
  end
30
31
 
32
+ class InvalidPattern < CanonicalizationError
33
+ end
34
+
31
35
  # A schema reduced to canonical form: schemas accepting the same values share one form.
32
36
  class CanonicalSchema
33
37
  def to_json_schema: () -> untyped
@@ -70,14 +74,62 @@ module JSONSchema
70
74
  def min_length: () -> Integer?
71
75
  def max_length: () -> Integer?
72
76
  def patterns: () -> Array[String]
77
+ def formats: () -> Array[String]
78
+ def content_media_types: () -> Array[String]
79
+ def content_encodings: () -> Array[String]
80
+ def inspect: () -> String
81
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
82
+ end
83
+
84
+ # A number value within a real interval.
85
+ class NumberView
86
+ def minimum: () -> (Integer | Float)?
87
+ def exclusive_minimum: () -> bool
88
+ def maximum: () -> (Integer | Float)?
89
+ def exclusive_maximum: () -> bool
90
+ def multiple_of: () -> Array[Integer | Float]
73
91
  def inspect: () -> String
74
92
  def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
75
93
  end
76
94
 
77
- # An integer value within a closed interval.
95
+ # An integer value within a closed interval, optionally a multiple of a divisor.
78
96
  class IntegerView
79
97
  def minimum: () -> Integer?
80
98
  def maximum: () -> Integer?
99
+ def multiple_of: () -> Array[Integer | Float]
100
+ def inspect: () -> String
101
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
102
+ end
103
+
104
+ # An array value whose length is within a window.
105
+ class ArrayView
106
+ def min_items: () -> Integer?
107
+ def max_items: () -> Integer?
108
+ def unique_items: () -> bool
109
+ def prefix_items: () -> Array[CanonicalSchema]
110
+ def items: () -> CanonicalSchema?
111
+ def contains: () -> Array[ContainsView]
112
+ def inspect: () -> String
113
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
114
+ end
115
+
116
+ # One `contains` demand of an array; an absent minimum spells the default of one.
117
+ class ContainsView
118
+ def schema: () -> CanonicalSchema
119
+ def min_contains: () -> Integer?
120
+ def max_contains: () -> Integer?
121
+ def inspect: () -> String
122
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
123
+ end
124
+
125
+ # An object value whose property count is within a window.
126
+ class ObjectView
127
+ def min_properties: () -> Integer?
128
+ def max_properties: () -> Integer?
129
+ def required: () -> Array[String]
130
+ def property_names: () -> CanonicalSchema?
131
+ def properties: () -> Hash[String, CanonicalSchema]
132
+ def pattern_properties: () -> Hash[String, CanonicalSchema]
81
133
  def inspect: () -> String
82
134
  def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
83
135
  end
@@ -115,7 +167,8 @@ module JSONSchema
115
167
  def self.canonicalize: (
116
168
  untyped schema,
117
169
  ?draft: draft?,
118
- ?validate_formats: bool?
170
+ ?validate_formats: bool?,
171
+ ?pattern_options: (RegexOptions | FancyRegexOptions)?
119
172
  ) -> Canonical::CanonicalSchema
120
173
 
121
174
  # Create a validator with auto-detected draft version.