jsonschema_rs 0.48.2-aarch64-linux → 0.49.0-aarch64-linux

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: b98c0e47119f92049a42e2400c41c8f7919a83a5e386da7bc7362cd7084cb0a1
4
- data.tar.gz: 0de7ed735f6f47d4b39671987cbee53464b5e8f071a7d77192d7c6d5fafbbe1a
3
+ metadata.gz: 30cf2dd3523b8236e0174b8428b54dd5be86de34f3ba139afd88a0fe89cd5f07
4
+ data.tar.gz: ecb2e8de4b3188c94572d658e24ba39846431d4c9a2d7e48a9ed0a0b0c80117e
5
5
  SHA512:
6
- metadata.gz: a296edf52c431d723cffb65fb054729742f81e0ca84713f2e4b35039fb2ca4ccffd4650ccb14197a98dae84d89842b153290cbca56861c159576add8fbf43e53
7
- data.tar.gz: db96a866b5ce4932024e9642235b4fed4572f058f162f38604fcc598984372f31ecf3c0b53202cd1c5f110047788fca05dd6b6ae3e587ea2b1d7dec1a10677ac
6
+ metadata.gz: be97e1d4b66273b68874d74a48386047b5504800ed679a434013db70d92d3a7178bf86d8f9bd9e5099d8aff2913ef809130644cb3e8ba3ead95142f3bf3d476c
7
+ data.tar.gz: 3d60a91a48228513758279430d71b100301e6b54d6631fe15b7ec7835bcfe83e0b29d5d530e66df324790385afd0255598f70cfdce4c94c3858bf5934352e6a7
data/CHANGELOG.md CHANGED
@@ -2,6 +2,33 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.49.0] - 2026-07-25
6
+
7
+ ### Added
8
+
9
+ - **EXPERIMENTAL**: Schema canonicalization via `jsonschema::canonicalize`. It reduces a reasonable subset of JSON Schemas to their normal forms.
10
+ - Validation of recursive Ruby objects.
11
+
12
+ ### Changed
13
+
14
+ - Invalid UTF-8, unsupported types, and nesting past the depth limit are reported only where a keyword reads the value.
15
+ - A hash keyed by both `:name` and `"name"` counts two properties (it previously collapsed them into one).
16
+
17
+ ### Fixed
18
+
19
+ - `multipleOf` incorrectly accepted integers past `u64` that are not multiples of the divisor.
20
+
21
+ ### Performance
22
+
23
+ - 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)
24
+
25
+ ## [0.48.5] - 2026-07-22
26
+
27
+ ### Performance
28
+
29
+ - Avoid map lookups in some `properties` validators.
30
+ - Faster validation of `{"type": "array", "items": {...}}` schemas.
31
+
5
32
  ## [0.48.2] - 2026-07-21
6
33
 
7
34
  ### Fixed
@@ -192,7 +219,9 @@
192
219
 
193
220
  - Initial public release
194
221
 
