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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c80ade10ad457a2ce7b09f51f788c9bad884da32e462071349a3a3cac7627573
4
- data.tar.gz: f26291466286fe326b0aa0e4223d50e6e6f4864c85d0cfec10e0f53cde8689a9
3
+ metadata.gz: f135ed1b9a07f225cf01191cb278cd1eb62188369613e41b86df80dcbd147639
4
+ data.tar.gz: '008fe467062f636c4400f2dd65fa40cd09c32d6087d4c1207c9ce2667a9afc85'
5
5
  SHA512:
6
- metadata.gz: d2fe17e3e72da93b6b50fef93dd2641f2814d1aaf964364d9cf324f1b9562336956b1706d264baf6515f1d9d8ceee07abf830f83c83117594adb5f2806313981
7
- data.tar.gz: 61780c593073693c446d64f5088d495b0083c246989d5799f97b780945351a8f07aeee3e55d5cf1b87bc5c018e21bb4625029d108aed50a1172db9a54be09f5b
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.transform_keys(&:to_s) } if servers.any?
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.transform_keys(&:to_s)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenapiRuby
4
- VERSION = "3.0.2"
4
+ VERSION = "3.0.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapi-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morten Hartvig