mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-25 07:16:40 +00:00
Parse defined security requirements correctly
This commit is contained in:
@@ -26,9 +26,9 @@ module Rswag
|
||||
{ name: 'q1', in: :query, type: 'string' },
|
||||
{ name: :blog, in: :body, schema: { type: 'object' } }
|
||||
],
|
||||
security: {
|
||||
api_key: []
|
||||
}
|
||||
security: [
|
||||
{ api_key: [] }
|
||||
]
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
@@ -102,7 +102,7 @@ module Rswag
|
||||
end
|
||||
|
||||
context 'global requirement' do
|
||||
before { global_metadata[:security] = { api_key: [] } }
|
||||
before { global_metadata[:security] = [ { api_key: [] } ] }
|
||||
|
||||
it "appends the api_key using metadata and example value" do
|
||||
expect(path).to eq('/blogs/1/comments/2?api_key=fookey')
|
||||
@@ -110,7 +110,7 @@ module Rswag
|
||||
end
|
||||
|
||||
context 'operation-specific requirement' do
|
||||
before { api_metadata[:operation][:security] = { api_key: [] } }
|
||||
before { api_metadata[:operation][:security] = [ { api_key: [] } ] }
|
||||
|
||||
it "appends the api_key using metadata and example value" do
|
||||
expect(path).to eq('/blogs/1/comments/2?api_key=fookey')
|
||||
|
||||
Reference in New Issue
Block a user