api-regulator 0.1.13 → 0.1.15
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/Gemfile.lock +2 -2
- data/lib/api_regulator/open_api_generator.rb +1 -1
- data/lib/api_regulator/validator.rb +5 -5
- data/lib/api_regulator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af919849c8aa5a73452d29c2b4f14ee6bdc758c632445636319e9672aa611aa2
|
4
|
+
data.tar.gz: 6b3f72a0f20b42a3fd9e0b4c36d879455c1e974e86cafd76fc3cddba4f7d7b11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e25b086cccdcc6b57df5fa33ac429cd1b62d8fca1d188b74b6eac42377185ac293565802dac26eb652d8cc063b88dd21f9a5d7d1f17d94b678edf09ef2900bd
|
7
|
+
data.tar.gz: f41ffbeb474577d54779f187cac8531c800c4264b7a63ceec6716730d14fc09355d96a1aab01a9768698e623e04d9808690cd791f2af912886c4b50519041204
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
api-regulator (0.1.
|
4
|
+
api-regulator (0.1.15)
|
5
5
|
activemodel (~> 8.0)
|
6
6
|
activesupport (~> 8.0)
|
7
7
|
|
@@ -135,7 +135,7 @@ GEM
|
|
135
135
|
date
|
136
136
|
stringio
|
137
137
|
racc (1.8.1)
|
138
|
-
rack (3.1.
|
138
|
+
rack (3.1.9)
|
139
139
|
rack-session (2.1.0)
|
140
140
|
base64 (>= 0.1.0)
|
141
141
|
rack (>= 3.0.0)
|
@@ -171,7 +171,7 @@ module ApiRegulator
|
|
171
171
|
end
|
172
172
|
|
173
173
|
def self.generate_responses(api)
|
174
|
-
api.responses.each_with_object({}) do |(status_code, schema), responses|
|
174
|
+
Hash[api.responses.sort].each_with_object({}) do |(status_code, schema), responses|
|
175
175
|
if schema.options[:ref]
|
176
176
|
shared_schema = ApiRegulator.shared_schema(schema.options[:ref])
|
177
177
|
raise "Shared schema not found for ref: #{schema.options[:ref]}" unless shared_schema
|
@@ -30,9 +30,9 @@ module ApiRegulator
|
|
30
30
|
self.defined_attributes += [full_key]
|
31
31
|
|
32
32
|
param.options.each do |option, value|
|
33
|
-
validates full_key,
|
34
|
-
|
35
|
-
|
33
|
+
validates full_key,
|
34
|
+
option => value,
|
35
|
+
if: ->(record) { param.required?(validation_context) || record.raw_attributes.key?(param.name) }
|
36
36
|
end
|
37
37
|
|
38
38
|
# Add type-specific validations
|
@@ -151,11 +151,11 @@ module ApiRegulator
|
|
151
151
|
return
|
152
152
|
end
|
153
153
|
|
154
|
-
inclusion_list = param.options
|
154
|
+
inclusion_list = param.options.dig(:inclusion, :in)
|
155
155
|
|
156
156
|
raw_value.each_with_index do |value, index|
|
157
157
|
# Skip type and inclusion validation if nil is allowed and value is nil
|
158
|
-
if value.nil? && (inclusion_list&.include?(nil) || param.options
|
158
|
+
if value.nil? && (inclusion_list&.include?(nil) || param.options.dig(:inclusion, :allow_nil))
|
159
159
|
next
|
160
160
|
end
|
161
161
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api-regulator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoff Massanek
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|