jsonschema_rs 0.55.1-aarch64-linux → 0.57.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: 6cee25622bbfd132ae73c36b950bad8ae35c89de0c105f966344f23bcbc50545
4
- data.tar.gz: b8d4e813e5cb74563bf5fc8326b8a0c26fdc9d0ce4bc6cf833694b7376ef2f5e
3
+ metadata.gz: 0f04e1a7495bdcb5b920092072e093e7ecaa7b264113d913f3262614979f6a7e
4
+ data.tar.gz: 3512ec86abe7a682dd2d5cad03ffa379879a8b5fae754829bcff78700cc02432
5
5
  SHA512:
6
- metadata.gz: 8026e1ec9fd7bb8b003f6f8789dd0b11e775d003072f30e12dd5fa39903756e23e894c12992d4b5854150006d65728a039344a233cf102b36e98080bb1d91d3c
7
- data.tar.gz: 219062db2aff0ff0a4cedca0b4aec4edd00c6e3db430cf535e2cf9ec5e30f7b79d12be5a19b9a65efa440508ec8236e72ebee0e6171fc39b99d2711ff6714eca
6
+ metadata.gz: ab299ccea5d0cd2a6b25018d445f60b6564606d3746ee096d22a9e7dcb714607060ee64378a29f2df339ef07739648e23e9fe6476ec8fe146eb22494f602c58c
7
+ data.tar.gz: 4f1e4fca04679c15e6b38ee52642f8383a1e0e7ab85e56013d0b4297933c21b1b7b04a6bd3893ee422da3fa8769a550a661d8b1985d5dd72c16d460f2107876d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.57.0] - 2026-09-22
6
+
7
+ ### Added
8
+
9
+ - `Canonical.find_unsatisfiable`, naming every subschema of a document that admits no value, and the keywords that leave it empty.
10
+
11
+ ### Fixed
12
+
13
+ - The instance path of a schema build error, which was empty instead of naming the keyword location that failed to compile.
14
+
15
+ ## [0.56.0] - 2026-09-10
16
+
17
+ ### Added
18
+
19
+ - `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.
20
+
21
+ ### Changed
22
+
23
+ - 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`.
24
+
25
+ ### Performance
26
+
27
+ - Preparing or building a schema that names no base URI parses the default one once for the process instead of once per schema.
28
+ - Canonicalization reads the facets no checker covers once per node instead of once per containment query.
29
+
5
30
  ## [0.55.1] - 2026-09-08
6
31
 
7
32
  ### Changed
@@ -552,7 +577,9 @@
552
577
 
553
578
  - Initial public release
554
579
 
555
- [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.55.1...HEAD
580
+ [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.57.0...HEAD
581
+ [0.57.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.56.0...ruby-v0.57.0
582
+ [0.56.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.55.1...ruby-v0.56.0
556
583
  [0.55.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.55.0...ruby-v0.55.1
557
584
  [0.55.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.54.0...ruby-v0.55.0
558
585
  [0.54.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.53.0...ruby-v0.54.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.
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.55.1"
4
+ VERSION = "0.57.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,9 +301,60 @@ 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
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]
294
358
  end
295
359
 
296
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.55.1
4
+ version: 0.57.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-08 00:00:00.000000000 Z
11
+ date: 2026-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal