jsonschema_rs 0.56.0-aarch64-linux → 0.58.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: d0ddf02194dd710d898438fea5f4dc817c834d1aab45a913279661180886b904
4
- data.tar.gz: d9ff444af2e46d821c24b7ddddab4bb6708675e372d89d19618f59f8df676762
3
+ metadata.gz: eca235acedbca7bdfb421a17094a91517f27158b2a81d2bcd3e582eb7dff7fa5
4
+ data.tar.gz: c041e316da3016ca0dc0118188b265f7eda745a427b9fd57b452f49c7229724c
5
5
  SHA512:
6
- metadata.gz: 119bfc9ab14af17e5b7b9ef3934d175219a5f5a80240da267d396ed4fc78a6cda45a9313e3216ad3d3bdd803443543a413950ba5c17744d3b76417fc49366a34
7
- data.tar.gz: 02c965d29f1cc92a5e8991b78ed07512c0836a040b749344ac428275396be98345d0e84968313d309f114a9e50adc8a1776b6e753ff4aa3e496952bf4e811d57
6
+ metadata.gz: 1ab1179cea5fb8b01a97cda88fb596e4e3add7d912d523b7de9f3c4e9993a7104da56c6ec733dc9e9cf21431a95bbf81c36ce5d3d95566a169e79f77b7f093be
7
+ data.tar.gz: da21623478b8d56189cc8242823e774c0f74931273418d6965b0d004dc9f8b1a88739749a86ff9dfefe9f5ac50d71004b1546550c5920eb06f4e1a76444edc8a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.58.0] - 2026-09-25
6
+
7
+ ### Performance
8
+
9
+ - `oneOf` and `anyOf` whose branches each require a property fixed to a distinct string validate only the branch matching the instance's value.
10
+ - `Meta.valid?` and `Meta.validate!` check a schema against the bundled drafts without converting it first, 2 to 5x faster on the benchmarked schemas.
11
+
12
+ ### Fixed
13
+
14
+ - `Canonical.find_unsatisfiable` missing a `oneOf` over `$ref` branches beside a sibling none of them admits.
15
+ - A value with no JSON form nested under `type: null` failing validation silently (it should raise `TypeError`).
16
+
17
+ ## [0.57.0] - 2026-09-22
18
+
19
+ ### Added
20
+
21
+ - `Canonical.find_unsatisfiable`, naming every subschema of a document that admits no value, and the keywords that leave it empty.
22
+
23
+ ### Fixed
24
+
25
+ - The instance path of a schema build error, which was empty instead of naming the keyword location that failed to compile.
26
+
5
27
  ## [0.56.0] - 2026-09-10
6
28
 
7
29
  ### Added
@@ -567,7 +589,9 @@
567
589
 
568
590
  - Initial public release
569
591
 
