jsonschema_rs 0.48.5 → 0.49.0
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 +4 -4
- data/CHANGELOG.md +22 -1
- data/Cargo.toml +2 -2
- data/ext/jsonschema/Cargo.lock +15 -13
- data/ext/jsonschema/Cargo.toml +3 -3
- data/lib/jsonschema/version.rb +1 -1
- data/sig/jsonschema.rbs +53 -4
- data/src/canonical.rs +492 -14
- data/src/lib.rs +110 -295
- data/src/options.rs +24 -21
- data/src/validator_map.rs +1 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5089bd59db447c9dd706a0fcaf832dac6832d5be6662e988b7a386c8cd31e6b0
|
|
4
|
+
data.tar.gz: ed3f7c83e18c5b8eea755a6a814106693ac729a11325946e878daca82afa0a32
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f15778547054d8aa3e988d34db28fa5144ed87821f4be792120366dc93ff3f2ae908f64610e72047f111f10617187ea6d0debd859be1cb5de11756af8bf874a0
|
|
7
|
+
data.tar.gz: 5d9f288ab525665571492a9e6a8f7846b01dc07f78cee128a998777edcfcb2fb8977dcab97735c4bbbb1634f6f3e350904ec9c1d4e1d987de3c86fefc030f24b
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.49.0] - 2026-07-25
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **EXPERIMENTAL**: Schema canonicalization via `jsonschema::canonicalize`. It reduces a reasonable subset of JSON Schemas to their normal forms.
|
|
10
|
+
- Validation of recursive Ruby objects.
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Invalid UTF-8, unsupported types, and nesting past the depth limit are reported only where a keyword reads the value.
|
|
15
|
+
- A hash keyed by both `:name` and `"name"` counts two properties (it previously collapsed them into one).
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- `multipleOf` incorrectly accepted integers past `u64` that are not multiples of the divisor.
|
|
20
|
+
|
|
21
|
+
### Performance
|
|
22
|
+
|
|
23
|
+
- Up to 3x faster validation by working on Ruby objects directly instead of converting them to `serde_json`. [#239](https://github.com/Stranger6667/jsonschema/issues/239)
|
|
24
|
+
|
|
5
25
|
## [0.48.5] - 2026-07-22
|
|
6
26
|
|
|
7
27
|
### Performance
|
|
@@ -199,7 +219,8 @@
|
|
|
199
219
|
|
|
200
220
|
- Initial public release
|
|
201
221
|
|
|
202
|
-
[Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.
|
|
222
|
+
[Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.49.0...HEAD
|
|
223
|
+
[0.49.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.5...ruby-v0.49.0
|
|
203
224
|
[0.48.5]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.2...ruby-v0.48.5
|
|
204
225
|
[0.48.2]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.1...ruby-v0.48.2
|
|
205
226
|
[0.48.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.48.0...ruby-v0.48.1
|
data/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "jsonschema-rb"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.49.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
authors = ["Dmitry Dygalo <dmitry@dygalo.dev>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -13,7 +13,7 @@ publish = false
|
|
|
13
13
|
crate-type = ["cdylib"]
|
|
14
14
|
|
|
15
15
|
[dependencies]
|
|
16
|
-
jsonschema = { version = "0.
|
|
16
|
+
jsonschema = { version = "0.49.0", default-features = false, features = ["magnus", "arbitrary-precision", "resolve-http", "resolve-file", "tls-ring", "macros"] }
|
|
17
17
|
magnus = { version = "0.8", features = ["rb-sys"] }
|
|
18
18
|
rb-sys = "0.9"
|
|
19
19
|
serde = { workspace = true }
|
data/ext/jsonschema/Cargo.lock
CHANGED
|
@@ -693,9 +693,9 @@ dependencies = [
|
|
|
693
693
|
|
|
694
694
|
[[package]]
|
|
695
695
|
name = "jsonschema"
|
|
696
|
-
version = "0.
|
|
696
|
+
version = "0.49.0"
|
|
697
697
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
698
|
-
checksum = "
|
|
698
|
+
checksum = "9eb9cf6891f8d15a89f7bcf8e812a62efef1fd8d9e7e4522f455875a1224875a"
|
|
699
699
|
dependencies = [
|
|
700
700
|
"ahash",
|
|
701
701
|
"bytecount",
|
|
@@ -726,9 +726,9 @@ dependencies = [
|
|
|
726
726
|
|
|
727
727
|
[[package]]
|
|
728
728
|
name = "jsonschema-macros"
|
|
729
|
-
version = "0.
|
|
729
|
+
version = "0.49.0"
|
|
730
730
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
731
|
-
checksum = "
|
|
731
|
+
checksum = "78fac461293b8d5484a845adbbfaa263ae76616ceae93283baaa4621736f9c54"
|
|
732
732
|
dependencies = [
|
|
733
733
|
"jsonschema-macros-core",
|
|
734
734
|
"proc-macro2",
|
|
@@ -736,9 +736,9 @@ dependencies = [
|
|
|
736
736
|
|
|
737
737
|
[[package]]
|
|
738
738
|
name = "jsonschema-macros-core"
|
|
739
|
-
version = "0.
|
|
739
|
+
version = "0.49.0"
|
|
740
740
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
741
|
-
checksum = "
|
|
741
|
+
checksum = "937a50f77ead02f355faec45d36f0b739da183857002af4f3a2759451dc9aec3"
|
|
742
742
|
dependencies = [
|
|
743
743
|
"fancy-regex",
|
|
744
744
|
"indexmap",
|
|
@@ -755,7 +755,7 @@ dependencies = [
|
|
|
755
755
|
|
|
756
756
|
[[package]]
|
|
757
757
|
name = "jsonschema-rb-ext"
|
|
758
|
-
version = "0.
|
|
758
|
+
version = "0.49.0"
|
|
759
759
|
dependencies = [
|
|
760
760
|
"jsonschema",
|
|
761
761
|
"magnus",
|
|
@@ -768,25 +768,27 @@ dependencies = [
|
|
|
768
768
|
|
|
769
769
|
[[package]]
|
|
770
770
|
name = "jsonschema-regex"
|
|
771
|
-
version = "0.
|
|
771
|
+
version = "0.49.0"
|
|
772
772
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
773
|
-
checksum = "
|
|
773
|
+
checksum = "b70811da032e736899c5045ee30f069ba241676739e6ed042c1f9ddd3ad47cde"
|
|
774
774
|
dependencies = [
|
|
775
775
|
"regex-syntax",
|
|
776
776
|
]
|
|
777
777
|
|
|
778
778
|
[[package]]
|
|
779
779
|
name = "jsonschema-value"
|
|
780
|
-
version = "0.
|
|
780
|
+
version = "0.49.0"
|
|
781
781
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
782
|
-
checksum = "
|
|
782
|
+
checksum = "5ceacf7ad8e9a1f6229a1354dc0ab238855623d219b6abf0a001c138241ec530"
|
|
783
783
|
dependencies = [
|
|
784
784
|
"ahash",
|
|
785
785
|
"bytecount",
|
|
786
786
|
"fraction",
|
|
787
|
+
"magnus",
|
|
787
788
|
"num-bigint",
|
|
788
789
|
"num-cmp",
|
|
789
790
|
"num-traits",
|
|
791
|
+
"rb-sys",
|
|
790
792
|
"serde_json",
|
|
791
793
|
]
|
|
792
794
|
|
|
@@ -1130,9 +1132,9 @@ dependencies = [
|
|
|
1130
1132
|
|
|
1131
1133
|
[[package]]
|
|
1132
1134
|
name = "referencing"
|
|
1133
|
-
version = "0.
|
|
1135
|
+
version = "0.49.0"
|
|
1134
1136
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1135
|
-
checksum = "
|
|
1137
|
+
checksum = "cbded44c4882a15738bd1bba376609f679292d758c0b3c389a2ef4a0ea6ce9b7"
|
|
1136
1138
|
dependencies = [
|
|
1137
1139
|
"ahash",
|
|
1138
1140
|
"fluent-uri",
|
data/ext/jsonschema/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "jsonschema-rb-ext"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.49.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
publish = false
|
|
6
6
|
|
|
@@ -10,10 +10,10 @@ name = "jsonschema_rb"
|
|
|
10
10
|
path = "../../src/lib.rs"
|
|
11
11
|
|
|
12
12
|
[dependencies]
|
|
13
|
-
jsonschema = { version = "0.
|
|
13
|
+
jsonschema = { version = "0.49.0", default-features = false, features = ["magnus", "arbitrary-precision", "resolve-http", "resolve-file", "tls-ring", "macros"] }
|
|
14
14
|
magnus = { version = "0.8", features = ["rb-sys"] }
|
|
15
15
|
rb-sys = "0.9"
|
|
16
|
-
referencing = "0.
|
|
16
|
+
referencing = "0.49.0"
|
|
17
17
|
serde = { version = "1", features = ["derive"] }
|
|
18
18
|
serde_json = { version = "1", features = ["arbitrary_precision"] }
|
|
19
19
|
zmij = "1"
|
data/lib/jsonschema/version.rb
CHANGED
data/sig/jsonschema.rbs
CHANGED
|
@@ -16,11 +16,12 @@ module JSONSchema
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# Structural discriminant of a canonical schema, one per view class.
|
|
19
|
-
type kind = :multi_type | :typed_group | :string | :integer | :
|
|
20
|
-
| :any_of | :true | :false | :raw
|
|
19
|
+
type kind = :multi_type | :typed_group | :string | :integer | :number | :array
|
|
20
|
+
| :object | :const | :enum | :any_of | :true | :false | :raw
|
|
21
21
|
|
|
22
22
|
type view = TrueView | FalseView | MultiTypeView | TypedGroupView | StringView
|
|
23
|
-
| IntegerView |
|
|
23
|
+
| IntegerView | NumberView | ArrayView | ObjectView | AnyOfView
|
|
24
|
+
| ConstView | EnumView | RawView
|
|
24
25
|
|
|
25
26
|
class CanonicalizationError < StandardError
|
|
26
27
|
end
|
|
@@ -70,14 +71,62 @@ module JSONSchema
|
|
|
70
71
|
def min_length: () -> Integer?
|
|
71
72
|
def max_length: () -> Integer?
|
|
72
73
|
def patterns: () -> Array[String]
|
|
74
|
+
def formats: () -> Array[String]
|
|
75
|
+
def content_media_types: () -> Array[String]
|
|
76
|
+
def content_encodings: () -> Array[String]
|
|
73
77
|
def inspect: () -> String
|
|
74
78
|
def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
|
|
75
79
|
end
|
|
76
80
|
|
|
77
|
-
#
|
|
81
|
+
# A number value within a real interval.
|
|
82
|
+
class NumberView
|
|
83
|
+
def minimum: () -> (Integer | Float)?
|
|
84
|
+
def exclusive_minimum: () -> bool
|
|
85
|
+
def maximum: () -> (Integer | Float)?
|
|
86
|
+
def exclusive_maximum: () -> bool
|
|
87
|
+
def multiple_of: () -> Array[Integer | Float]
|
|
88
|
+
def inspect: () -> String
|
|
89
|
+
def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# An integer value within a closed interval, optionally a multiple of a divisor.
|
|
78
93
|
class IntegerView
|
|
79
94
|
def minimum: () -> Integer?
|
|
80
95
|
def maximum: () -> Integer?
|
|
96
|
+
def multiple_of: () -> Array[Integer | Float]
|
|
97
|
+
def inspect: () -> String
|
|
98
|
+
def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# An array value whose length is within a window.
|
|
102
|
+
class ArrayView
|
|
103
|
+
def min_items: () -> Integer?
|
|
104
|
+
def max_items: () -> Integer?
|
|
105
|
+
def unique_items: () -> bool
|
|
106
|
+
def prefix_items: () -> Array[CanonicalSchema]
|
|
107
|
+
def items: () -> CanonicalSchema?
|
|
108
|
+
def contains: () -> Array[ContainsView]
|
|
109
|
+
def inspect: () -> String
|
|
110
|
+
def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# One `contains` demand of an array; an absent minimum spells the default of one.
|
|
114
|
+
class ContainsView
|
|
115
|
+
def schema: () -> CanonicalSchema
|
|
116
|
+
def min_contains: () -> Integer?
|
|
117
|
+
def max_contains: () -> Integer?
|
|
118
|
+
def inspect: () -> String
|
|
119
|
+
def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# An object value whose property count is within a window.
|
|
123
|
+
class ObjectView
|
|
124
|
+
def min_properties: () -> Integer?
|
|
125
|
+
def max_properties: () -> Integer?
|
|
126
|
+
def required: () -> Array[String]
|
|
127
|
+
def property_names: () -> CanonicalSchema?
|
|
128
|
+
def properties: () -> Hash[String, CanonicalSchema]
|
|
129
|
+
def pattern_properties: () -> Hash[String, CanonicalSchema]
|
|
81
130
|
def inspect: () -> String
|
|
82
131
|
def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
|
|
83
132
|
end
|