jsonschema_rs 0.42.1-aarch64-linux → 0.43.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: 26cfb686c971c5e0c4a25212f42eceb8333970336f4f31c0e886a35d631be346
4
- data.tar.gz: d9fe14727791d22a1ad61c19fe86421724ae318608fe217a832090ec3fac141c
3
+ metadata.gz: 5d4195c753bb191b2bcceaaaf0d76c15cd23e5ea653202c072d132d196d61f86
4
+ data.tar.gz: 9d18e23218199f65519e5606740a29d804052b83d36af4d3cd555d3fea34321c
5
5
  SHA512:
6
- metadata.gz: 4ea5ae6d30437b51c42720640fae4ce45fa01a0def944c7471eef5db7cb67f642dc2885d0471db13ed14fa88ad7681f6ddaa544956f0fe02ba8e265b02e93540
7
- data.tar.gz: '0482c6d289800bf1ff4d030bf4beb9ef9ff838a13443ffe252efd754a1d6b8a83ffd9b6dee91c2a3aafd8b9bf4049a68c3f05ba768cc671c875d2c8e2325da12'
6
+ metadata.gz: 3a1f2be03d76f8eca400a5c6b46738229aad03cf49b79b34b36ba8f1a1c068add17e6a3f13751ef0ba74898863a18df1e69c3431591cf463cdfd5140e762cb43
7
+ data.tar.gz: 817ab7546486552b78f91abb7bb16ad9edc866150c59503f2bf3bffc04f68cdc7a46417948b2239e5c70b67f95d5422bc7bf67c7219607c8d56f9b14ed915383
data/CHANGELOG.md CHANGED
@@ -2,6 +2,36 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.43.0] - 2026-02-28
6
+
7
+ ### Added
8
+
9
+ - `validator_cls_for(schema)` function to detect and return the appropriate validator class for a schema.
10
+
11
+ ### Fixed
12
+
13
+ - `anyOf`, `format`, `unevaluatedProperties`, and `unevaluatedItems` now correctly collect annotations per spec.
14
+
15
+ ### Performance
16
+
17
+ - Optimize `pattern` and `patternProperties` for `^(a|b|c)$` alternations via linear array scan.
18
+ - Optimize `^\S*$` patterns by replacing regex with a direct ECMA-262 whitespace check.
19
+
20
+ ## [0.42.2] - 2026-02-26
21
+
22
+ ### Changed
23
+
24
+ - Custom keyword validation exceptions are now chained to the resulting `ValidationError` via `cause`, preserving the original exception class and message.
25
+
26
+ ### Fixed
27
+
28
+ - SWAR digit parser accepted bytes `:`–`?` (0x3A–0x3F) as valid digits during `date`, `time`, and `date-time` format validation, potentially allowing malformed values to pass.
29
+
30
+ ### Performance
31
+
32
+ - Extend `pattern` prefix optimization to handle escaped slashes (`^\/`) and exact-match patterns (`^\$ref$`).
33
+ - Specialize `enum` for cases when all variants are strings.
34
+
5
35
  ## [0.42.1] - 2026-02-17
6
36
 
7
37
  ### Performance
@@ -13,5 +43,7 @@
13
43
 
14
44
  - Initial public release
15
45
 
16
- [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.42.1...HEAD
46
+ [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.43.0...HEAD
47
+ [0.43.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.42.2...ruby-v0.43.0
48
+ [0.42.2]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.42.1...ruby-v0.42.2
17
49
  [0.42.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.42.0...ruby-v0.42.1
data/README.md CHANGED
@@ -147,6 +147,17 @@ Each custom keyword class must implement:
147
147
  - `initialize(parent_schema, value, schema_path)` - called during schema compilation
148
148
  - `validate(instance)` - raise on failure, return normally on success
149
149
 
150
+ When `validate` raises, the original exception is preserved as the `cause` of the `ValidationError`, so callers can inspect it:
151
+
152
+ ```ruby
153
+ begin
154
+ validator.validate!(3)
155
+ rescue JSONSchema::ValidationError => e
156
+ puts e.cause.class # => RuntimeError
157
+ puts e.cause.message # => "3 is not even"
158
+ end
159
+ ```
160
+
150
161
  ### Structured evaluation output
151
162
 
152
163
  When you need more than a boolean result, use the `evaluate` API to access the [JSON Schema Output v1](https://json-schema.org/draft/2020-12/json-schema-core#name-output-formatting) formats:
@@ -505,9 +516,9 @@ Valid draft symbols: `:draft4`, `:draft6`, `:draft7`, `:draft201909`, `:draft202
505
516
 
506
517
  `jsonschema` is designed for high performance, outperforming other Ruby JSON Schema validators in most scenarios:
507
518
 
508
- - **30-117x** faster than `json_schemer` for complex schemas and large instances
509
- - **206-473x** faster than `json-schema` where supported
510
- - **7-118x** faster than `rj_schema` (RapidJSON/C++)
519
+ - **28-148x** faster than `json_schemer` for complex schemas and large instances
520
+ - **200-567x** faster than `json-schema` where supported
521
+ - **7-130x** faster than `rj_schema` (RapidJSON/C++)
511
522
 
512
523
  For detailed benchmarks, see our [full performance comparison](https://github.com/Stranger6667/jsonschema/blob/master/crates/jsonschema-rb/BENCHMARKS.md).
513
524
 
Binary file
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.42.1"
4
+ VERSION = "0.43.0"
5
5
  end
data/sig/jsonschema.rbs CHANGED
@@ -32,6 +32,10 @@ module JSONSchema
32
32
  ?http_options: HttpOptions?
33
33
  ) -> Validator
34
34
 
35
+ # Detect the JSON Schema draft for a schema and return the corresponding validator class.
36
+ # Draft is detected automatically from the `$schema` field. Defaults to Draft202012Validator.
37
+ def self.validator_cls_for: (untyped schema) -> (singleton(Draft4Validator) | singleton(Draft6Validator) | singleton(Draft7Validator) | singleton(Draft201909Validator) | singleton(Draft202012Validator))
38
+
35
39
  # One-off validation returning boolean.
36
40
  def self.valid?: (
37
41
  untyped schema,
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.42.1
4
+ version: 0.43.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-02-17 00:00:00.000000000 Z
11
+ date: 2026-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal