openapi-ruby 3.0.2 → 3.0.3
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/lib/openapi_ruby/components/loader.rb +12 -0
- data/lib/openapi_ruby/core/document.rb +13 -2
- data/lib/openapi_ruby/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: f135ed1b9a07f225cf01191cb278cd1eb62188369613e41b86df80dcbd147639
|
|
4
|
+
data.tar.gz: '008fe467062f636c4400f2dd65fa40cd09c32d6087d4c1207c9ce2667a9afc85'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fddba781e5ca09c19f5766c5b708b0408c4b0c199663f4cba23b8e1959535283f75a1b6e5550bc4defc7bbabc07442c16ad66374b7e93bebd432d29dadfe93f8
|
|
7
|
+
data.tar.gz: 67b1ef59d47959496cfb4b33ac76f3e73d961d0645bec2ae2cbc5c693e4fbb4a4d2d9121bef3f39c2840c6bf50500f8a8acead89cd91e7a5893312ccd7798db9
|
|
@@ -137,6 +137,17 @@ module OpenapiRuby
|
|
|
137
137
|
class_to_file[klass] = source_file if source_file
|
|
138
138
|
end
|
|
139
139
|
|
|
140
|
+
# Correct cross-scope inheritance misattribution: when Admin::V1::Schemas::ItemPrice
|
|
141
|
+
# inherits from V1::Schemas::ItemPrice, loading the admin file auto-loads the parent
|
|
142
|
+
# via Ruby autoloading. The diff-based tracking then maps the parent to the admin file.
|
|
143
|
+
# Fix by preferring the conventional file path when it exists and differs.
|
|
144
|
+
class_to_file.each do |klass, file|
|
|
145
|
+
conventional_file = find_source_file_for(klass)
|
|
146
|
+
if conventional_file && conventional_file != file && file_scope_map.key?(conventional_file)
|
|
147
|
+
class_to_file[klass] = conventional_file
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
140
151
|
# Assign scopes to all registered components based on their source file.
|
|
141
152
|
class_to_file.each do |klass, file|
|
|
142
153
|
next if klass._component_scopes_explicitly_set
|
|
@@ -146,6 +157,7 @@ module OpenapiRuby
|
|
|
146
157
|
|
|
147
158
|
if inferred_scope == :shared
|
|
148
159
|
klass._component_scopes = []
|
|
160
|
+
klass._component_scopes_explicitly_set = true
|
|
149
161
|
else
|
|
150
162
|
Registry.instance.unregister(klass)
|
|
151
163
|
klass._component_scopes = [inferred_scope]
|
|
@@ -15,7 +15,7 @@ module OpenapiRuby
|
|
|
15
15
|
"info" => normalize_info(info),
|
|
16
16
|
"paths" => {}
|
|
17
17
|
}
|
|
18
|
-
@data["servers"] = servers.map { |s| s
|
|
18
|
+
@data["servers"] = servers.map { |s| deep_stringify_keys(s) } if servers.any?
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def add_path(template, path_item)
|
|
@@ -75,11 +75,22 @@ module OpenapiRuby
|
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def normalize_info(info)
|
|
78
|
-
result = info
|
|
78
|
+
result = deep_stringify_keys(info)
|
|
79
79
|
result["title"] ||= ""
|
|
80
80
|
result["version"] ||= "0.0.0"
|
|
81
81
|
result
|
|
82
82
|
end
|
|
83
|
+
|
|
84
|
+
def deep_stringify_keys(obj)
|
|
85
|
+
case obj
|
|
86
|
+
when Hash
|
|
87
|
+
obj.each_with_object({}) { |(k, v), h| h[k.to_s] = deep_stringify_keys(v) }
|
|
88
|
+
when Array
|
|
89
|
+
obj.map { |v| deep_stringify_keys(v) }
|
|
90
|
+
else
|
|
91
|
+
obj
|
|
92
|
+
end
|
|
93
|
+
end
|
|
83
94
|
end
|
|
84
95
|
end
|
|
85
96
|
end
|
data/lib/openapi_ruby/version.rb
CHANGED