Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion lib/grape-swagger/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def method_object(route, options, path)
method[:parameters] = params_object(route, options, path, method[:consumes])
method[:security] = security_object(route)
method[:responses] = response_object(route, options)
method[:tags] = route.tags || tag_object(route, path)
method[:tags] = route.options.key?(:tags) ? route.tags : tag_object(route, path)
method[:operationId] = GrapeSwagger::DocMethods::OperationId.build(route, path)
method[:deprecated] = deprecated_object(route)
method.delete_if { |_, value| value.nil? }
Expand Down
17 changes: 17 additions & 0 deletions spec/swagger_v2/endpoint_versioned_path_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@
end
end

context 'when tags are explicitly set to nil' do
let(:item) do
Class.new(Grape::API) do
version 'v1', using: :path

resource :item do
desc 'Item description', tags: nil
get '/'
end
end
end

it 'omits the tags key instead of falling back to the default tag' do
expect(subject.first['/v1/item'][:get]).not_to have_key(:tags)
end
end

context 'when parameter with a custom type is specified' do
let(:item) do
Class.new(Grape::API) do
Expand Down
Loading