jsonschema_rs 0.49.4 → 0.49.5
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 +20 -1
- data/Cargo.toml +2 -2
- data/ext/jsonschema/Cargo.lock +17 -17
- data/ext/jsonschema/Cargo.toml +3 -3
- data/lib/jsonschema/version.rb +1 -1
- data/sig/jsonschema.rbs +6 -0
- data/src/canonical.rs +68 -7
- 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: 14182b3d65f8580de3c3c3b3dab17d0709a70e56b93b519a2095f0d87bbda232
|
|
4
|
+
data.tar.gz: c43c5b754ef7a41ff8ce3d06ab79f1f29854967446ee6efb76282af7c0186e98
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 503c06fb04a59e9ca5e38eeb0c360741a9d6a409e4dce784ade9babe4514f19fb1f4668b9f21538e661c5bed1d76600cd32ec92bd4c7d1daa8a6e147de4b3607
|
|
7
|
+
data.tar.gz: 53b2d54cbbb81a4b2ccba5eaa7a8cf8144f1597c3ccbf0abf55ba0fbee189a85634a936a5571af77d64e4a9351c04ec57f41867decb15b1404beeb93bc7a0abc
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.49.5] - 2026-08-05
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Canonicalization of `not` an integer schema under Draft 4, which the number leaf carries as barred integers.
|
|
10
|
+
- Canonicalization of `not` a `multipleOf`, which numeric leaves carry as barred divisors.
|
|
11
|
+
- Canonicalization of `not` an integer schema, where a barred divisor of one spells the non-integer numbers.
|
|
12
|
+
- Canonicalization of `not` a `pattern`, which string leaves carry as barred patterns.
|
|
13
|
+
- Canonicalization of `not` a typed value set under Draft 4, such as `{"type": "integer", "enum": [1, 2]}`.
|
|
14
|
+
- `CanonicalSchema#is_subset_of`, whether the other schema admits every value this one admits.
|
|
15
|
+
- Canonicalization of a reference cycle carrying no assertion, which admits every value.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- `CanonicalSchema#is_subset_of` failing to prove a union of array branches a subset of itself.
|
|
20
|
+
- Two spellings of one number canonicalizing to different texts when the fraction exceeds the expansion cap.
|
|
21
|
+
- Numeric bounds and `multipleOf` comparing values through a lossy `f64` conversion, such as `1e-400` passing `{"maximum": 0}`.
|
|
22
|
+
|
|
5
23
|
## [0.49.4] - 2026-08-04
|
|
6
24
|
|
|
7
25
|
### Added
|
|
@@ -286,7 +304,8 @@
|
|
|
286
304
|
|
|
287
305
|
- Initial public release
|
|
288
306
|
|
|
289
|
-
[Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.49.
|
|
307
|
+
[Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.49.5...HEAD
|
|
308
|
+
[0.49.5]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.49.4...ruby-v0.49.5
|
|
290
309
|
[0.49.4]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.49.3...ruby-v0.49.4
|
|
291
310
|
[0.49.3]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.49.2...ruby-v0.49.3
|
|
292
311
|
[0.49.2]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.49.1...ruby-v0.49.2
|
data/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "jsonschema-rb"
|
|
3
|
-
version = "0.49.
|
|
3
|
+
version = "0.49.5"
|
|
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.49.
|
|
16
|
+
jsonschema = { version = "0.49.5", 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
|
@@ -220,9 +220,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
|
|
220
220
|
|
|
221
221
|
[[package]]
|
|
222
222
|
name = "fancy-regex"
|
|
223
|
-
version = "0.
|
|
223
|
+
version = "0.19.0"
|
|
224
224
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
225
|
-
checksum = "
|
|
225
|
+
checksum = "476de73bddf2ef8490aa4ee8f1cf40b430bf1d56c48c22080e5186952cd580e6"
|
|
226
226
|
dependencies = [
|
|
227
227
|
"bit-set",
|
|
228
228
|
"regex-automata",
|
|
@@ -693,9 +693,9 @@ dependencies = [
|
|
|
693
693
|
|
|
694
694
|
[[package]]
|
|
695
695
|
name = "jsonschema"
|
|
696
|
-
version = "0.49.
|
|
696
|
+
version = "0.49.5"
|
|
697
697
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
698
|
-
checksum = "
|
|
698
|
+
checksum = "8da60094fc1968bbd091e2cfa004415cb7b19e25e592376e66a64aa832bb6039"
|
|
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.49.
|
|
729
|
+
version = "0.49.5"
|
|
730
730
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
731
|
-
checksum = "
|
|
731
|
+
checksum = "1575f559a96e0cd2b83afd25b868507d39b97e16af2ed7d23074c470b0259627"
|
|
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.49.
|
|
739
|
+
version = "0.49.5"
|
|
740
740
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
741
|
-
checksum = "
|
|
741
|
+
checksum = "4d2d8f4ec940ac30dc8e85787916ac6a9d34fcfa850b47ffe69205e837dee621"
|
|
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.49.
|
|
758
|
+
version = "0.49.5"
|
|
759
759
|
dependencies = [
|
|
760
760
|
"jsonschema",
|
|
761
761
|
"magnus",
|
|
@@ -768,18 +768,18 @@ dependencies = [
|
|
|
768
768
|
|
|
769
769
|
[[package]]
|
|
770
770
|
name = "jsonschema-regex"
|
|
771
|
-
version = "0.49.
|
|
771
|
+
version = "0.49.5"
|
|
772
772
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
773
|
-
checksum = "
|
|
773
|
+
checksum = "36539f34ef9e5da418433fbbf7294522d8f930ecf6a540ccd1ec6481c9ff9056"
|
|
774
774
|
dependencies = [
|
|
775
775
|
"regex-syntax",
|
|
776
776
|
]
|
|
777
777
|
|
|
778
778
|
[[package]]
|
|
779
779
|
name = "jsonschema-value"
|
|
780
|
-
version = "0.49.
|
|
780
|
+
version = "0.49.5"
|
|
781
781
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
782
|
-
checksum = "
|
|
782
|
+
checksum = "8bc513dfee68c6fe29498451df95a32951ea227801b476f4a1f236433986c891"
|
|
783
783
|
dependencies = [
|
|
784
784
|
"ahash",
|
|
785
785
|
"bytecount",
|
|
@@ -1132,9 +1132,9 @@ dependencies = [
|
|
|
1132
1132
|
|
|
1133
1133
|
[[package]]
|
|
1134
1134
|
name = "referencing"
|
|
1135
|
-
version = "0.49.
|
|
1135
|
+
version = "0.49.5"
|
|
1136
1136
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1137
|
-
checksum = "
|
|
1137
|
+
checksum = "05915176d843da9ec5c925e5e2631be9aa61b27430acfdd562e79cae8f559725"
|
|
1138
1138
|
dependencies = [
|
|
1139
1139
|
"ahash",
|
|
1140
1140
|
"fluent-uri",
|
|
@@ -1161,9 +1161,9 @@ dependencies = [
|
|
|
1161
1161
|
|
|
1162
1162
|
[[package]]
|
|
1163
1163
|
name = "regex-automata"
|
|
1164
|
-
version = "0.4.
|
|
1164
|
+
version = "0.4.18"
|
|
1165
1165
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1166
|
-
checksum = "
|
|
1166
|
+
checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
|
|
1167
1167
|
dependencies = [
|
|
1168
1168
|
"aho-corasick",
|
|
1169
1169
|
"memchr",
|
data/ext/jsonschema/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "jsonschema-rb-ext"
|
|
3
|
-
version = "0.49.
|
|
3
|
+
version = "0.49.5"
|
|
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.49.
|
|
13
|
+
jsonschema = { version = "0.49.5", 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.49.
|
|
16
|
+
referencing = "0.49.5"
|
|
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
|
@@ -45,6 +45,7 @@ module JSONSchema
|
|
|
45
45
|
def kind: () -> kind
|
|
46
46
|
def view: () -> view
|
|
47
47
|
def intersect: (CanonicalSchema other) -> CanonicalSchema
|
|
48
|
+
def is_subset_of: (CanonicalSchema other) -> bool?
|
|
48
49
|
def negate: () -> CanonicalSchema?
|
|
49
50
|
def definition: (String uri) -> CanonicalSchema?
|
|
50
51
|
def definitions: () -> Hash[String, CanonicalSchema]
|
|
@@ -83,7 +84,9 @@ module JSONSchema
|
|
|
83
84
|
def min_length: () -> Integer?
|
|
84
85
|
def max_length: () -> Integer?
|
|
85
86
|
def patterns: () -> Array[String]
|
|
87
|
+
def excluded_patterns: () -> Array[String]
|
|
86
88
|
def formats: () -> Array[String]
|
|
89
|
+
def excluded_formats: () -> Array[String]
|
|
87
90
|
def content_media_types: () -> Array[String]
|
|
88
91
|
def content_encodings: () -> Array[String]
|
|
89
92
|
def excluded: () -> Array[String]
|
|
@@ -98,6 +101,8 @@ module JSONSchema
|
|
|
98
101
|
def maximum: () -> (Integer | Float)?
|
|
99
102
|
def exclusive_maximum: () -> bool
|
|
100
103
|
def multiple_of: () -> Array[Integer | Float]
|
|
104
|
+
def not_multiple_of: () -> Array[Integer | Float]
|
|
105
|
+
def excludes_integers: () -> bool
|
|
101
106
|
def inspect: () -> String
|
|
102
107
|
def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
|
|
103
108
|
end
|
|
@@ -107,6 +112,7 @@ module JSONSchema
|
|
|
107
112
|
def minimum: () -> Integer?
|
|
108
113
|
def maximum: () -> Integer?
|
|
109
114
|
def multiple_of: () -> Array[Integer | Float]
|
|
115
|
+
def not_multiple_of: () -> Array[Integer | Float]
|
|
110
116
|
def inspect: () -> String
|
|
111
117
|
def deconstruct_keys: (untyped keys) -> Hash[Symbol, untyped]
|
|
112
118
|
end
|
data/src/canonical.rs
CHANGED
|
@@ -148,6 +148,7 @@ impl RbCanonicalSchema {
|
|
|
148
148
|
min_length: view.min_length,
|
|
149
149
|
max_length: view.max_length,
|
|
150
150
|
patterns: view.patterns,
|
|
151
|
+
excluded_patterns: view.excluded_patterns,
|
|
151
152
|
formats: view.formats,
|
|
152
153
|
excluded_formats: view.excluded_formats,
|
|
153
154
|
content_media_types: view.content_media_types,
|
|
@@ -162,6 +163,8 @@ impl RbCanonicalSchema {
|
|
|
162
163
|
maximum: view.maximum,
|
|
163
164
|
exclusive_maximum: view.exclusive_maximum,
|
|
164
165
|
multiple_of: view.multiple_of,
|
|
166
|
+
not_multiple_of: view.not_multiple_of,
|
|
167
|
+
excludes_integers: view.excludes_integers,
|
|
165
168
|
})
|
|
166
169
|
.as_value(),
|
|
167
170
|
CanonicalView::Integer(view) => ruby
|
|
@@ -169,6 +172,7 @@ impl RbCanonicalSchema {
|
|
|
169
172
|
minimum: view.minimum,
|
|
170
173
|
maximum: view.maximum,
|
|
171
174
|
multiple_of: view.multiple_of,
|
|
175
|
+
not_multiple_of: view.not_multiple_of,
|
|
172
176
|
})
|
|
173
177
|
.as_value(),
|
|
174
178
|
CanonicalView::Array(view) => ruby
|
|
@@ -209,6 +213,13 @@ impl RbCanonicalSchema {
|
|
|
209
213
|
.map_err(|error| canonicalization_error(ruby, error))
|
|
210
214
|
}
|
|
211
215
|
|
|
216
|
+
fn is_subset_of(ruby: &Ruby, rb_self: &Self, other: &Self) -> Result<Option<bool>, Error> {
|
|
217
|
+
rb_self
|
|
218
|
+
.inner
|
|
219
|
+
.is_subset_of(&other.inner)
|
|
220
|
+
.map_err(|error| canonicalization_error(ruby, error))
|
|
221
|
+
}
|
|
222
|
+
|
|
212
223
|
fn negate(ruby: &Ruby, rb_self: &Self) -> Option<Value> {
|
|
213
224
|
rb_self
|
|
214
225
|
.inner
|
|
@@ -387,14 +398,14 @@ fn strings_to_ruby(ruby: &Ruby, values: &[String]) -> Result<Value, Error> {
|
|
|
387
398
|
Ok(array.as_value())
|
|
388
399
|
}
|
|
389
400
|
|
|
390
|
-
/// A string value within a length window, matching every
|
|
391
|
-
/// encoding.
|
|
401
|
+
/// A string value within a length window, matching every required facet and no barred one.
|
|
392
402
|
#[derive(magnus::TypedData)]
|
|
393
403
|
#[magnus(class = "JSONSchema::Canonical::StringView", free_immediately)]
|
|
394
404
|
pub struct StringView {
|
|
395
405
|
min_length: Option<serde_json::Number>,
|
|
396
406
|
max_length: Option<serde_json::Number>,
|
|
397
407
|
patterns: Vec<String>,
|
|
408
|
+
excluded_patterns: Vec<String>,
|
|
398
409
|
formats: Vec<String>,
|
|
399
410
|
excluded_formats: Vec<String>,
|
|
400
411
|
content_media_types: Vec<String>,
|
|
@@ -417,6 +428,10 @@ impl StringView {
|
|
|
417
428
|
strings_to_ruby(ruby, &rb_self.patterns)
|
|
418
429
|
}
|
|
419
430
|
|
|
431
|
+
fn excluded_patterns(ruby: &Ruby, rb_self: &Self) -> Result<Value, Error> {
|
|
432
|
+
strings_to_ruby(ruby, &rb_self.excluded_patterns)
|
|
433
|
+
}
|
|
434
|
+
|
|
420
435
|
fn formats(ruby: &Ruby, rb_self: &Self) -> Result<Value, Error> {
|
|
421
436
|
strings_to_ruby(ruby, &rb_self.formats)
|
|
422
437
|
}
|
|
@@ -439,10 +454,11 @@ impl StringView {
|
|
|
439
454
|
|
|
440
455
|
fn inspect(ruby: &Ruby, rb_self: &Self) -> Result<String, Error> {
|
|
441
456
|
Ok(format!(
|
|
442
|
-
"#<JSONSchema::Canonical::StringView min_length={} max_length={} patterns={} formats={} excluded_formats={} content_media_types={} content_encodings={} excluded={}>",
|
|
457
|
+
"#<JSONSchema::Canonical::StringView min_length={} max_length={} patterns={} excluded_patterns={} formats={} excluded_formats={} content_media_types={} content_encodings={} excluded={}>",
|
|
443
458
|
Self::min_length(ruby, rb_self)?.inspect(),
|
|
444
459
|
Self::max_length(ruby, rb_self)?.inspect(),
|
|
445
460
|
Self::patterns(ruby, rb_self)?.inspect(),
|
|
461
|
+
Self::excluded_patterns(ruby, rb_self)?.inspect(),
|
|
446
462
|
Self::formats(ruby, rb_self)?.inspect(),
|
|
447
463
|
Self::excluded_formats(ruby, rb_self)?.inspect(),
|
|
448
464
|
Self::content_media_types(ruby, rb_self)?.inspect(),
|
|
@@ -456,6 +472,10 @@ impl StringView {
|
|
|
456
472
|
hash.aset(ruby.sym_new("min_length"), Self::min_length(ruby, rb_self)?)?;
|
|
457
473
|
hash.aset(ruby.sym_new("max_length"), Self::max_length(ruby, rb_self)?)?;
|
|
458
474
|
hash.aset(ruby.sym_new("patterns"), Self::patterns(ruby, rb_self)?)?;
|
|
475
|
+
hash.aset(
|
|
476
|
+
ruby.sym_new("excluded_patterns"),
|
|
477
|
+
Self::excluded_patterns(ruby, rb_self)?,
|
|
478
|
+
)?;
|
|
459
479
|
hash.aset(ruby.sym_new("formats"), Self::formats(ruby, rb_self)?)?;
|
|
460
480
|
hash.aset(
|
|
461
481
|
ruby.sym_new("excluded_formats"),
|
|
@@ -483,6 +503,8 @@ pub struct NumberView {
|
|
|
483
503
|
maximum: Option<serde_json::Number>,
|
|
484
504
|
exclusive_maximum: bool,
|
|
485
505
|
multiple_of: Vec<serde_json::Number>,
|
|
506
|
+
not_multiple_of: Vec<serde_json::Number>,
|
|
507
|
+
excludes_integers: bool,
|
|
486
508
|
}
|
|
487
509
|
|
|
488
510
|
impl DataTypeFunctions for NumberView {}
|
|
@@ -508,14 +530,24 @@ impl NumberView {
|
|
|
508
530
|
divisors_to_ruby(ruby, &rb_self.multiple_of)
|
|
509
531
|
}
|
|
510
532
|
|
|
533
|
+
fn not_multiple_of(ruby: &Ruby, rb_self: &Self) -> Result<Value, Error> {
|
|
534
|
+
divisors_to_ruby(ruby, &rb_self.not_multiple_of)
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
fn excludes_integers(ruby: &Ruby, rb_self: &Self) -> Value {
|
|
538
|
+
ruby.into_value(rb_self.excludes_integers)
|
|
539
|
+
}
|
|
540
|
+
|
|
511
541
|
fn inspect(ruby: &Ruby, rb_self: &Self) -> Result<String, Error> {
|
|
512
542
|
Ok(format!(
|
|
513
|
-
"#<JSONSchema::Canonical::NumberView minimum={} exclusive_minimum={} maximum={} exclusive_maximum={} multiple_of={}>",
|
|
543
|
+
"#<JSONSchema::Canonical::NumberView minimum={} exclusive_minimum={} maximum={} exclusive_maximum={} multiple_of={} not_multiple_of={} excludes_integers={}>",
|
|
514
544
|
Self::minimum(ruby, rb_self)?.inspect(),
|
|
515
545
|
Self::exclusive_minimum(ruby, rb_self).inspect(),
|
|
516
546
|
Self::maximum(ruby, rb_self)?.inspect(),
|
|
517
547
|
Self::exclusive_maximum(ruby, rb_self).inspect(),
|
|
518
|
-
Self::multiple_of(ruby, rb_self)?.inspect()
|
|
548
|
+
Self::multiple_of(ruby, rb_self)?.inspect(),
|
|
549
|
+
Self::not_multiple_of(ruby, rb_self)?.inspect(),
|
|
550
|
+
Self::excludes_integers(ruby, rb_self).inspect()
|
|
519
551
|
))
|
|
520
552
|
}
|
|
521
553
|
|
|
@@ -535,6 +567,14 @@ impl NumberView {
|
|
|
535
567
|
ruby.sym_new("multiple_of"),
|
|
536
568
|
Self::multiple_of(ruby, rb_self)?,
|
|
537
569
|
)?;
|
|
570
|
+
hash.aset(
|
|
571
|
+
ruby.sym_new("not_multiple_of"),
|
|
572
|
+
Self::not_multiple_of(ruby, rb_self)?,
|
|
573
|
+
)?;
|
|
574
|
+
hash.aset(
|
|
575
|
+
ruby.sym_new("excludes_integers"),
|
|
576
|
+
Self::excludes_integers(ruby, rb_self),
|
|
577
|
+
)?;
|
|
538
578
|
Ok(hash)
|
|
539
579
|
}
|
|
540
580
|
}
|
|
@@ -546,6 +586,7 @@ pub struct IntegerView {
|
|
|
546
586
|
minimum: Option<serde_json::Number>,
|
|
547
587
|
maximum: Option<serde_json::Number>,
|
|
548
588
|
multiple_of: Vec<serde_json::Number>,
|
|
589
|
+
not_multiple_of: Vec<serde_json::Number>,
|
|
549
590
|
}
|
|
550
591
|
|
|
551
592
|
impl DataTypeFunctions for IntegerView {}
|
|
@@ -563,12 +604,17 @@ impl IntegerView {
|
|
|
563
604
|
divisors_to_ruby(ruby, &rb_self.multiple_of)
|
|
564
605
|
}
|
|
565
606
|
|
|
607
|
+
fn not_multiple_of(ruby: &Ruby, rb_self: &Self) -> Result<Value, Error> {
|
|
608
|
+
divisors_to_ruby(ruby, &rb_self.not_multiple_of)
|
|
609
|
+
}
|
|
610
|
+
|
|
566
611
|
fn inspect(ruby: &Ruby, rb_self: &Self) -> Result<String, Error> {
|
|
567
612
|
Ok(format!(
|
|
568
|
-
"#<JSONSchema::Canonical::IntegerView minimum={} maximum={} multiple_of={}>",
|
|
613
|
+
"#<JSONSchema::Canonical::IntegerView minimum={} maximum={} multiple_of={} not_multiple_of={}>",
|
|
569
614
|
Self::minimum(ruby, rb_self)?.inspect(),
|
|
570
615
|
Self::maximum(ruby, rb_self)?.inspect(),
|
|
571
|
-
Self::multiple_of(ruby, rb_self)?.inspect()
|
|
616
|
+
Self::multiple_of(ruby, rb_self)?.inspect(),
|
|
617
|
+
Self::not_multiple_of(ruby, rb_self)?.inspect()
|
|
572
618
|
))
|
|
573
619
|
}
|
|
574
620
|
|
|
@@ -580,6 +626,10 @@ impl IntegerView {
|
|
|
580
626
|
ruby.sym_new("multiple_of"),
|
|
581
627
|
Self::multiple_of(ruby, rb_self)?,
|
|
582
628
|
)?;
|
|
629
|
+
hash.aset(
|
|
630
|
+
ruby.sym_new("not_multiple_of"),
|
|
631
|
+
Self::not_multiple_of(ruby, rb_self)?,
|
|
632
|
+
)?;
|
|
583
633
|
Ok(hash)
|
|
584
634
|
}
|
|
585
635
|
}
|
|
@@ -1155,6 +1205,7 @@ pub(crate) fn init_canonical(ruby: &Ruby, module: &RModule) -> Result<(), Error>
|
|
|
1155
1205
|
)?;
|
|
1156
1206
|
canonical_schema.define_method("view", method!(RbCanonicalSchema::view, 0))?;
|
|
1157
1207
|
canonical_schema.define_method("intersect", method!(RbCanonicalSchema::intersect, 1))?;
|
|
1208
|
+
canonical_schema.define_method("is_subset_of", method!(RbCanonicalSchema::is_subset_of, 1))?;
|
|
1158
1209
|
canonical_schema.define_method("negate", method!(RbCanonicalSchema::negate, 0))?;
|
|
1159
1210
|
canonical_schema.define_method("definition", method!(RbCanonicalSchema::definition, 1))?;
|
|
1160
1211
|
canonical_schema.define_method("definitions", method!(RbCanonicalSchema::definitions, 0))?;
|
|
@@ -1196,6 +1247,10 @@ pub(crate) fn init_canonical(ruby: &Ruby, module: &RModule) -> Result<(), Error>
|
|
|
1196
1247
|
string_view.define_method("min_length", method!(StringView::min_length, 0))?;
|
|
1197
1248
|
string_view.define_method("max_length", method!(StringView::max_length, 0))?;
|
|
1198
1249
|
string_view.define_method("patterns", method!(StringView::patterns, 0))?;
|
|
1250
|
+
string_view.define_method(
|
|
1251
|
+
"excluded_patterns",
|
|
1252
|
+
method!(StringView::excluded_patterns, 0),
|
|
1253
|
+
)?;
|
|
1199
1254
|
string_view.define_method("formats", method!(StringView::formats, 0))?;
|
|
1200
1255
|
string_view.define_method("excluded_formats", method!(StringView::excluded_formats, 0))?;
|
|
1201
1256
|
string_view.define_method(
|
|
@@ -1222,6 +1277,11 @@ pub(crate) fn init_canonical(ruby: &Ruby, module: &RModule) -> Result<(), Error>
|
|
|
1222
1277
|
method!(NumberView::exclusive_maximum, 0),
|
|
1223
1278
|
)?;
|
|
1224
1279
|
number_view.define_method("multiple_of", method!(NumberView::multiple_of, 0))?;
|
|
1280
|
+
number_view.define_method("not_multiple_of", method!(NumberView::not_multiple_of, 0))?;
|
|
1281
|
+
number_view.define_method(
|
|
1282
|
+
"excludes_integers",
|
|
1283
|
+
method!(NumberView::excludes_integers, 0),
|
|
1284
|
+
)?;
|
|
1225
1285
|
number_view.define_method("inspect", method!(NumberView::inspect, 0))?;
|
|
1226
1286
|
number_view.define_method("deconstruct_keys", method!(NumberView::deconstruct_keys, 1))?;
|
|
1227
1287
|
|
|
@@ -1229,6 +1289,7 @@ pub(crate) fn init_canonical(ruby: &Ruby, module: &RModule) -> Result<(), Error>
|
|
|
1229
1289
|
integer_view.define_method("minimum", method!(IntegerView::minimum, 0))?;
|
|
1230
1290
|
integer_view.define_method("maximum", method!(IntegerView::maximum, 0))?;
|
|
1231
1291
|
integer_view.define_method("multiple_of", method!(IntegerView::multiple_of, 0))?;
|
|
1292
|
+
integer_view.define_method("not_multiple_of", method!(IntegerView::not_multiple_of, 0))?;
|
|
1232
1293
|
integer_view.define_method("inspect", method!(IntegerView::inspect, 0))?;
|
|
1233
1294
|
integer_view.define_method(
|
|
1234
1295
|
"deconstruct_keys",
|