jsonschema_rs 0.63.0 → 0.63.1
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 +8 -1
- data/Cargo.toml +2 -2
- data/README.md +6 -0
- data/ext/jsonschema/Cargo.lock +324 -354
- data/ext/jsonschema/Cargo.toml +3 -3
- data/lib/jsonschema/version.rb +1 -1
- data/sig/jsonschema.rbs +4 -0
- data/src/options.rs +36 -0
- metadata +2 -2
data/ext/jsonschema/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "jsonschema-rb-ext"
|
|
3
|
-
version = "0.63.
|
|
3
|
+
version = "0.63.1"
|
|
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.63.
|
|
13
|
+
jsonschema = { version = "0.63.1", default-features = false, features = ["magnus", "arbitrary-precision", "resolve-http", "resolve-file", "tls-ring", "macros", "idna", "json-text"] }
|
|
14
14
|
magnus = { version = "0.9", features = ["rb-sys"] }
|
|
15
15
|
rb-sys = "0.9"
|
|
16
|
-
referencing = "0.63.
|
|
16
|
+
referencing = "0.63.1"
|
|
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
|
@@ -380,6 +380,10 @@ module JSONSchema
|
|
|
380
380
|
class NumberFormat
|
|
381
381
|
end
|
|
382
382
|
|
|
383
|
+
# The names of the formats with a check under `draft`, sorted and without duplicates: the
|
|
384
|
+
# built-in formats and those in `formats`.
|
|
385
|
+
def self.known_formats: (draft draft, ?formats: Hash[String, (^(String) -> bool) | NumberFormat]?) -> Array[String]
|
|
386
|
+
|
|
383
387
|
# Create a validator with auto-detected draft version.
|
|
384
388
|
def self.validator_for: (
|
|
385
389
|
untyped schema,
|
data/src/options.rs
CHANGED
|
@@ -425,6 +425,41 @@ fn number_format(ruby: &Ruby, check: Value) -> Result<NumberFormat, Error> {
|
|
|
425
425
|
})
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
+
/// known_formats(draft, formats: nil) -> Array[String]
|
|
429
|
+
///
|
|
430
|
+
/// The names of the formats with a check under `draft`, sorted and without duplicates: the
|
|
431
|
+
/// built-in formats and those in `formats`.
|
|
432
|
+
fn known_formats(ruby: &Ruby, args: &[Value]) -> Result<Vec<String>, Error> {
|
|
433
|
+
let parsed_args = scan_args::<(Value,), (), (), (), _, ()>(args)?;
|
|
434
|
+
let (draft,) = parsed_args.required;
|
|
435
|
+
let draft = parse_draft_symbol(ruby, draft)?;
|
|
436
|
+
let kw: KwArgs<(), (Option<Option<RHash>>,), ()> =
|
|
437
|
+
get_kwargs(parsed_args.keywords, &[], &[*KW_FORMATS])?;
|
|
438
|
+
let parsed = make_options_from_kwargs::<Magnus>(
|
|
439
|
+
ruby,
|
|
440
|
+
None,
|
|
441
|
+
None,
|
|
442
|
+
None,
|
|
443
|
+
None,
|
|
444
|
+
None,
|
|
445
|
+
None,
|
|
446
|
+
kw.optional.0.flatten(),
|
|
447
|
+
None,
|
|
448
|
+
None,
|
|
449
|
+
None,
|
|
450
|
+
None,
|
|
451
|
+
None,
|
|
452
|
+
None,
|
|
453
|
+
None,
|
|
454
|
+
)?;
|
|
455
|
+
Ok(parsed
|
|
456
|
+
.options
|
|
457
|
+
.known_formats(draft)
|
|
458
|
+
.into_iter()
|
|
459
|
+
.map(str::to_owned)
|
|
460
|
+
.collect())
|
|
461
|
+
}
|
|
462
|
+
|
|
428
463
|
/// Wrapper for a Ruby custom keyword validator factory.
|
|
429
464
|
struct RubyKeywordFactory {
|
|
430
465
|
class: Opaque<Value>,
|
|
@@ -1273,6 +1308,7 @@ impl HttpOptions {
|
|
|
1273
1308
|
pub fn define_classes(ruby: &Ruby, module: &RModule) -> Result<(), Error> {
|
|
1274
1309
|
module.define_class("NumberFormat", ruby.class_object())?;
|
|
1275
1310
|
module.define_singleton_method("number_format", function!(number_format, 1))?;
|
|
1311
|
+
module.define_singleton_method("known_formats", function!(known_formats, -1))?;
|
|
1276
1312
|
let email_class = module.define_class("EmailOptions", ruby.class_object())?;
|
|
1277
1313
|
email_class.define_singleton_method("new", function!(EmailOptions::new_impl, -1))?;
|
|
1278
1314
|
email_class.define_method("require_tld", method!(EmailOptions::require_tld, 0))?;
|
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.63.
|
|
4
|
+
version: 0.63.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dmitry Dygalo
|
|
@@ -81,7 +81,7 @@ metadata:
|
|
|
81
81
|
homepage_uri: https://github.com/Stranger6667/jsonschema/tree/master/crates/jsonschema-rb
|
|
82
82
|
source_code_uri: https://github.com/Stranger6667/jsonschema
|
|
83
83
|
changelog_uri: https://github.com/Stranger6667/jsonschema/blob/master/crates/jsonschema-rb/CHANGELOG.md
|
|
84
|
-
documentation_uri: https://github.com/Stranger6667/jsonschema/blob/ruby-v0.63.
|
|
84
|
+
documentation_uri: https://github.com/Stranger6667/jsonschema/blob/ruby-v0.63.1/crates/jsonschema-rb/README.md
|
|
85
85
|
bug_tracker_uri: https://github.com/Stranger6667/jsonschema/issues
|
|
86
86
|
funding_uri: https://github.com/sponsors/Stranger6667
|
|
87
87
|
rubygems_mfa_required: 'true'
|