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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd01d986f35199767ed09aeca6b5a5b0b19441113fa10b2fa5b34a511a4773ab
4
- data.tar.gz: 02e722bd4b5df9a728a9ff1a339922cd891e9ae0eca9bf516b653bab3132c379
3
+ metadata.gz: af919849c8aa5a73452d29c2b4f14ee6bdc758c632445636319e9672aa611aa2
4
+ data.tar.gz: 6b3f72a0f20b42a3fd9e0b4c36d879455c1e974e86cafd76fc3cddba4f7d7b11
5
5
  SHA512:
6
- metadata.gz: 42b77076b73dffc526ef004bc182c63cd3c45bbfaa8d5102796a92964c951da6351311bce75a89955f74cb851221b566c3188f5477ccb51355c09c588d70fc59
7
- data.tar.gz: 50888b26e95137d81dad5b8cb2777a065613f87fe537e2a1b456bcfe986b41a9e2fa45ce23c77688098421c4e5f8aebe31184f3065764e83dbf44d3c9e6caa4b
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.13)
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.8)
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, option => value, if: ->(record) {
34
- param.required?(validation_context) || record.raw_attributes.key?(param.name)
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[:inclusion]&.dig(:in)
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[:allow_nil_items])
158
+ if value.nil? && (inclusion_list&.include?(nil) || param.options.dig(:inclusion, :allow_nil))
159
159
  next
160
160
  end
161
161
 
@@ -1,3 +1,3 @@
1
1
  module ApiRegulator
2
- VERSION = "0.1.13"
2
+ VERSION = "0.1.15"
3
3
  end
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.13
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-29 00:00:00.000000000 Z
11
+ date: 2025-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport