jsonschema_rs 0.50.0 → 0.51.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 +48 -1
- data/Cargo.toml +2 -2
- data/README.md +3 -0
- 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 +11 -2
- data/src/lib.rs +1 -0
- data/src/options.rs +19 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7cc0c8312d2b960d018cd1a8eda7e8db2ae74eee48bfd4328e3040e479db2a9d
|
|
4
|
+
data.tar.gz: 9149b6d196c3c7ca1b27ed2d12c433b2cdcc46ab1f665aea3e04e3186e901ede
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c380d68065992826531bf42fa03d9a200fdf20cd2a43e5fd8f35212cdad2d88a4e4b3e67f806171c1a7dd6cc3b78eff2f2af19276ccb1bec91d6f0c658587e73
|
|
7
|
+
data.tar.gz: 4f73fb65388571245b79a05cba80b74be5dafd2ef70073310aacbcbb76ce63dbe71abd5e6f90140752dffca4b32d0693723b7e94dc88c9371d168b734bfee6aa
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.51.0] - 2026-08-23
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `vocabularies` option, declaring support for a vocabulary this library does not implement.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- The `uniqueItems` length ceiling not reading an `items` or `contains` schema written as a `$ref`.
|
|
14
|
+
- The Draft 2020-12 Format-Assertion vocabulary read as an annotation, so a meta-schema requiring it accepted values its `format` rejects.
|
|
15
|
+
- An unrecognized `format` accepted under a meta-schema requiring the Format-Assertion vocabulary (it should be rejected).
|
|
16
|
+
- A meta-schema requiring a vocabulary this library does not implement accepted (it should be rejected).
|
|
17
|
+
- The Draft 2019-09 Format vocabulary declared `true` read as an annotation, so a meta-schema requiring it accepted values its `format` rejects.
|
|
18
|
+
- The bundled `https://json-schema.org/draft/2020-12/meta/format-assertion` meta-schema not declaring its vocabulary, so a schema written against it annotated `format` instead of asserting it.
|
|
19
|
+
- A meta-schema without `$id` keeping its `$vocabulary` unread, so a schema written against it got every Draft 2020-12 vocabulary.
|
|
20
|
+
- A schema naming a bundled vocabulary meta-schema as its `$schema` rejected as an unknown meta-schema (it should build).
|
|
21
|
+
- The `regex` format reading the Rust regex dialect (it should read the ECMA-262 dialect in Unicode mode).
|
|
22
|
+
- The `uri-template` format rejecting an apostrophe in a literal (it should accept it, per RFC 6570 errata 6937).
|
|
23
|
+
- The `duration` format accepting weeks combined with a time part, such as `P1WT1H` (it should reject it).
|
|
24
|
+
- Stack overflow compiling `unevaluatedProperties` or `unevaluatedItems` beside a `$ref` that cycles back to the node, written as `#`, through its `$id`, or through a chain of definitions.
|
|
25
|
+
|
|
26
|
+
### Performance
|
|
27
|
+
|
|
28
|
+
- Building `unevaluatedProperties` or `unevaluatedItems` over a deep `allOf` or `$ref` chain costs its depth instead of its square.
|
|
29
|
+
|
|
30
|
+
## [0.50.1] - 2026-08-22
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- `CanonicalSchema#satisfiability` answers `:yes` for a string whose `pattern` or `format` a matching value can be built from.
|
|
35
|
+
- `CanonicalSchema#satisfiability` answers `:no` where a `format` takes no string of the length the schema asks for.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- `CanonicalSchema#negate` taking apart a union that reads a definition through its own `if`, so a schema and its negation shared a value.
|
|
40
|
+
- `CanonicalSchema#subtract` dropping a Draft 4 array member an element demand partly takes.
|
|
41
|
+
- `CanonicalSchema#covers` answering `Yes` where a Draft 4 element demand refuses a member.
|
|
42
|
+
- A string schema whose `maxLength` is `0` keeping a `pattern`, `format`, or content facet unread, so the same constraints written in one object and written as an `allOf` reached different canonical forms.
|
|
43
|
+
|
|
44
|
+
### Performance
|
|
45
|
+
|
|
46
|
+
- `not` over a wide object schema costs its branch count instead of its square.
|
|
47
|
+
- `not` over an object schema is linear in its property count, not quadratic.
|
|
48
|
+
- `not` over an object schema with `additionalProperties: false` no longer costs cubic time in its property count.
|
|
49
|
+
|
|
5
50
|
## [0.50.0] - 2026-08-20
|
|
6
51
|
|
|
7
52
|
### Added
|
|
@@ -422,7 +467,9 @@
|
|
|
422
467
|
|
|
423
468
|
- Initial public release
|
|
424
469
|
|
|
425
|
-
[Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.
|
|
470
|
+
[Unreleased]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.51.0...HEAD
|
|
471
|
+
[0.51.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.50.1...ruby-v0.51.0
|
|
472
|
+
[0.50.1]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.50.0...ruby-v0.50.1
|
|
426
473
|
[0.50.0]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.49.9...ruby-v0.50.0
|
|
427
474
|
[0.49.9]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.49.8...ruby-v0.49.9
|
|
428
475
|
[0.49.8]: https://github.com/Stranger6667/jsonschema/compare/ruby-v0.49.7...ruby-v0.49.8
|
data/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "jsonschema-rb"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.51.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
authors = ["Dmitry Dygalo <dmitry@dygalo.dev>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -14,7 +14,7 @@ crate-type = ["cdylib"]
|
|
|
14
14
|
|
|
15
15
|
[dependencies]
|
|
16
16
|
strum = "0.28.0"
|
|
17
|
-
jsonschema = { version = "0.
|
|
17
|
+
jsonschema = { version = "0.51.0", default-features = false, features = ["magnus", "arbitrary-precision", "resolve-http", "resolve-file", "tls-ring", "macros"] }
|
|
18
18
|
magnus = { version = "0.8", features = ["rb-sys"] }
|
|
19
19
|
rb-sys = "0.9"
|
|
20
20
|
serde = { workspace = true }
|
data/README.md
CHANGED
|
@@ -365,6 +365,8 @@ Compare a request schema new-against-old and a response schema old-against-new:
|
|
|
365
365
|
|
|
366
366
|
`:no` on the difference proves nothing was lost. `:unknown` proves nothing either way.
|
|
367
367
|
|
|
368
|
+
`:unknown` is undecided, not negative, so the two questions have opposite safe tests: only `satisfiability == :no` proves a schema admits nothing, and only `covers == :yes` proves containment.
|
|
369
|
+
|
|
368
370
|
`JSONSchema::Canonical::Containment`, `Satisfiability`, `Distinctness` and `Kind` hold these symbols as constants, each with an `ALL` list.
|
|
369
371
|
|
|
370
372
|
Both operands must share one setup - the same draft, format policy, regular-expression engine and definitions - or `IncompatibleOperands` is raised. `UnsupportedOperand` means an operand is a `Raw` pass-through, and `UnsupportedResult` that the canonical form does not support the result. All three live under `JSONSchema::Canonical`.
|
|
@@ -642,6 +644,7 @@ JSONSchema.valid?(schema, instance,
|
|
|
642
644
|
formats: { "name" => proc }, # Custom format validators
|
|
643
645
|
keywords: { "name" => Klass }, # Custom keyword validators
|
|
644
646
|
registry: registry, # Pre-registered schemas
|
|
647
|
+
vocabularies: ["https://..."], # Vocabularies implemented by custom keywords
|
|
645
648
|
pattern_options: opts, # RegexOptions or FancyRegexOptions
|
|
646
649
|
email_options: opts, # EmailOptions
|
|
647
650
|
http_options: opts # HttpOptions
|
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.51.0"
|
|
697
697
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
698
|
-
checksum = "
|
|
698
|
+
checksum = "152999731bfbe0bb82d561550be73b0c31a9827d6ebe3fe96ad47563703b5328"
|
|
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.51.0"
|
|
730
730
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
731
|
-
checksum = "
|
|
731
|
+
checksum = "b2b1d072fffb43f056f6749cfe86d5fd5853cd0b8b139a05a83f616549b9a98d"
|
|
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.51.0"
|
|
740
740
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
741
|
-
checksum = "
|
|
741
|
+
checksum = "9a710eb535fcbe18373b29254c6a9ca65de465c4228c04c3fdc7600d7b099651"
|
|
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.51.0"
|
|
759
759
|
dependencies = [
|
|
760
760
|
"jsonschema",
|
|
761
761
|
"magnus",
|
|
@@ -769,18 +769,18 @@ dependencies = [
|
|
|
769
769
|
|
|
770
770
|
[[package]]
|
|
771
771
|
name = "jsonschema-regex"
|
|
772
|
-
version = "0.
|
|
772
|
+
version = "0.51.0"
|
|
773
773
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
774
|
-
checksum = "
|
|
774
|
+
checksum = "8cb2e614e1c610e31e947d53156e877340c718e053cfce0dfe9b9ce7beff4d31"
|
|
775
775
|
dependencies = [
|
|
776
776
|
"regex-syntax",
|
|
777
777
|
]
|
|
778
778
|
|
|
779
779
|
[[package]]
|
|
780
780
|
name = "jsonschema-value"
|
|
781
|
-
version = "0.
|
|
781
|
+
version = "0.51.0"
|
|
782
782
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
783
|
-
checksum = "
|
|
783
|
+
checksum = "24373bc85409cb935a46af0ffb41294c5372c08cf9b0709913d908154cd10582"
|
|
784
784
|
dependencies = [
|
|
785
785
|
"ahash",
|
|
786
786
|
"bytecount",
|
|
@@ -1074,18 +1074,18 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
|
|
1074
1074
|
|
|
1075
1075
|
[[package]]
|
|
1076
1076
|
name = "rb-sys"
|
|
1077
|
-
version = "0.9.
|
|
1077
|
+
version = "0.9.130"
|
|
1078
1078
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1079
|
-
checksum = "
|
|
1079
|
+
checksum = "02faf625bb10ba893e3ae620f19c9fb1b5f8fcae0fe4eb86bb3f2230fad75edb"
|
|
1080
1080
|
dependencies = [
|
|
1081
1081
|
"rb-sys-build",
|
|
1082
1082
|
]
|
|
1083
1083
|
|
|
1084
1084
|
[[package]]
|
|
1085
1085
|
name = "rb-sys-build"
|
|
1086
|
-
version = "0.9.
|
|
1086
|
+
version = "0.9.130"
|
|
1087
1087
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1088
|
-
checksum = "
|
|
1088
|
+
checksum = "05be6f9c86fe5482808162826f6c047d093b3670582296c770de1d94f8066694"
|
|
1089
1089
|
dependencies = [
|
|
1090
1090
|
"bindgen",
|
|
1091
1091
|
"lazy_static",
|
|
@@ -1133,9 +1133,9 @@ dependencies = [
|
|
|
1133
1133
|
|
|
1134
1134
|
[[package]]
|
|
1135
1135
|
name = "referencing"
|
|
1136
|
-
version = "0.
|
|
1136
|
+
version = "0.51.0"
|
|
1137
1137
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1138
|
-
checksum = "
|
|
1138
|
+
checksum = "0aff997fc7eecb671a947b0f73f5ce4bcb4ad3534fd5bff2dd752718a8107525"
|
|
1139
1139
|
dependencies = [
|
|
1140
1140
|
"ahash",
|
|
1141
1141
|
"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.51.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.51.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.51.0"
|
|
17
17
|
serde = { version = "1", features = ["derive"] }
|
|
18
18
|
serde_json = { version = "1", features = ["arbitrary_precision"] }
|
|
19
19
|
strum = "0.28.0"
|
data/lib/jsonschema/version.rb
CHANGED
data/sig/jsonschema.rbs
CHANGED
|
@@ -23,10 +23,12 @@ module JSONSchema
|
|
|
23
23
|
# What an array requires of its elements: all distinct, some repeated, or neither.
|
|
24
24
|
type distinctness = :unconstrained | :all_distinct | :some_repeated
|
|
25
25
|
|
|
26
|
-
# Whether one schema admits every value another does.
|
|
26
|
+
# Whether one schema admits every value another does. Only `:yes` proves containment: test
|
|
27
|
+
# for `:yes`, and treat `:unknown` like `:no`.
|
|
27
28
|
type containment = :yes | :no | :unknown
|
|
28
29
|
|
|
29
|
-
# Whether any value satisfies a schema.
|
|
30
|
+
# Whether any value satisfies a schema. Only `:no` proves it admits nothing: test for `:no`,
|
|
31
|
+
# and treat `:unknown` like `:yes`.
|
|
30
32
|
type satisfiability = :yes | :no | :unknown
|
|
31
33
|
|
|
32
34
|
type view = TrueView | FalseView | MultiTypeView | TypedGroupView | StringView
|
|
@@ -308,6 +310,7 @@ module JSONSchema
|
|
|
308
310
|
untyped schema,
|
|
309
311
|
?validate_formats: bool?,
|
|
310
312
|
?ignore_unknown_formats: bool?,
|
|
313
|
+
?vocabularies: Array[String]?,
|
|
311
314
|
?base_uri: String?,
|
|
312
315
|
?retriever: (^(String) -> untyped)?,
|
|
313
316
|
?mask: String?,
|
|
@@ -324,6 +327,7 @@ module JSONSchema
|
|
|
324
327
|
untyped schema,
|
|
325
328
|
?validate_formats: bool?,
|
|
326
329
|
?ignore_unknown_formats: bool?,
|
|
330
|
+
?vocabularies: Array[String]?,
|
|
327
331
|
?mask: ::String?,
|
|
328
332
|
?base_uri: ::String?,
|
|
329
333
|
?retriever: (^(::String) -> untyped)?,
|
|
@@ -369,6 +373,7 @@ module JSONSchema
|
|
|
369
373
|
?draft: draft?,
|
|
370
374
|
?validate_formats: bool?,
|
|
371
375
|
?ignore_unknown_formats: bool?,
|
|
376
|
+
?vocabularies: Array[String]?,
|
|
372
377
|
?base_uri: String?,
|
|
373
378
|
?retriever: (^(String) -> untyped)?,
|
|
374
379
|
?mask: String?,
|
|
@@ -387,6 +392,7 @@ module JSONSchema
|
|
|
387
392
|
?draft: draft?,
|
|
388
393
|
?validate_formats: bool?,
|
|
389
394
|
?ignore_unknown_formats: bool?,
|
|
395
|
+
?vocabularies: Array[String]?,
|
|
390
396
|
?base_uri: String?,
|
|
391
397
|
?retriever: (^(String) -> untyped)?,
|
|
392
398
|
?mask: String?,
|
|
@@ -405,6 +411,7 @@ module JSONSchema
|
|
|
405
411
|
?draft: draft?,
|
|
406
412
|
?validate_formats: bool?,
|
|
407
413
|
?ignore_unknown_formats: bool?,
|
|
414
|
+
?vocabularies: Array[String]?,
|
|
408
415
|
?base_uri: String?,
|
|
409
416
|
?retriever: (^(String) -> untyped)?,
|
|
410
417
|
?mask: String?,
|
|
@@ -421,6 +428,7 @@ module JSONSchema
|
|
|
421
428
|
?draft: draft?,
|
|
422
429
|
?validate_formats: bool?,
|
|
423
430
|
?ignore_unknown_formats: bool?,
|
|
431
|
+
?vocabularies: Array[String]?,
|
|
424
432
|
?base_uri: String?,
|
|
425
433
|
?retriever: (^(String) -> untyped)?,
|
|
426
434
|
?mask: String?,
|
|
@@ -439,6 +447,7 @@ module JSONSchema
|
|
|
439
447
|
?draft: draft?,
|
|
440
448
|
?validate_formats: bool?,
|
|
441
449
|
?ignore_unknown_formats: bool?,
|
|
450
|
+
?vocabularies: Array[String]?,
|
|
442
451
|
?base_uri: String?,
|
|
443
452
|
?retriever: (^(String) -> untyped)?,
|
|
444
453
|
?formats: Hash[String, ^(String) -> bool]?,
|
data/src/lib.rs
CHANGED
data/src/options.rs
CHANGED
|
@@ -36,6 +36,7 @@ define_rb_intern!(static KW_FORMATS: "formats");
|
|
|
36
36
|
define_rb_intern!(static KW_KEYWORDS: "keywords");
|
|
37
37
|
define_rb_intern!(pub(crate) static KW_REGISTRY: "registry");
|
|
38
38
|
// Extra kwarg names (extracted before get_kwargs)
|
|
39
|
+
define_rb_intern!(static KW_VOCABULARIES: "vocabularies");
|
|
39
40
|
define_rb_intern!(static KW_PATTERN_OPTIONS: "pattern_options");
|
|
40
41
|
define_rb_intern!(static KW_EMAIL_OPTIONS: "email_options");
|
|
41
42
|
define_rb_intern!(static KW_HTTP_OPTIONS: "http_options");
|
|
@@ -224,12 +225,14 @@ pub fn parse_draft_symbol(ruby: &Ruby, val: Value) -> Result<jsonschema::Draft,
|
|
|
224
225
|
|
|
225
226
|
pub struct ExtractedKwargs {
|
|
226
227
|
pub base: BaseKwargs,
|
|
228
|
+
pub vocabularies: Option<Vec<String>>,
|
|
227
229
|
pub pattern_options: Option<Value>,
|
|
228
230
|
pub email_options: Option<Value>,
|
|
229
231
|
pub http_options: Option<Value>,
|
|
230
232
|
}
|
|
231
233
|
|
|
232
234
|
pub fn extract_kwargs(_ruby: &Ruby, kw: RHash) -> Result<ExtractedKwargs, Error> {
|
|
235
|
+
let vocabularies = extract_vocabularies(&kw)?;
|
|
233
236
|
let pattern_options = extract_and_delete(&kw, *KW_PATTERN_OPTIONS)?;
|
|
234
237
|
let email_options = extract_and_delete(&kw, *KW_EMAIL_OPTIONS)?;
|
|
235
238
|
let http_options = extract_and_delete(&kw, *KW_HTTP_OPTIONS)?;
|
|
@@ -239,6 +242,7 @@ pub fn extract_kwargs(_ruby: &Ruby, kw: RHash) -> Result<ExtractedKwargs, Error>
|
|
|
239
242
|
|
|
240
243
|
Ok(ExtractedKwargs {
|
|
241
244
|
base: base_kw.optional,
|
|
245
|
+
vocabularies,
|
|
242
246
|
pattern_options,
|
|
243
247
|
email_options,
|
|
244
248
|
http_options,
|
|
@@ -246,6 +250,7 @@ pub fn extract_kwargs(_ruby: &Ruby, kw: RHash) -> Result<ExtractedKwargs, Error>
|
|
|
246
250
|
}
|
|
247
251
|
|
|
248
252
|
pub fn extract_evaluate_kwargs(_ruby: &Ruby, kw: RHash) -> Result<ExtractedKwargs, Error> {
|
|
253
|
+
let vocabularies = extract_vocabularies(&kw)?;
|
|
249
254
|
let pattern_options = extract_and_delete(&kw, *KW_PATTERN_OPTIONS)?;
|
|
250
255
|
let email_options = extract_and_delete(&kw, *KW_EMAIL_OPTIONS)?;
|
|
251
256
|
let http_options = extract_and_delete(&kw, *KW_HTTP_OPTIONS)?;
|
|
@@ -275,6 +280,7 @@ pub fn extract_evaluate_kwargs(_ruby: &Ruby, kw: RHash) -> Result<ExtractedKwarg
|
|
|
275
280
|
keywords,
|
|
276
281
|
registry,
|
|
277
282
|
),
|
|
283
|
+
vocabularies,
|
|
278
284
|
pattern_options,
|
|
279
285
|
email_options,
|
|
280
286
|
http_options,
|
|
@@ -282,6 +288,7 @@ pub fn extract_evaluate_kwargs(_ruby: &Ruby, kw: RHash) -> Result<ExtractedKwarg
|
|
|
282
288
|
}
|
|
283
289
|
|
|
284
290
|
pub fn extract_kwargs_no_draft(_ruby: &Ruby, kw: RHash) -> Result<ExtractedKwargs, Error> {
|
|
291
|
+
let vocabularies = extract_vocabularies(&kw)?;
|
|
285
292
|
let pattern_options = extract_and_delete(&kw, *KW_PATTERN_OPTIONS)?;
|
|
286
293
|
let email_options = extract_and_delete(&kw, *KW_EMAIL_OPTIONS)?;
|
|
287
294
|
let http_options = extract_and_delete(&kw, *KW_HTTP_OPTIONS)?;
|
|
@@ -311,12 +318,19 @@ pub fn extract_kwargs_no_draft(_ruby: &Ruby, kw: RHash) -> Result<ExtractedKwarg
|
|
|
311
318
|
keywords,
|
|
312
319
|
registry,
|
|
313
320
|
),
|
|
321
|
+
vocabularies,
|
|
314
322
|
pattern_options,
|
|
315
323
|
email_options,
|
|
316
324
|
http_options,
|
|
317
325
|
})
|
|
318
326
|
}
|
|
319
327
|
|
|
328
|
+
fn extract_vocabularies(kw: &RHash) -> Result<Option<Vec<String>>, Error> {
|
|
329
|
+
extract_and_delete(kw, *KW_VOCABULARIES)?
|
|
330
|
+
.map(TryConvert::try_convert)
|
|
331
|
+
.transpose()
|
|
332
|
+
}
|
|
333
|
+
|
|
320
334
|
/// Extract a key from a Ruby Hash and remove it, returning None if not present or nil.
|
|
321
335
|
fn extract_and_delete(hash: &RHash, key: StaticId) -> Result<Option<Value>, Error> {
|
|
322
336
|
let val: Option<Value> = hash.delete(key.to_symbol())?;
|
|
@@ -482,6 +496,7 @@ pub fn make_options_from_kwargs(
|
|
|
482
496
|
formats: Option<RHash>,
|
|
483
497
|
keywords: Option<RHash>,
|
|
484
498
|
registry_val: Option<Value>,
|
|
499
|
+
vocabularies: Option<Vec<String>>,
|
|
485
500
|
pattern_options_val: Option<Value>,
|
|
486
501
|
email_options_val: Option<Value>,
|
|
487
502
|
http_options_val: Option<Value>,
|
|
@@ -506,6 +521,10 @@ pub fn make_options_from_kwargs(
|
|
|
506
521
|
opts = opts.should_ignore_unknown_formats(ignore);
|
|
507
522
|
}
|
|
508
523
|
|
|
524
|
+
for vocabulary in vocabularies.into_iter().flatten() {
|
|
525
|
+
opts = opts.with_vocabulary(vocabulary);
|
|
526
|
+
}
|
|
527
|
+
|
|
509
528
|
if let Some(uri) = base_uri {
|
|
510
529
|
opts = opts.with_base_uri(uri);
|
|
511
530
|
}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jsonschema_rs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.51.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dmitry Dygalo
|
|
@@ -35,14 +35,14 @@ dependencies:
|
|
|
35
35
|
requirements:
|
|
36
36
|
- - "~>"
|
|
37
37
|
- !ruby/object:Gem::Version
|
|
38
|
-
version: 0.9.
|
|
38
|
+
version: 0.9.130
|
|
39
39
|
type: :runtime
|
|
40
40
|
prerelease: false
|
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
|
42
42
|
requirements:
|
|
43
43
|
- - "~>"
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: 0.9.
|
|
45
|
+
version: 0.9.130
|
|
46
46
|
description: High-performance JSON Schema validator with support for Draft 4, 6, 7,
|
|
47
47
|
2019-09, and 2020-12.
|
|
48
48
|
email:
|