corvus_json_schema 0.1.3 → 0.1.4

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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Cargo.lock +2 -12
  3. data/README.md +10 -1
  4. data/THIRD-PARTY-NOTICES.txt +95 -0
  5. data/VERSIONHISTORY.md +24 -0
  6. data/ext/corvus_json_schema/Cargo.toml +2 -2
  7. data/ext/corvus_json_schema/clippy.toml +3 -4
  8. data/ext/corvus_json_schema/src/lib.rs +42 -19
  9. data/ext/corvus_json_schema/vendor/corvus-json-schema/Cargo.toml +9 -4
  10. data/ext/corvus_json_schema/vendor/corvus-json-schema/README.md +87 -4
  11. data/ext/corvus_json_schema/vendor/corvus-json-schema/THIRD-PARTY-NOTICES.txt +93 -0
  12. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/compiler.rs +88 -96
  13. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/document.rs +2 -2
  14. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/charset.rs +271 -0
  15. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/compile.rs +941 -0
  16. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/dfa.rs +366 -0
  17. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/fold.rs +138 -0
  18. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/mod.rs +329 -0
  19. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/parse.rs +1128 -0
  20. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/re2.rs +129 -0
  21. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/tables_gen.rs +6685 -0
  22. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/tests.rs +1672 -0
  23. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/ucd.rs +309 -0
  24. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/units.rs +165 -0
  25. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/vm.rs +981 -0
  26. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/eval/plan/fused.rs +13 -9
  27. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/eval/plan.rs +12 -11
  28. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/eval.rs +105 -73
  29. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/formats.rs +95 -1
  30. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/lib.rs +165 -30
  31. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/loader.rs +19 -21
  32. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/numbers.rs +1 -1
  33. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/options.rs +199 -4
  34. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/pattern.rs +758 -79
  35. data/ext/corvus_json_schema/vendor/corvus-json-schema/src/uri.rs +4 -4
  36. data/lib/corvus_json_schema/version.rb +1 -1
  37. data/lib/corvus_json_schema.rb +13 -3
  38. metadata +16 -2
@@ -129,10 +129,10 @@ fn normalize_parts(scheme: Option<&str>, authority: Option<&str>, path: &str, qu
129
129
  Some("https") => Some(":443"),
130
130
  _ => None,
131
131
  };
132
- if let Some(port) = default_port {
133
- if a.ends_with(port) {
134
- a.truncate(a.len() - port.len());
135
- }
132
+ if let Some(port) = default_port
133
+ && a.ends_with(port)
134
+ {
135
+ a.truncate(a.len() - port.len());
136
136
  }
137
137
  if path.is_empty() {
138
138
  path = "/".to_string();
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CorvusJsonSchema
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
@@ -25,6 +25,9 @@ module CorvusJsonSchema
25
25
  draft4: 4, draft6: 6, draft7: 7, draft201909: 2019, draft202012: 2020
26
26
  }.freeze
27
27
 
28
+ # The seconds one match of a regular expression may take, unless compile is told otherwise.
29
+ DEFAULT_PATTERN_MATCH_LIMIT = 1.0
30
+
28
31
  RESULTS_LEVELS = { basic: 0, detailed: 1, verbose: 2 }.freeze
29
32
 
30
33
  # Compiles a schema (a Hash or Array, true or false, or JSON text) into a Validator.
@@ -33,12 +36,19 @@ module CorvusJsonSchema
33
36
  # $schema), assert_format (nil follows the vocabularies), assert_format_in_legacy_drafts, assert_content, formats (a
34
37
  # Hash of format name to a callable returning whether a string is valid), resolver (a callable from an absolute URI
35
38
  # to the document, as a Hash or JSON text, or nil when unknown), base_uri, entry_point (a reference such as
36
- # "#/$defs/item") and max_depth (of in-place recursion, default 128).
39
+ # "#/$defs/item"), max_depth (of in-place recursion, default 128) and pattern_match_limit (the seconds one match of
40
+ # a pattern or patternProperties regular expression may take, default 1. A match that takes longer is abandoned and
41
+ # the validation raises PatternMatchLimitError. nil or 0 turns the limit off, for a caller who trusts both the
42
+ # schema and the instances).
43
+ #
44
+ # A schema that does not compile raises CompilationError, and one with a regular expression over a limit of size
45
+ # (1,048,576 bytes of pattern, 1,000 levels of groups) raises PatternTooLargeError, which is a CompilationError.
37
46
  def self.compile(schema, default_dialect: :draft202012, assert_format: nil, assert_format_in_legacy_drafts: false,
38
- assert_content: true, formats: nil, resolver: nil, base_uri: nil, entry_point: nil, max_depth: 128)
47
+ assert_content: true, formats: nil, resolver: nil, base_uri: nil, entry_point: nil, max_depth: 128,
48
+ pattern_match_limit: DEFAULT_PATTERN_MATCH_LIMIT)
39
49
  dialect = DIALECTS.fetch(default_dialect) { raise ArgumentError, "unknown dialect #{default_dialect.inspect}" }
40
50
  Native.compile(schema, dialect, assert_format, assert_format_in_legacy_drafts, assert_content, formats, resolver,
41
- base_uri, entry_point, Integer(max_depth))
51
+ base_uri, entry_point, Integer(max_depth), pattern_match_limit&.to_f)
42
52
  end
43
53
 
44
54
  # The version of the corvus-json-schema crate the extension was built from.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: corvus_json_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - endjin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-12 00:00:00.000000000 Z
11
+ date: 2026-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys
@@ -37,6 +37,7 @@ files:
37
37
  - Cargo.toml
38
38
  - LICENSE
39
39
  - README.md
40
+ - THIRD-PARTY-NOTICES.txt
40
41
  - VERSIONHISTORY.md
41
42
  - ext/corvus_json_schema/Cargo.toml
42
43
  - ext/corvus_json_schema/clippy.toml
@@ -46,9 +47,22 @@ files:
46
47
  - ext/corvus_json_schema/vendor/corvus-json-schema/Cargo.toml
47
48
  - ext/corvus_json_schema/vendor/corvus-json-schema/LICENSE
48
49
  - ext/corvus_json_schema/vendor/corvus-json-schema/README.md
50
+ - ext/corvus_json_schema/vendor/corvus-json-schema/THIRD-PARTY-NOTICES.txt
49
51
  - ext/corvus_json_schema/vendor/corvus-json-schema/src/compiler.rs
50
52
  - ext/corvus_json_schema/vendor/corvus-json-schema/src/dialect.rs
51
53
  - ext/corvus_json_schema/vendor/corvus-json-schema/src/document.rs
54
+ - ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/charset.rs
55
+ - ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/compile.rs
56
+ - ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/dfa.rs
57
+ - ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/fold.rs
58
+ - ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/mod.rs
59
+ - ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/parse.rs
60
+ - ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/re2.rs
61
+ - ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/tables_gen.rs
62
+ - ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/tests.rs
63
+ - ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/ucd.rs
64
+ - ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/units.rs
65
+ - ext/corvus_json_schema/vendor/corvus-json-schema/src/ecmaregex/vm.rs
52
66
  - ext/corvus_json_schema/vendor/corvus-json-schema/src/eval.rs
53
67
  - ext/corvus_json_schema/vendor/corvus-json-schema/src/eval/plan.rs
54
68
  - ext/corvus_json_schema/vendor/corvus-json-schema/src/eval/plan/fused.rs