mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-22 22:06:43 +00:00
Allows for parameters to be defined without the 'in' key defined to allow for parameter
This commit is contained in:
parent
8f16492462
commit
037c0e374a
@ -36,7 +36,9 @@ module Rswag
|
|||||||
end
|
end
|
||||||
|
|
||||||
def parameter(attributes)
|
def parameter(attributes)
|
||||||
attributes[:required] = true if attributes[:in].to_sym == :path
|
if attributes[:in] && attributes[:in].to_sym == :path
|
||||||
|
attributes[:required] = true
|
||||||
|
end
|
||||||
|
|
||||||
if metadata.has_key?(:operation)
|
if metadata.has_key?(:operation)
|
||||||
metadata[:operation][:parameters] ||= []
|
metadata[:operation][:parameters] ||= []
|
||||||
|
|||||||
@ -120,6 +120,15 @@ module Rswag
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when 'in' parameter key is not defined" do
|
||||||
|
before { subject.parameter(name: :id) }
|
||||||
|
let(:api_metadata) { { operation: {} } }
|
||||||
|
|
||||||
|
it "does not require the 'in' parameter key" do
|
||||||
|
expect(api_metadata[:operation][:parameters]).to match([ name: :id ])
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#response(code, description)' do
|
describe '#response(code, description)' do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user