openapi_first 4.1.0 → 4.2.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 +4 -0
- data/lib/openapi_first/builder.rb +2 -1
- data/lib/openapi_first/child_configuration.rb +1 -0
- data/lib/openapi_first/configuration.rb +6 -1
- data/lib/openapi_first/version.rb +1 -1
- 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: 70cf5324252fd4c36421cb732127b220e45c3eefbafba7ed63ee513aea2d5b84
|
|
4
|
+
data.tar.gz: 43358cb067c765b59920160f589eb929216a9721b806a4a37b24ab039f536599
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d1b97b74dcdf98616c0f51c3e6a2c53cedb3685518f9697491eadca4110d39f12f68c54769535e6d171bf401d8d47085279124d70534fb5959c47cdf3b4d4eda
|
|
7
|
+
data.tar.gz: a27158cbd2760fa99de1f26193ce5450f5d2ef409c4a780da94ab102c24439dd1d149d6824a99cc8287617cd999cccc9de4989a33edaaaad2debfd7045a3892e
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 4.2.0
|
|
6
|
+
|
|
7
|
+
- Added `config.regexp_resolver` configuration option, `'ruby'` (default) or `'ecma'` (also as Symbol). The value is passed to json_schemer's `regexp_resolver` configuration. In OpenAPI, the pattern keyword specifies a regular expression that must conform to the ECMA-262 standard. So using `'ecma'` is recommended.
|
|
8
|
+
|
|
5
9
|
## 4.1.0
|
|
6
10
|
|
|
7
11
|
- Query and cookie parameter values with invalid encoding (like `?search=%C3`) produce a 400 response now. Before such a value passed validation or raised an `ArgumentError`. This applies to documented and undocumented query parameter, but only to documented cookie parameters.
|
|
@@ -27,9 +27,9 @@ module OpenapiFirst
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def initialize(contents, filepath:, config:)
|
|
30
|
+
@config = config
|
|
30
31
|
meta_schema = detect_meta_schema(contents, filepath)
|
|
31
32
|
@schemer_configuration = build_schemer_config(filepath:, meta_schema:)
|
|
32
|
-
@config = config
|
|
33
33
|
@file_loader = FileLoader.new
|
|
34
34
|
ref_resolver = RefResolver.new(file_loader:)
|
|
35
35
|
@contents = ref_resolver.for(contents, filepath:)
|
|
@@ -47,6 +47,7 @@ module OpenapiFirst
|
|
|
47
47
|
end
|
|
48
48
|
result.meta_schema = meta_schema
|
|
49
49
|
result.insert_property_defaults = true
|
|
50
|
+
result.regexp_resolver = config.regexp_resolver if config.regexp_resolver
|
|
50
51
|
result
|
|
51
52
|
end
|
|
52
53
|
|
|
@@ -16,13 +16,14 @@ module OpenapiFirst
|
|
|
16
16
|
@request_validation_error_response = OpenapiFirst.find_error_response(:default)
|
|
17
17
|
@hooks = HOOKS.to_h { [_1, Set.new] }
|
|
18
18
|
@path = nil
|
|
19
|
+
@regexp_resolver = nil
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
def register(path_or_definition, as: :default)
|
|
22
23
|
OpenapiFirst.register(path_or_definition, as:)
|
|
23
24
|
end
|
|
24
25
|
|
|
25
|
-
attr_reader :hooks, :request_validation_error_response
|
|
26
|
+
attr_reader :hooks, :request_validation_error_response, :regexp_resolver
|
|
26
27
|
attr_accessor :path
|
|
27
28
|
|
|
28
29
|
# Return a child configuration that still receives updates of global hooks.
|
|
@@ -49,6 +50,10 @@ module OpenapiFirst
|
|
|
49
50
|
Plugins.load(name).configure(self, **)
|
|
50
51
|
end
|
|
51
52
|
|
|
53
|
+
def regexp_resolver=(resolver)
|
|
54
|
+
@regexp_resolver = resolver.is_a?(Symbol) ? resolver.to_s : resolver
|
|
55
|
+
end
|
|
56
|
+
|
|
52
57
|
def request_validation_error_response=(mod)
|
|
53
58
|
@request_validation_error_response = if mod.is_a?(Symbol)
|
|
54
59
|
OpenapiFirst.find_error_response(mod)
|