570
- [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.56.0...HEAD
592
+ [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.58.0...HEAD
593
+ [0.58.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.57.0...ruby-v0.58.0
594
+ [0.57.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.56.0...ruby-v0.57.0
571
595
  [0.56.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.55.1...ruby-v0.56.0
572
596
  [0.55.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.55.0...ruby-v0.55.1
573
597
  [0.55.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.54.0...ruby-v0.55.0
data/README.md CHANGED
@@ -371,6 +371,33 @@ Compare a request schema new-against-old and a response schema old-against-new:
371
371
 
372
372
  Both operands must share one setup - the same draft, format policy, regular-expression engine and definitions - or `IncompatibleOperands` is raised. `UnsupportedOperand` means an operand is a `Raw` pass-through, and `UnsupportedResult` that the canonical form does not support the result. All three live under `JSONSchema::Canonical`.
373
373
 
374
+ ### Finding the dead subschemas of a document
375
+
376
+ `JSONSchema::Canonical.find_unsatisfiable` walks a whole document and answers which of its subschemas admit no value, and why - the keywords at fault and where they sit:
377
+
378
+ ```ruby
379
+ reasons = JSONSchema::Canonical.find_unsatisfiable(
380
+ {
381
+ "properties" => {
382
+ "tag" => { "type" => "string", "minLength" => 5, "maxLength" => 2 },
383
+ "name" => { "type" => "string" }
384
+ }
385
+ }
386
+ )
387
+
388
+ case reasons["/properties/tag"]
389
+ in JSONSchema::Canonical::ConflictReason[causes:]
390
+ causes.map { |cause| [cause.pointer, cause.keywords] }
391
+ # => [["/properties/tag", ["type"]], ["/properties/tag", ["minLength", "maxLength"]]]
392
+ end
393
+
394
+ # A live subschema is not reported
395
+ reasons.key?("/properties/name")
396
+ # => false
397
+ ```
398
+
399
+ A reason is a `LiteralReason` (written as `false`), an `EmptyReason` (one part admits nothing by itself) or a `ConflictReason` (each part admits values, together they admit none). A pointer left out is not proven satisfiable: a document canonicalization cannot model reports nothing, as `satisfiability` answers `:unknown`.
400
+
374
401
  ## Schema Bundling and Dereferencing
375
402
 
376
403
  Produce a Compound Schema Document ([Appendix B](https://json-schema.org/draft/2020-12/json-schema-core#appendix-B)) by embedding all external `$ref` targets into a draft-appropriate container. The result validates identically to the original.
@@ -673,6 +700,18 @@ Valid draft symbols: `:draft4`, `:draft6`, `:draft7`, `:draft201909`, `:draft202
673
700
 
674
701
  For detailed benchmarks, see our [full performance comparison](https://github.com/Stranger6667/jsonschema/blob/master/crates/jsonschema-rb/BENCHMARKS.md).
675
702
 
703
+ ### Compile-Time Validators
704
+
705
+ If you ship your own extension and know the schema at build time, the Rust crate's
706
+ `#[jsonschema::validator(..., backend = Magnus)]` macro compiles it into a validator that reads
707
+ Ruby objects directly, so nothing is parsed or compiled when your extension is loaded, and
708
+ validation runs up to 3.5x faster than with a validator built at run time. See the
709
+ [macro documentation](https://docs.rs/jsonschema/latest/jsonschema/#ruby-extension-modules).
710
+
711
+ This is not available from the `jsonschema_rs` gem, which takes its schemas at run time.
712
+ A complete extension with its build and test commands lives in
713
+ [`examples/magnus-extension`](https://github.com/Stranger6667/jsonschema/tree/master/examples/magnus-extension).
714
+
676
715
  ## Acknowledgements
677
716
 
678
717
  This library draws API design inspiration from the Python [`jsonschema`](https://github.com/python-jsonschema/jsonschema) package. We're grateful to the Python `jsonschema` maintainers and contributors for their pioneering work in JSON Schema validation.
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.56.0"
4
+ VERSION = "0.58.0"
5
5
  end
data/sig/jsonschema.rbs CHANGED
@@ -306,6 +306,55 @@ module JSONSchema
306
306
  def inspect: () -> String
307
307
  def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
308
308
  end
309
+
310
+ # One part of a schema object, as a reason names it.
311
+ class Cause
312
+ # JSON Pointer of the schema object holding `keywords`, or of the subschema itself.
313
+ def pointer: () -> String
314
+ # Keywords of one family present at `pointer`; empty for a whole subschema.
315
+ def keywords: () -> Array[String]
316
+ def ==: (untyped other) -> bool
317
+ def inspect: () -> String
318
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
319
+ end
320
+
321
+ # The subschema is written as `false`.
322
+ class LiteralReason
323
+ def inspect: () -> String
324
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
325
+ end
326
+
327
+ # One part every value must satisfy admits nothing by itself. A subschema part has a reason
328
+ # of its own under its pointer.
329
+ class EmptyReason
330
+ def cause: () -> Cause
331
+ def inspect: () -> String
332
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
333
+ end
334
+
335
+ # Each part admits values; no value satisfies all of them together.
336
+ class ConflictReason
337
+ def causes: () -> Array[Cause]
338
+ def inspect: () -> String
339
+ def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
340
+ end
341
+
342
+ # Why a subschema admits no value.
343
+ type unsatisfiable_reason = LiteralReason | EmptyReason | ConflictReason
344
+
345
+ # The subschemas that admit no value, by JSON Pointer, each with why.
346
+ #
347
+ # A pointer left out is not proven satisfiable: a document the canonical form does not model
348
+ # reports nothing, as `satisfiability` answers `:unknown`.
349
+ def self.find_unsatisfiable: (
350
+ untyped schema,
351
+ ?draft: JSONSchema::draft?,
352
+ ?validate_formats: bool?,
353
+ ?pattern_options: (RegexOptions | FancyRegexOptions)?,
354
+ ?retriever: (^(String) -> untyped)?,
355
+ ?registry: Registry?,
356
+ ?base_uri: String?
357
+ ) -> Hash[String, unsatisfiable_reason]
309
358
  end
310
359
 
311
360
  # Reduce a schema to its canonical form.
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.56.0
4
+ version: 0.58.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-09-10 00:00:00.000000000 Z
11
+ date: 2026-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal