mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-23 06:16:42 +00:00
Fix oauth2 transform keys except type
This commit is contained in:
parent
bd038949b4
commit
d66be41d04
@ -197,7 +197,10 @@ module Rswag
|
||||
|
||||
ActiveSupport::Deprecation.warn("Rswag::Specs: WARNING: securityDefinitions flow is replaced in OpenAPI3! Rename to components/securitySchemes/#{name}/flows[] (in swagger_helper.rb)")
|
||||
flow = swagger_doc[:components][:securitySchemes][name].delete(:flow)
|
||||
swagger_doc[:components][:securitySchemes][name].merge!(flows: [flow])
|
||||
flow_elements = swagger_doc[:components][:securitySchemes][name].except(:type).each_with_object({}) do |(k, _v), a|
|
||||
a[k] = swagger_doc[:components][:securitySchemes][name].delete(k)
|
||||
end
|
||||
swagger_doc[:components][:securitySchemes][name].merge!(flows: { flow => flow_elements })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -79,7 +79,9 @@ module Rswag
|
||||
components: {
|
||||
securitySchemes: {
|
||||
my_oauth: {
|
||||
flow: :anything
|
||||
type: :oauth2,
|
||||
flow: :anything,
|
||||
token_url: :somewhere
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -128,7 +130,12 @@ module Rswag
|
||||
components: {
|
||||
securitySchemes: {
|
||||
my_oauth: {
|
||||
flows: [:anything]
|
||||
type: :oauth2,
|
||||
flows: {
|
||||
anything: {
|
||||
token_url: :somewhere
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user