mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-22 22:06:43 +00:00
add rewrite for securitySchemes into swagger_doc
This commit is contained in:
parent
e9aebe6221
commit
231a2d135c
@ -56,13 +56,13 @@ module Rswag
|
||||
else # Openapi3
|
||||
if swagger_doc.has_key?(:securityDefinitions)
|
||||
ActiveSupport::Deprecation.warn('Rswag::Specs: WARNING: securityDefinitions is replaced in OpenAPI3! Rename to components/securitySchemes (in swagger_helper.rb)')
|
||||
(swagger_doc[:securityDefinitions] || {}).slice(*scheme_names).values
|
||||
else
|
||||
swagger_doc[:components] ||= { securitySchemes: swagger_doc[:securityDefinitions] }
|
||||
swagger_doc.delete(:securityDefinitions)
|
||||
end
|
||||
components = swagger_doc[:components] || {}
|
||||
(components[:securitySchemes] || {}).slice(*scheme_names).values
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def resolve_parameter(ref, swagger_doc)
|
||||
key = key_version(ref, swagger_doc)
|
||||
|
||||
@ -242,6 +242,7 @@ module Rswag
|
||||
expect(request[:headers]).to eq('HTTP_AUTHORIZATION' => 'Basic foobar')
|
||||
expect(ActiveSupport::Deprecation).to have_received(:warn)
|
||||
.with('Rswag::Specs: WARNING: securityDefinitions is replaced in OpenAPI3! Rename to components/securitySchemes (in swagger_helper.rb)')
|
||||
expect(swagger_doc[:components]).to have_key(:securitySchemes)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -286,7 +286,8 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
"components": {
|
||||
"securitySchemes": {
|
||||
"basic_auth": {
|
||||
"type": "basic"
|
||||
},
|
||||
@ -297,3 +298,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user