Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support security in desc block #1831

Merged
merged 4 commits into from
Dec 3, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add security option in desc block
fotos committed Dec 3, 2018
commit 3aad58e0e2c6f3aad0cd5122c96da85768fcde9e
2 changes: 2 additions & 0 deletions lib/grape/dsl/desc.rb
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ module Desc
# @option options :nickname [String] nickname of the endpoint
# @option options :produces [Array[String]] a list of MIME types the endpoint produce
# @option options :consumes [Array[String]] a list of MIME types the endpoint consume
# @option options :security [Array[Hash]] a list of security schemes
# @option options :tags [Array[String]] a list of tags
# @yield a block yielding an instance context with methods mapping to
# each of the above, except that :entity is also aliased as #success
@@ -100,6 +101,7 @@ def desc_container
:nickname,
:produces,
:consumes,
:security,
:tags
)

4 changes: 3 additions & 1 deletion spec/grape/dsl/desc_spec.rb
Original file line number Diff line number Diff line change
@@ -44,7 +44,8 @@ class Dummy
nickname: 'nickname',
produces: %w[array of mime_types],
consumes: %w[array of mime_types],
tags: %w[tag1 tag2]
tags: %w[tag1 tag2],
security: %w[array of security schemes]
}

subject.desc 'The description' do
@@ -71,6 +72,7 @@ class Dummy
produces %w[array of mime_types]
consumes %w[array of mime_types]
tags %w[tag1 tag2]
security %w[array of security schemes]
end

expect(subject.namespace_setting(:description)).to eq(expected_options)