jsonschema_rs 0.44.1-x86_64-linux → 0.45.0-x86_64-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: 58a180319f8aca83ea9092e48c3a80cc15b5fd627bf524e68eb98d3b0e78e807
4
- data.tar.gz: e838b4a5d041d65cb68d1155087e6a403846e9cceed59b2b9d82b5cb487f01bb
3
+ metadata.gz: 0f0b8634cf16ce2ebe57961694d488a6051b7ba687634f1b59a64feda87c3602
4
+ data.tar.gz: c0ace74a94dd6bf3106b1af3550cd40c6d12bcafdeac7293dc8eb4709ad8ee0f
5
5
  SHA512:
6
- metadata.gz: 1290ca870062e2bb4c6420d0c0240413a40d5ff8821897803f327d5cf76bff17a773490e7ea272ebb6044e0e5f406a75af1b02a0fc5d771fdcb5bfbdd6410471
7
- data.tar.gz: 8c663417d9ab92b0ab019cf6919cd83fc14f1a79a9f592607d9fb3245c6e64951a680b31567032c1baee781ebf6302b0e29fd263597f95d7917dcbf651bd2b4e
6
+ metadata.gz: 5de8b02d35289d7ef30600af32699637e43c356b78c3e2a1084348bf1794e31df4e8acf9b5d84905bad32cbc86955f82d2ed01020eb5a2227e51837fe34bfe2a
7
+ data.tar.gz: e267587e4d8959548902fb0851d0861066314fe6a99cc5fcefd26d75f067e0dcb03523d492e7686d8c36e642e081c22a766d4948a70ef97462393370a1e389d1
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.45.0] - 2026-03-08
6
+
7
+ ### Added
8
+
9
+ - `JSONSchema.bundle(schema, ...)`: produce a Compound Schema Document with all external `$ref` targets embedded in a draft-appropriate container (`definitions` for Draft 4/6/7, `$defs` for Draft 2019-09/2020-12; [Appendix B](https://json-schema.org/draft/2020-12/json-schema-core#appendix-B)). [#791](https://github.com/Stranger6667/jsonschema/issues/791).
10
+ - `ValidationError#absolute_keyword_location` to get the absolute keyword location URI of the schema node that produced the error.
11
+
5
12
  ## [0.44.1] - 2026-03-03
6
13
 
7
14
  ### Fixed
@@ -59,7 +66,8 @@
59
66
 
60
67
  - Initial public release
61
68
 
62
- [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.44.1...HEAD
69
+ [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.45.0...HEAD
70
+ [0.45.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.44.1...ruby-v0.45.0
63
71
  [0.44.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.44.0...ruby-v0.44.1
64
72
  [0.44.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.43.0...ruby-v0.44.0
65
73
  [0.43.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.42.2...ruby-v0.43.0
data/README.md CHANGED
@@ -49,6 +49,7 @@ end
49
49
  - 🌐 Remote reference fetching (network/file)
50
50
  - 🔧 Custom keywords and format validators
51
51
  - ✨ Meta-schema validation for schema documents
52
+ - 📦 Schema bundling into Compound Schema Documents
52
53
  - ♦️ Supports Ruby 3.2, 3.4 and 4.0
53
54
 
54
55
  ### Supported drafts
@@ -267,6 +268,30 @@ dump_a == dump_b # => true
267
268
 
268
269
  Main use case: deduplicating equivalent JSON Schemas.
269
270
 
271
+ ## Schema Bundling
272
+
273
+ 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.
274
+
275
+ ```ruby
276
+ address_schema = {
277
+ "$schema" => "https://json-schema.org/draft/2020-12/schema",
278
+ "$id" => "https://example.com/address.json",
279
+ "type" => "object",
280
+ "properties" => { "street" => { "type" => "string" }, "city" => { "type" => "string" } },
281
+ "required" => ["street", "city"]
282
+ }
283
+
284
+ schema = {
285
+ "$schema" => "https://json-schema.org/draft/2020-12/schema",
286
+ "type" => "object",
287
+ "properties" => { "home" => { "$ref" => "https://example.com/address.json" } },
288
+ "required" => ["home"]
289
+ }
290
+
291
+ registry = JSONSchema::Registry.new([["https://example.com/address.json", address_schema]])
292
+ bundled = JSONSchema.bundle(schema, registry: registry)
293
+ ```
294
+
270
295
  ## Meta-Schema Validation
271
296
 
272
297
  Validate that a JSON Schema document is itself valid:
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.44.1"
4
+ VERSION = "0.45.0"
5
5
  end
data/sig/jsonschema.rbs CHANGED
@@ -41,6 +41,19 @@ module JSONSchema
41
41
  ?http_options: HttpOptions?
42
42
  ) -> Validator
43
43
 
44
+ # Bundle a JSON Schema into a Compound Schema Document.
45
+ # All externally-referenced schemas reachable via $ref are embedded in a
46
+ # draft-appropriate container (definitions for Draft 4/6/7, $defs for
47
+ # Draft 2019-09/2020-12).
48
+ # Original $ref values are preserved unchanged.
49
+ def self.bundle: (
50
+ untyped schema,
51
+ ?draft: draft?,
52
+ ?retriever: (^(String) -> untyped)?,
53
+ ?registry: Registry?,
54
+ ?base_uri: String?
55
+ ) -> Hash[String, untyped]
56
+
44
57
  # Detect the JSON Schema draft for a schema and return the corresponding validator class.
45
58
  # Draft is detected automatically from the `$schema` field. Defaults to Draft202012Validator.
46
59
  def self.validator_cls_for: (untyped schema) -> (singleton(Draft4Validator) | singleton(Draft6Validator) | singleton(Draft7Validator) | singleton(Draft201909Validator) | singleton(Draft202012Validator))
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.44.1
4
+ version: 0.45.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Dmitry Dygalo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-03 00:00:00.000000000 Z
11
+ date: 2026-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal