jsonschema_rs 0.42.2-aarch64-linux → 0.44.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: 021caf2f915f392daf60de381ba97591416e2bbdf1a62373d3d9290b88f8e095
4
- data.tar.gz: 918d7d998823717abcce53e3b08ced90567025a535d5888332d3795dddfa4419
3
+ metadata.gz: 84ea8e195e0e65bd7ef559d0935ef0b811299f95898236f639d990f9a3c117d7
4
+ data.tar.gz: 11a36ff821f4b265c03f920b72d1580d369f33345eef9db42abef6d05167b0f1
5
5
  SHA512:
6
- metadata.gz: f76bc26b78ad1e70ff97ef1164c0b9f88001f010660c8cb7da90e5dc997fb0d85a503002a57bff010dee5fc98b7deb0f3446f71a71b83a1b1ddc32983d140b4f
7
- data.tar.gz: 4634c084b338805ca2f90174c94c55dbf3bf23340c25704e02802de70db302d4c1a2521008eff8756d1228568bd77e4a844408032177b26fb26ecc0d307e2368
6
+ metadata.gz: 586985fa0231b57791b6535b1dbaf11c04e7af6a238ccee6c2efac69dc50a083f9b05c480d247fd5de46fdf33743d1e5600cc7e2a834f753faaae90d0daa24e8
7
+ data.tar.gz: b6c6e2c59bc92ef455512237929d6aee01f236141c1fe0b0ad4ef860fb0630a49d814d9b1bd1805d519ecd51fe79b5b61d0ab086672f25d82c0d802f240f5e62
data/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.44.0] - 2026-03-02
6
+
7
+ ### Added
8
+
9
+ - `Canonical::JSON.to_string(object)` for canonical JSON serialization (stable key ordering and numeric normalization), useful for deduplicating equivalent JSON Schemas.
10
+
11
+ ### Fixed
12
+
13
+ - Do not produce annotations for non-string instances from `contentMediaType`, `contentEncoding`, and `contentSchema` keywords.
14
+
15
+ ## [0.43.0] - 2026-02-28
16
+
17
+ ### Added
18
+
19
+ - `validator_cls_for(schema)` function to detect and return the appropriate validator class for a schema.
20
+
21
+ ### Fixed
22
+
23
+ - `anyOf`, `format`, `unevaluatedProperties`, and `unevaluatedItems` now correctly collect annotations per spec.
24
+
25
+ ### Performance
26
+
27
+ - Optimize `pattern` and `patternProperties` for `^(a|b|c)$` alternations via linear array scan.
28
+ - Optimize `^\S*$` patterns by replacing regex with a direct ECMA-262 whitespace check.
29
+
5
30
  ## [0.42.2] - 2026-02-26
6
31
 
7
32
  ### Changed
@@ -28,6 +53,8 @@
28
53
 
29
54
  - Initial public release
30
55
 
31
- [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.42.2...HEAD
56
+ [Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.44.0...HEAD
57
+ [0.44.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.43.0...ruby-v0.44.0
58
+ [0.43.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.42.2...ruby-v0.43.0
32
59
  [0.42.2]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.42.1...ruby-v0.42.2
33
60
  [0.42.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.42.0...ruby-v0.42.1
data/README.md CHANGED
@@ -251,6 +251,22 @@ valid_eval.annotations
251
251
  # instanceLocation: "", annotations: ["age", "name"]}]
252
252
  ```
253
253
 
254
+ ### Canonical JSON serialization
255
+
256
+ Use `Canonical::JSON.to_string` when you need a stable JSON representation:
257
+
258
+ ```ruby
259
+ schema_a = { "type" => "object", "properties" => { "b" => { "type" => "integer" }, "a" => { "type" => "string" } } }
260
+ schema_b = { "properties" => { "a" => { "type" => "string" }, "b" => { "type" => "integer" } }, "type" => "object" }
261
+
262
+ dump_a = JSONSchema::Canonical::JSON.to_string(schema_a)
263
+ dump_b = JSONSchema::Canonical::JSON.to_string(schema_b)
264
+
265
+ dump_a == dump_b # => true
266
+ ```
267
+
268
+ Main use case: deduplicating equivalent JSON Schemas.
269
+
254
270
  ## Meta-Schema Validation
255
271
 
256
272
  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.42.2"
4
+ VERSION = "0.44.0"
5
5
  end
data/sig/jsonschema.rbs CHANGED
@@ -7,6 +7,15 @@ module JSONSchema
7
7
  # Valid draft version symbols
8
8
  type draft = :draft4 | :draft6 | :draft7 | :draft201909 | :draft202012
9
9
 
10
+ module Canonical
11
+ module JSON
12
+ # Serialize a Ruby value to canonical JSON.
13
+ #
14
+ # Main use case: deduplicate equivalent JSON Schemas by using a stable string form.
15
+ def self.to_string: (untyped object) -> String
16
+ end
17
+ end
18
+
10
19
  # Create a validator with auto-detected draft version.
11
20
  #
12
21
  # @param schema The JSON Schema (Hash or JSON string)
@@ -32,6 +41,10 @@ module JSONSchema
32
41
  ?http_options: HttpOptions?
33
42
  ) -> Validator
34
43
 
44
+ # Detect the JSON Schema draft for a schema and return the corresponding validator class.
45
+ # Draft is detected automatically from the `$schema` field. Defaults to Draft202012Validator.
46
+ def self.validator_cls_for: (untyped schema) -> (singleton(Draft4Validator) | singleton(Draft6Validator) | singleton(Draft7Validator) | singleton(Draft201909Validator) | singleton(Draft202012Validator))
47
+
35
48
  # One-off validation returning boolean.
36
49
  def self.valid?: (
37
50
  untyped schema,
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.42.2
4
+ version: 0.44.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-02-26 00:00:00.000000000 Z
11
+ date: 2026-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal