Skip to content

Fixed the bug where 'is_array' in the return entity is ignored. #206

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

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 4 additions & 4 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Metrics/AbcSize:
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 397
Max: 401

# Offense count: 5
Metrics/CyclomaticComplexity:
Max: 93
Max: 94

# Offense count: 195
# Configuration parameters: AllowURI, URISchemes.
Expand All @@ -26,11 +26,11 @@ Metrics/LineLength:
# Offense count: 13
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 359
Max: 362

# Offense count: 4
Metrics/PerceivedComplexity:
Max: 96
Max: 97

# Offense count: 7
Style/ClassVars:
Expand Down
8 changes: 6 additions & 2 deletions lib/grape-swagger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def setup(options)
nickname: route.route_nickname || (route.route_method + route.route_path.gsub(/[\/:\(\)\.]/, '-')),
method: route.route_method,
parameters: @@documentation_class.parse_header_params(route.route_headers) + @@documentation_class.parse_params(route.route_params, route.route_path, route.route_method),
type: 'void'
type: route.route_is_array ? 'array' : 'void'
}
operation[:authorizations] = route.route_authorizations unless route.route_authorizations.nil? || route.route_authorizations.empty?
if operation[:parameters].any? { | param | param[:type] == 'File' }
Expand All @@ -464,7 +464,11 @@ def setup(options)

if route.route_entity
type = @@documentation_class.parse_entity_name(route.route_entity)
operation.merge!('type' => type)
if route.route_is_array
operation.merge!(items: { '$ref' => type })
else
operation.merge!(type: type)
end
end

operation[:nickname] = route.route_nickname if route.route_nickname
Expand Down