api-regulator 0.1.20 → 0.1.22

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: 837c44e67ec38b0e133c4aa4bb42959bd8488497da252a71d2eed57d2c366b3b
4
- data.tar.gz: ae1383ca7891e8c4e07967f4a52e497375faab6d495d72201403ce73f88d06cd
3
+ metadata.gz: 97a2fcac0b82b485ccf40f8c13e042761750873c306d8277da6992b13dad34b2
4
+ data.tar.gz: a0b1ca74bc889990b33ce068c539147618775659451149ffcefd394913ae78fd
5
5
  SHA512:
6
- metadata.gz: 42f8341aa27841393a663ac1fa2ec2b540dbedaf54d3a3d2b6144e2369933514e7cc896e2dc6929363f5c5fac140d378618a1e16304d0c24e72ba3746644d119
7
- data.tar.gz: 39da0748340946964f64615dc392f742e47ccfce02b9c2c09cb9a80cc85aaf206128ae480f27ab57c44722c56db99e83ed13c7d2846bf6c54c8882abda417748
6
+ metadata.gz: 187b90ee4f2b0343df99e9124775dd40c9279f17454a705ba0fdc1ac6a8eb293c9f095f69fb99b13d671bd29db4ebc0ac991fd0ff8193aad208a17bc6c0ecf5f
7
+ data.tar.gz: 1991a0020fdaa706c0b22bed235195e5685c9ad0b25b6fe2c5925c9ff8798ad74b4016519cbbe9395caf956fb7fb7044551a0612cff239fb19c8124950165654
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- api-regulator (0.1.20)
4
+ api-regulator (0.1.22)
5
5
  activemodel (~> 8.0)
6
6
  activesupport (~> 8.0)
7
7
 
@@ -123,10 +123,10 @@ GEM
123
123
  net-smtp (0.5.1)
124
124
  net-protocol
125
125
  nio4r (2.7.4)
126
- nokogiri (1.18.2)
126
+ nokogiri (1.18.3)
127
127
  mini_portile2 (~> 2.8.2)
128
128
  racc (~> 1.4)
129
- nokogiri (1.18.2-arm64-darwin)
129
+ nokogiri (1.18.3-arm64-darwin)
130
130
  racc (~> 1.4)
131
131
  pp (0.6.2)
132
132
  prettyprint
@@ -199,7 +199,7 @@ GEM
199
199
  rspec-support (~> 3.10)
200
200
  rspec-support (3.13.2)
201
201
  securerandom (0.4.1)
202
- stringio (3.1.2)
202
+ stringio (3.1.5)
203
203
  thor (1.3.2)
204
204
  timeout (0.4.3)
205
205
  tzinfo (2.0.6)
@@ -210,7 +210,7 @@ GEM
210
210
  base64
211
211
  websocket-extensions (>= 0.1.0)
212
212
  websocket-extensions (0.1.5)
213
- zeitwerk (2.7.1)
213
+ zeitwerk (2.7.2)
214
214
 
215
215
  PLATFORMS
216
216
  arm64-darwin-23
@@ -37,7 +37,8 @@ module ApiRegulator
37
37
 
38
38
  body_params = api_definition.params.select(&:body?)
39
39
  permitted_body = body_params.each_with_object({}) do |param, hash|
40
- if param.type == :object
40
+ case param.type
41
+ when :array, :object
41
42
  if param.required?
42
43
  nested = params.expect(param.name => build_permitted_keys(param.children)).to_h.symbolize_keys
43
44
  hash[param.name.to_sym] = nested
@@ -355,8 +355,9 @@ module ApiRegulator
355
355
  allowed_arbitrary_keys = params.flat_map(&:allowed_arbitrary_keys).compact
356
356
  extras = []
357
357
  actual_keys.each do |key|
358
- next if allowed_keys.include?(key.gsub(/\[\d+\]/, "[]"))
359
- next if allowed_arbitrary_keys.any? { |aribitrary_key| key.starts_with?(aribitrary_key) }
358
+ deindexed_key = key.gsub(/\[\d+\]/, "[]")
359
+ next if allowed_keys.include?(deindexed_key)
360
+ next if allowed_arbitrary_keys.any? { |aribitrary_key| deindexed_key.starts_with?(aribitrary_key) }
360
361
  extras << key
361
362
  end
362
363
  extras
@@ -1,3 +1,3 @@
1
1
  module ApiRegulator
2
- VERSION = "0.1.20"
2
+ VERSION = "0.1.22"
3
3
  end
@@ -12,6 +12,17 @@ namespace :api_docs do
12
12
  ApiRegulator::OpenApiGenerator.generate(ApiRegulator.api_definitions, version: version.presence)
13
13
  end
14
14
 
15
+ desc 'Generate OpenAPI schemas for all versions'
16
+ task generate_all: :environment do
17
+ # Set an empty api key if none is provided
18
+ ENV['RDME_API_KEY'] ||= ''
19
+ Rails.application.eager_load! # Ensure all controllers and API definitions are loaded
20
+
21
+ ApiRegulator.configuration.versions.keys.each do |version|
22
+ ApiRegulator::OpenApiGenerator.generate(ApiRegulator.api_definitions, version: version)
23
+ end
24
+ end
25
+
15
26
  desc "Upload OpenAPI schema to ReadMe"
16
27
  task :upload => :environment do
17
28
  # ReadMe API key and version
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.20
4
+ version: 0.1.22
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-02-14 00:00:00.000000000 Z
11
+ date: 2025-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport