mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-25 15:22:56 +00:00
add header type schema support for openapi3
This commit is contained in:
@@ -157,12 +157,6 @@ module Rswag
|
||||
def header(name, attributes)
|
||||
metadata[:response][:headers] ||= {}
|
||||
|
||||
## OA3
|
||||
# if attributes[:type] && attributes[:schema].nil?
|
||||
# attributes[:schema] = { type: attributes[:type] }
|
||||
# attributes.delete(:type)
|
||||
# end
|
||||
|
||||
metadata[:response][:headers][name] = attributes
|
||||
end
|
||||
|
||||
|
||||
@@ -127,8 +127,9 @@ module Rswag
|
||||
def upgrade_request_type!(metadata)
|
||||
operation_nodes = metadata[:operation][:parameters] || []
|
||||
path_nodes = metadata[:path_item][:parameters] || []
|
||||
header_node = metadata[:response][:headers] ||= {}
|
||||
|
||||
(operation_nodes + path_nodes).each do |node|
|
||||
(operation_nodes + path_nodes + [header_node]).each do |node|
|
||||
if node && node[:type] && node[:schema].nil?
|
||||
node[:schema] = { type: node[:type] }
|
||||
node.delete(:type)
|
||||
|
||||
Reference in New Issue
Block a user