195
- [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.2...HEAD
222
+ [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.49.0...HEAD
223
+ [0.49.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.5...ruby-v0.49.0
224
+ [0.48.5]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.2...ruby-v0.48.5
196
225
  [0.48.2]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.1...ruby-v0.48.2
197
226
  [0.48.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.0...ruby-v0.48.1
198
227
  [0.48.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.47.0...ruby-v0.48.0
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSONSchema
4
- VERSION = "0.48.2"
4
+ VERSION = "0.49.0"
5
5
  end
data/sig/jsonschema.rbs CHANGED
@@ -14,8 +14,159 @@ module JSONSchema
14
14
  # Main use case: deduplicate equivalent JSON Schemas by using a stable string form.
15
15
  def self.to_string: (untyped object) -> String
16
16
  end
17
+
18
+ # Structural discriminant of a canonical schema, one per view class.
19
+ type kind = :multi_type | :typed_group | :string | :integer | :number | :array
20
+ | :object | :const | :enum | :any_of | :true | :false | :raw
21
+
22
+ type view = TrueView | FalseView | MultiTypeView | TypedGroupView | StringView
23
+ | IntegerView | NumberView | ArrayView | ObjectView | AnyOfView
24
+ | ConstView | EnumView | RawView
25
+
26
+ class CanonicalizationError < StandardError
27
+ end
28
+
29
+ class InvalidSchemaType < CanonicalizationError
30
+ end
31
+
32
+ # A schema reduced to canonical form: schemas accepting the same values share one form.
33
+ class CanonicalSchema
34
+ def to_json_schema: () -> untyped
35
+ def draft: () -> JSONSchema::draft
36
+ def kind: () -> kind
37
+ def view: () -> view
38
+ def definitions: () -> Hash[String, CanonicalSchema]
39
+ def satisfiable?: () -> bool
40
+ def inspect: () -> String
41
+ def ==: (untyped other) -> bool
42
+ def eql?: (untyped other) -> bool
43
+ def hash: () -> Integer
44
+ end
45
+
46
+ # Matches any value.
47
+ class TrueView
48
+ end
49
+
50
+ # Matches no value.
51
+ class FalseView
52
+ end
53
+
54
+ # A value matches iff its JSON type is in the set.
55
+ class MultiTypeView
56
+ def types: () -> Array[Symbol]
57
+ def inspect: () -> String
58
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
59
+ end
60
+
61
+ # A value matches iff its JSON type is `type_name` and it satisfies `body`.
62
+ class TypedGroupView
63
+ def type_name: () -> Symbol
64
+ def body: () -> CanonicalSchema
65
+ def inspect: () -> String
66
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
67
+ end
68
+
69
+ # A string value within a length window, matching every pattern.
70
+ class StringView
71
+ def min_length: () -> Integer?
72
+ def max_length: () -> Integer?
73
+ def patterns: () -> Array[String]
74
+ def formats: () -> Array[String]
75
+ def content_media_types: () -> Array[String]
76
+ def content_encodings: () -> Array[String]
77
+ def inspect: () -> String
78
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
79
+ end
80
+
81
+ # A number value within a real interval.
82
+ class NumberView
83
+ def minimum: () -> (Integer | Float)?
84
+ def exclusive_minimum: () -> bool
85
+ def maximum: () -> (Integer | Float)?
86
+ def exclusive_maximum: () -> bool
87
+ def multiple_of: () -> Array[Integer | Float]
88
+ def inspect: () -> String
89
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
90
+ end
91
+
92
+ # An integer value within a closed interval, optionally a multiple of a divisor.
93
+ class IntegerView
94
+ def minimum: () -> Integer?
95
+ def maximum: () -> Integer?
96
+ def multiple_of: () -> Array[Integer | Float]
97
+ def inspect: () -> String
98
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
99
+ end
100
+
101
+ # An array value whose length is within a window.
102
+ class ArrayView
103
+ def min_items: () -> Integer?
104
+ def max_items: () -> Integer?
105
+ def unique_items: () -> bool
106
+ def prefix_items: () -> Array[CanonicalSchema]
107
+ def items: () -> CanonicalSchema?
108
+ def contains: () -> Array[ContainsView]
109
+ def inspect: () -> String
110
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
111
+ end
112
+
113
+ # One `contains` demand of an array; an absent minimum spells the default of one.
114
+ class ContainsView
115
+ def schema: () -> CanonicalSchema
116
+ def min_contains: () -> Integer?
117
+ def max_contains: () -> Integer?
118
+ def inspect: () -> String
119
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
120
+ end
121
+
122
+ # An object value whose property count is within a window.
123
+ class ObjectView
124
+ def min_properties: () -> Integer?
125
+ def max_properties: () -> Integer?
126
+ def required: () -> Array[String]
127
+ def property_names: () -> CanonicalSchema?
128
+ def properties: () -> Hash[String, CanonicalSchema]
129
+ def pattern_properties: () -> Hash[String, CanonicalSchema]
130
+ def inspect: () -> String
131
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
132
+ end
133
+
134
+ # A value matches iff at least one branch matches.
135
+ class AnyOfView
136
+ def branches: () -> Array[CanonicalSchema]
137
+ def inspect: () -> String
138
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
139
+ end
140
+
141
+ # Exactly one admitted value.
142
+ class ConstView
143
+ def value: () -> untyped
144
+ def inspect: () -> String
145
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
146
+ end
147
+
148
+ # A sorted, deduplicated finite set of admitted values.
149
+ class EnumView
150
+ def values: () -> Array[untyped]
151
+ def inspect: () -> String
152
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
153
+ end
154
+
155
+ # A schema the canonical form does not model structurally, kept verbatim.
156
+ class RawView
157
+ def schema: () -> untyped
158
+ def inspect: () -> String
159
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
160
+ end
17
161
  end
18
162
 
163
+ # Reduce a schema to its canonical form.
164
+ def self.canonicalize: (
165
+ untyped schema,
166
+ ?draft: draft?,
167
+ ?validate_formats: bool?
168
+ ) -> Canonical::CanonicalSchema
169
+
19
170
  # Create a validator with auto-detected draft version.
20
171
  #
21
172
  # @param schema The JSON Schema (Hash or JSON string)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonschema_rs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.48.2
4
+ version: 0.49.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Dmitry Dygalo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-20 00:00:00.000000000 Z
11
+ date: 2026-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal