jsonschema_rs 0.45.1-x86_64-linux → 0.46.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: b33a0adbeca5039608f82b9d5bd36c3a6e81afd9c88fbf64333bbccdef367052
4
- data.tar.gz: 56ba5266838f57eae816fd1c381675c23432289813c14a3a816e520db07a640f
3
+ metadata.gz: c296d40ace5442f74c7306acad6fd42b59d0b06f65a576f0bc2b526ca2ed5151
4
+ data.tar.gz: c0b1648f177088a2a77e21aac4a506e15a98070cc5456589923e78770e5dda8f
5
5
  SHA512:
6
- metadata.gz: ba56ed3adbf7fbaae3667a9e83a1b13eea5bc12fe7128033c8b9ce5edce24080dc8adfc1a809fabc2d9171676ae6a746ed2913a54d1b3419b81f03cfa2c2cbdb
7
- data.tar.gz: 4f401624b4e55ea8518ca01cfdb6421dc8f5f862ebb55c3260947744b0784c4afb23ec5c58d3f172923216dc1fb1a486fea55bf84dd1260d07ad92e7184e1288
6
+ metadata.gz: c9ced113044336bfe4f6384b3258a966fb6e77014d59d3997cb32c0207f70afdd4bb821989837a44b5ea5be93ee0e9054ac0cfc72d167a64f0c958e6f22ed0a7
7
+ data.tar.gz: cf1f648f988e4358ca316043fe5f7788adf27f4775b60785b2a5c20ab2569f87a8a421079ced56357bb3da2cf15933b3bc516119a7647ef80e7dea8c021a2a5f
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.46.0] - 2026-04-10
6
+
7
+ ### Added
8
+
9
+ - Accept JSON strings in `validator_cls_for`.
10
+ - `Resolver` and `Resolved` types for programmatic schema resolution.
11
+ - `dereference` function to recursively inline `$ref` references. [#422](https://github.com/Stranger6667/jsonschema/issues/422)
12
+ - `ValidatorMap` for validating instances against subschemas identified by URI-fragment JSON pointer. [#1075](https://github.com/Stranger6667/jsonschema/pull/1075)
13
+
14
+ ### Performance
15
+
16
+ - Avoid registry clones and document clones during validator construction. This improves real-world schema compilation by roughly 10-20% in internal benchmarks.
17
+
5
18
  ## [0.45.1] - 2026-04-06
6
19
 
7
20
  ### Fixed
@@ -73,7 +86,8 @@
73
86
 
74
87
  - Initial public release
75
88
 
76
- [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.45.1...HEAD
89
+ [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.46.0...HEAD
90
+ [0.46.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.45.1...ruby-v0.46.0
77
91
  [0.45.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.45.0...ruby-v0.45.1
78
92
  [0.45.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.44.1...ruby-v0.45.0
79
93
  [0.44.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.44.0...ruby-v0.44.1
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.45.1"
4
+ VERSION = "0.46.0"
5
5
  end
data/sig/jsonschema.rbs CHANGED
@@ -41,6 +41,22 @@ module JSONSchema
41
41
  ?http_options: HttpOptions?
42
42
  ) -> Validator
43
43
 
44
+ # Create a map of validators for all sub-schemas in a JSON Schema.
45
+ def self.validator_map_for: (
46
+ untyped schema,
47
+ ?validate_formats: bool?,
48
+ ?ignore_unknown_formats: bool?,
49
+ ?mask: ::String?,
50
+ ?base_uri: ::String?,
51
+ ?retriever: (^(::String) -> untyped)?,
52
+ ?registry: Registry?,
53
+ ?formats: ::Hash[::String, ^(::String) -> bool]?,
54
+ ?keywords: ::Hash[::String, untyped]?,
55
+ ?pattern_options: (RegexOptions | FancyRegexOptions)?,
56
+ ?email_options: EmailOptions?,
57
+ ?http_options: HttpOptions?
58
+ ) -> ValidatorMap
59
+
44
60
  # Bundle a JSON Schema into a Compound Schema Document.
45
61
  # All externally-referenced schemas reachable via $ref are embedded in a
46
62
  # draft-appropriate container (definitions for Draft 4/6/7, $defs for
@@ -54,6 +70,16 @@ module JSONSchema
54
70
  ?base_uri: String?
55
71
  ) -> Hash[String, untyped]
56
72
 
73
+ # Dereference a JSON Schema by recursively replacing all $ref values
74
+ # with the schemas they point to.
75
+ def self.dereference: (
76
+ untyped schema,
77
+ ?draft: draft?,
78
+ ?retriever: (^(String) -> untyped)?,
79
+ ?registry: Registry?,
80
+ ?base_uri: String?
81
+ ) -> untyped
82
+
57
83
  # Detect the JSON Schema draft for a schema and return the corresponding validator class.
58
84
  # Draft is detected automatically from the `$schema` field. Defaults to Draft202012Validator.
59
85
  def self.validator_cls_for: (untyped schema) -> (singleton(Draft4Validator) | singleton(Draft6Validator) | singleton(Draft7Validator) | singleton(Draft201909Validator) | singleton(Draft202012Validator))
@@ -165,6 +191,16 @@ module JSONSchema
165
191
  end
166
192
  public
167
193
 
194
+ # Map of validators for all sub-schemas in a JSON Schema, keyed by JSON Pointer.
195
+ class ValidatorMap
196
+ def []: (::String pointer) -> Validator?
197
+ def fetch: (::String pointer) -> Validator
198
+ def key?: (::String pointer) -> bool
199
+ def keys: () -> ::Array[::String]
200
+ def length: () -> ::Integer
201
+ def size: () -> ::Integer
202
+ end
203
+
168
204
  # JSON Schema Draft 4 validator.
169
205
  class Draft4Validator < Validator
170
206
  end
@@ -281,6 +317,20 @@ module JSONSchema
281
317
  def inspect: () -> String
282
318
  end
283
319
 
320
+ # Resolver for JSON Schema references.
321
+ class Resolver
322
+ def base_uri: () -> String
323
+ def dynamic_scope: () -> Array[String]
324
+ def lookup: (String reference) -> Resolved
325
+ end
326
+
327
+ # Resolved reference containing the dereferenced schema and its context.
328
+ class Resolved
329
+ def contents: () -> untyped
330
+ def resolver: () -> Resolver
331
+ def draft: () -> Integer
332
+ end
333
+
284
334
  # Schema registry for reference resolution.
285
335
  class Registry
286
336
  # Create a registry from URI/schema pairs.
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.45.1
4
+ version: 0.46.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-04-06 00:00:00.000000000 Z
11
+ date: 2026-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal