rswag-schema_components 0.3.4 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9544448fb48d0ce6a9ee8788df90047e2ed0f8eeee12da103936b3cc984742e5
4
- data.tar.gz: 10c145bab158665095f35cd6397588c5d15c63a08aa5d27068d4eaa9227a2149
3
+ metadata.gz: cdbe6ec79d6079d3ff7cc0140aeff7f7b1601d28cc2c6162cc02ce93bdac955a
4
+ data.tar.gz: 3986c07499d385764bd05f3e9f9676f55419ca253c034dc9a663278e472bb20b
5
5
  SHA512:
6
- metadata.gz: f1e8a93eef6296b43c0cac844d587614f8f0cdf5a728e8546042bd236db00cb89dbdbd4b9d3726046bc400b48b75ca498a927bff3d0df63e20add61840e2b149
7
- data.tar.gz: 40f933561bd1eb40d764013a3f6c173a40218bb3c1316feb3506bca03054944ad4f5a5cf1c3d870221d174abb3f726419ae0ca14214b8ff42d85030432312fc0
6
+ metadata.gz: eca7f4ff84bc270001afe84a2881c701eb712892753f4aecbad14173d0368c7d61004288e2bdb6d9cc7db5e5094be593b7c7a9f664528b17402a5be0c6a7515e
7
+ data.tar.gz: 5f3883a422fd082716bf8c643d37266e973281e97a4428e953ef6a42230d69fe9be1f3910f498d7be25cf7071eb5bb233eabbf89181bc1bc5fe41b2e5d3438b6
@@ -59,12 +59,16 @@ module Rswag
59
59
  end
60
60
 
61
61
  private def load_classes
62
- Dir.glob(base_path.join("#{definitions_path}/**/*")).filter_map do |file_path|
63
- next if File.directory?(file_path)
62
+ all_paths = base_paths
64
63
 
65
- file_path.gsub(base_path.to_s, "") # remove base_path
66
- .gsub(".rb", "") # remove extension
67
- .camelize.constantize
64
+ all_paths.flat_map do |base_path|
65
+ Dir.glob(base_path.join("#{definitions_path}/**/*")).filter_map do |file_path|
66
+ next if File.directory?(file_path)
67
+
68
+ file_path.gsub(base_path.to_s, "") # remove base_path
69
+ .gsub(".rb", "") # remove extension
70
+ .camelize.constantize
71
+ end
68
72
  end
69
73
  end
70
74
 
@@ -90,6 +94,30 @@ module Rswag
90
94
  private def base_path
91
95
  @base_path ||= Rails.root.join(Rswag::SchemaComponents.components_base_path)
92
96
  end
97
+
98
+ private def base_paths
99
+ @base_paths ||= begin
100
+ paths = [base_path]
101
+
102
+ if packs_rails_present?
103
+ paths.concat(packs_directories.map { |pack_dir| pack_dir.join(Rswag::SchemaComponents.components_base_path) })
104
+ end
105
+
106
+ paths
107
+ end
108
+ end
109
+
110
+ private def packs_rails_present?
111
+ defined?(Packs)
112
+ rescue NameError
113
+ false
114
+ end
115
+
116
+ private def packs_directories
117
+ return [] unless packs_rails_present?
118
+
119
+ Packs.all.map { |pack| Rails.root.join(pack.relative_path) }
120
+ end
93
121
  end
94
122
  end
95
123
  end
@@ -1,5 +1,5 @@
1
1
  module Rswag
2
2
  module SchemaComponents
3
- VERSION = "0.3.4"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rswag-schema_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Klitzke
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-07-29 00:00:00.000000000 Z
10
+ date: 2025-08-21 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails