jsonschema_rs 0.56.0-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: d0ddf02194dd710d898438fea5f4dc817c834d1aab45a913279661180886b904
4
- data.tar.gz: d9ff444af2e46d821c24b7ddddab4bb6708675e372d89d19618f59f8df676762
3
+ metadata.gz: 0f04e1a7495bdcb5b920092072e093e7ecaa7b264113d913f3262614979f6a7e
4
+ data.tar.gz: 3512ec86abe7a682dd2d5cad03ffa379879a8b5fae754829bcff78700cc02432
5
5
  SHA512:
6
- metadata.gz: 119bfc9ab14af17e5b7b9ef3934d175219a5f5a80240da267d396ed4fc78a6cda45a9313e3216ad3d3bdd803443543a413950ba5c17744d3b76417fc49366a34
7
- data.tar.gz: 02c965d29f1cc92a5e8991b78ed07512c0836a040b749344ac428275396be98345d0e84968313d309f114a9e50adc8a1776b6e753ff4aa3e496952bf4e811d57
6
+ metadata.gz: ab299ccea5d0cd2a6b25018d445f60b6564606d3746ee096d22a9e7dcb714607060ee64378a29f2df339ef07739648e23e9fe6476ec8fe146eb22494f602c58c
7
+ data.tar.gz: 4f1e4fca04679c15e6b38ee52642f8383a1e0e7ab85e56013d0b4297933c21b1b7b04a6bd3893ee422da3fa8769a550a661d8b1985d5dd72c16d460f2107876d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
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
+
5
15
  ## [0.56.0] - 2026-09-10
6
16
 
7
17
  ### Added
@@ -567,7 +577,8 @@
567
577
 
568
578
  - Initial public release
569
579
 
570
- [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.56.0...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
571
582
  [0.56.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.55.1...ruby-v0.56.0
572
583
  [0.55.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.55.0...ruby-v0.55.1
573
584
  [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.
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.57.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.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-10 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