grape-swagger 0.20.2 → 0.20.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -3
  3. data/.rubocop_todo.yml +43 -33
  4. data/.travis.yml +22 -13
  5. data/CHANGELOG.md +29 -53
  6. data/Gemfile +1 -1
  7. data/README.md +24 -24
  8. data/example/api/endpoints.rb +28 -29
  9. data/example/api/entities.rb +1 -1
  10. data/example/config.ru +5 -7
  11. data/grape-swagger.gemspec +1 -1
  12. data/lib/grape-swagger.rb +9 -6
  13. data/lib/grape-swagger/doc_methods.rb +1 -1
  14. data/lib/grape-swagger/doc_methods/extensions.rb +3 -3
  15. data/lib/grape-swagger/doc_methods/headers.rb +1 -1
  16. data/lib/grape-swagger/doc_methods/move_params.rb +25 -16
  17. data/lib/grape-swagger/doc_methods/operation_id.rb +2 -2
  18. data/lib/grape-swagger/doc_methods/parse_params.rb +12 -5
  19. data/lib/grape-swagger/doc_methods/path_string.rb +1 -1
  20. data/lib/grape-swagger/doc_methods/status_codes.rb +3 -1
  21. data/lib/grape-swagger/doc_methods/tag_name_description.rb +1 -1
  22. data/lib/grape-swagger/endpoint.rb +33 -46
  23. data/lib/grape-swagger/grape/route.rb +16 -0
  24. data/lib/grape-swagger/version.rb +1 -1
  25. data/spec/issues/403_versions_spec.rb +158 -0
  26. data/spec/lib/data_type_spec.rb +9 -10
  27. data/spec/lib/endpoint_spec.rb +1 -2
  28. data/spec/lib/extensions_spec.rb +44 -40
  29. data/spec/lib/move_params_spec.rb +113 -93
  30. data/spec/lib/operation_id_spec.rb +42 -12
  31. data/spec/lib/optional_object_spec.rb +3 -4
  32. data/spec/lib/path_string_spec.rb +2 -2
  33. data/spec/lib/produces_consumes_spec.rb +64 -53
  34. data/spec/markdown/redcarpet_adapter_spec.rb +1 -1
  35. data/spec/spec_helper.rb +1 -1
  36. data/spec/support/api_swagger_v2_result.rb +122 -128
  37. data/spec/support/namespace_tags.rb +17 -19
  38. data/spec/support/the_api_entities.rb +1 -3
  39. data/spec/support/the_paths_definitions.rb +95 -85
  40. data/spec/swagger_v2/api_swagger_v2_definitions-models_spec.rb +1 -1
  41. data/spec/swagger_v2/api_swagger_v2_detail_spec.rb +19 -19
  42. data/spec/swagger_v2/api_swagger_v2_extensions_spec.rb +21 -21
  43. data/spec/swagger_v2/api_swagger_v2_format-content_type_spec.rb +34 -32
  44. data/spec/swagger_v2/api_swagger_v2_global_configuration_spec.rb +5 -7
  45. data/spec/swagger_v2/api_swagger_v2_headers_spec.rb +19 -18
  46. data/spec/swagger_v2/api_swagger_v2_hide_documentation_path_spec.rb +9 -10
  47. data/spec/swagger_v2/api_swagger_v2_mounted_spec.rb +21 -24
  48. data/spec/swagger_v2/api_swagger_v2_param_type_body_nested_spec.rb +90 -92
  49. data/spec/swagger_v2/api_swagger_v2_param_type_body_spec.rb +54 -54
  50. data/spec/swagger_v2/api_swagger_v2_param_type_spec.rb +65 -57
  51. data/spec/swagger_v2/api_swagger_v2_request_params_fix_spec.rb +17 -14
  52. data/spec/swagger_v2/api_swagger_v2_response_spec.rb +79 -123
  53. data/spec/swagger_v2/api_swagger_v2_spec.rb +33 -34
  54. data/spec/swagger_v2/api_swagger_v2_type-format_spec.rb +32 -36
  55. data/spec/swagger_v2/boolean_params_spec.rb +1 -1
  56. data/spec/swagger_v2/default_api_spec.rb +26 -29
  57. data/spec/swagger_v2/description_not_initialized.rb +3 -3
  58. data/spec/swagger_v2/float_api_spec.rb +1 -1
  59. data/spec/swagger_v2/form_params_spec.rb +4 -4
  60. data/spec/swagger_v2/hide_api_spec.rb +48 -51
  61. data/spec/swagger_v2/host.rb +1 -1
  62. data/spec/swagger_v2/mounted_target_class_spec.rb +31 -33
  63. data/spec/swagger_v2/namespace_tags_prefix_spec.rb +23 -21
  64. data/spec/swagger_v2/namespace_tags_spec.rb +23 -20
  65. data/spec/swagger_v2/param_type_spec.rb +5 -6
  66. data/spec/swagger_v2/param_values_spec.rb +31 -37
  67. data/spec/swagger_v2/params_array_spec.rb +17 -15
  68. data/spec/swagger_v2/params_hash_spec.rb +17 -15
  69. data/spec/swagger_v2/params_nested_spec.rb +12 -10
  70. data/spec/swagger_v2/reference_entity.rb +9 -9
  71. data/spec/swagger_v2/response_model_spec.rb +58 -62
  72. data/spec/swagger_v2/simple_mounted_api_spec.rb +179 -147
  73. metadata +5 -10
  74. data/spec/params_entity_spec.rb +0 -49
@@ -6,7 +6,7 @@ module Api
6
6
  expose :id, documentation: { type: Integer, desc: 'identity of a resource' }
7
7
  expose :x, documentation: { type: Float, desc: 'x-value' }
8
8
  expose :y, documentation: { type: Float, desc: 'y-value' }
9
- expose :path, documentation: { type: String, desc: 'the requested resource'}
9
+ expose :path, documentation: { type: String, desc: 'the requested resource' }
10
10
 
11
11
  private
12
12
 
data/example/config.ru CHANGED
@@ -31,14 +31,12 @@ class Base < Grape::API
31
31
  error_response(message: "Internal server error: #{e}", status: 500)
32
32
  end
33
33
 
34
- add_swagger_documentation :hide_documentation_path => true,
35
- :api_version => 'v1',
36
- :info => {
37
- title: "Horses and Hussars",
38
- description: "Demo app for dev of grape swagger 2.0"
34
+ add_swagger_documentation hide_documentation_path: true,
35
+ api_version: 'v1',
36
+ info: {
37
+ title: 'Horses and Hussars',
38
+ description: 'Demo app for dev of grape swagger 2.0'
39
39
  }
40
-
41
40
  end
42
41
 
43
-
44
42
  run Base.new
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.summary = 'A simple way to add auto generated documentation to your Grape API that can be displayed with Swagger.'
12
12
  s.license = 'MIT'
13
13
 
14
- s.add_runtime_dependency 'grape', ['>= 0.12.0', '<= 0.14.0']
14
+ s.add_runtime_dependency 'grape', '>= 0.12.0'
15
15
  s.add_runtime_dependency 'grape-entity'
16
16
  s.add_runtime_dependency 'awesome_print'
17
17
 
data/lib/grape-swagger.rb CHANGED
@@ -1,4 +1,7 @@
1
1
  require 'grape'
2
+
3
+ require 'grape-swagger/grape/route'
4
+
2
5
  require 'grape-swagger/version'
3
6
  require 'grape-swagger/endpoint'
4
7
  require 'grape-swagger/errors'
@@ -48,8 +51,8 @@ module Grape
48
51
 
49
52
  def combine_routes(app, doc_klass)
50
53
  app.routes.each do |route|
51
- route_path = route.route_path
52
- route_match = route_path.split(/^.*?#{route.route_prefix.to_s}/).last
54
+ route_path = route.path
55
+ route_match = route_path.split(/^.*?#{route.prefix.to_s}/).last
53
56
  next unless route_match
54
57
  route_match = route_match.match('\/([\w|-]*?)[\.\/\(]') || route_match.match('\/([\w|-]*)$')
55
58
  next unless route_match
@@ -57,7 +60,7 @@ module Grape
57
60
  next if resource.empty?
58
61
  resource.downcase!
59
62
  @target_class.combined_routes[resource] ||= []
60
- next if doc_klass.hide_documentation_path && route.route_path.match(/#{doc_klass.mount_path}($|\/|\(\.)/)
63
+ next if doc_klass.hide_documentation_path && route.path.match(/#{doc_klass.mount_path}($|\/|\(\.)/)
61
64
  @target_class.combined_routes[resource] << route
62
65
  end
63
66
  end
@@ -141,10 +144,10 @@ module Grape
141
144
  end
142
145
 
143
146
  def route_path_start_with?(route, name)
144
- route_prefix = route.route_prefix ? "/#{route.route_prefix}/#{name}" : "/#{name}"
145
- route_versioned_prefix = route.route_prefix ? "/#{route.route_prefix}/:version/#{name}" : "/:version/#{name}"
147
+ route_prefix = route.prefix ? "/#{route.prefix}/#{name}" : "/#{name}"
148
+ route_versioned_prefix = route.prefix ? "/#{route.prefix}/:version/#{name}" : "/:version/#{name}"
146
149
 
147
- route.route_path.start_with?(route_prefix, route_versioned_prefix)
150
+ route.path.start_with?(route_prefix, route_versioned_prefix)
148
151
  end
149
152
 
150
153
  def standalone_sub_namespaces(name, namespaces)
@@ -91,7 +91,7 @@ module GrapeSwagger
91
91
  {
92
92
  info: {},
93
93
  models: [],
94
- api_version: 'v1',
94
+ doc_version: '0.0.1',
95
95
  target_class: nil,
96
96
  mount_path: '/swagger_doc',
97
97
  host: nil,
@@ -4,10 +4,10 @@ module GrapeSwagger
4
4
  class << self
5
5
  def add(path, definitions, route)
6
6
  @route = route
7
- description = route.route_settings[:description]
7
+ description = route.settings[:description]
8
8
  add_extension_to(path[method], extension(description)) if description && extended?(description, :x)
9
9
 
10
- settings = route.route_settings
10
+ settings = route.settings
11
11
  add_extensions_to_path(settings, path) if settings && extended?(settings, :x_path)
12
12
  add_extensions_to_definition(settings, path, definitions) if settings && extended?(settings, :x_def)
13
13
  end
@@ -67,7 +67,7 @@ module GrapeSwagger
67
67
  end
68
68
 
69
69
  def method
70
- @route.route_method.downcase.to_sym
70
+ @route.request_method.downcase.to_sym
71
71
  end
72
72
  end
73
73
  end
@@ -3,7 +3,7 @@ module GrapeSwagger
3
3
  class Headers
4
4
  class << self
5
5
  def parse(route)
6
- route.route_headers.to_a.map do |route_header|
6
+ route.headers.to_a.map do |route_header|
7
7
  route_header.tap do |header|
8
8
  hash = header[1]
9
9
  description = hash.delete('description')
@@ -4,8 +4,12 @@ module GrapeSwagger
4
4
  class << self
5
5
  def to_definition(paths, definitions)
6
6
  @definitions = definitions
7
- find_post_put(paths) do |path|
8
- find_definition_and_params(path)
7
+
8
+ find_post_put(paths) do |method_definition|
9
+ verb = method_definition.keys.first
10
+ method_object = method_definition[verb]
11
+
12
+ find_definition_and_params(method_object, verb)
9
13
  end
10
14
  end
11
15
 
@@ -16,25 +20,29 @@ module GrapeSwagger
16
20
  end
17
21
  end
18
22
 
19
- def find_definition_and_params(path)
20
- path.keys.each do |verb|
21
- params = path[verb][:parameters]
23
+ def find_definition_and_params(path, verb)
24
+ params = path[:parameters]
22
25
 
23
- next if params.nil?
24
- next unless should_move?(params)
26
+ return if params.nil?
27
+ return unless should_move?(params)
25
28
 
26
- unify!(params)
29
+ unify!(params)
27
30
 
28
- status_code = GrapeSwagger::DocMethods::StatusCodes.get[verb.to_sym][:code]
29
- response = path[verb][:responses][status_code]
30
- referenced_definition = parse_model(response[:schema]['$ref'])
31
+ status_code = GrapeSwagger::DocMethods::StatusCodes.get[verb.to_sym][:code]
32
+ response = path[:responses][status_code]
31
33
 
34
+ if response[:schema] && response[:schema]['$ref']
35
+ referenced_definition = parse_model(response[:schema]['$ref'])
32
36
  name = build_definition(referenced_definition, verb)
33
- move_params_to_new(name, params)
34
-
35
- @definitions[name][:description] = path[verb][:description]
36
- path[verb][:parameters] << build_body_parameter(response.dup, name)
37
+ else
38
+ referenced_definition = path[:operationId]
39
+ name = build_definition(referenced_definition)
37
40
  end
41
+
42
+ move_params_to_new(name, params)
43
+
44
+ @definitions[name][:description] = path[:description]
45
+ path[:parameters] << build_body_parameter(response.dup, name)
38
46
  end
39
47
 
40
48
  def move_params_to_new(name, params)
@@ -88,9 +96,10 @@ module GrapeSwagger
88
96
  private
89
97
 
90
98
  def build_body_parameter(response, name = false)
99
+ entity = response[:schema] ? parse_model(response[:schema]['$ref']) : name
91
100
  body_param = {}
92
101
  body_param.tap do |x|
93
- x[:name] = parse_model(response[:schema]['$ref'])
102
+ x[:name] = entity
94
103
  x[:in] = 'body'
95
104
  x[:required] = true
96
105
  x[:schema] = { '$ref' => response[:schema]['$ref'] } unless name
@@ -2,8 +2,8 @@ module GrapeSwagger
2
2
  module DocMethods
3
3
  class OperationId
4
4
  class << self
5
- def build(method = nil, path = nil)
6
- verb = method.to_s.downcase
5
+ def build(route, path = nil)
6
+ verb = route.request_method.to_s.downcase
7
7
 
8
8
  operation = manipulate(path) unless path.nil?
9
9
 
@@ -3,8 +3,8 @@ module GrapeSwagger
3
3
  class ParseParams
4
4
  class << self
5
5
  def call(param, settings, route)
6
- path = route.route_path
7
- method = route.route_method
6
+ path = route.path
7
+ method = route.request_method
8
8
 
9
9
  data_type = GrapeSwagger::DocMethods::DataType.call(settings)
10
10
  additional_documentation = settings[:documentation]
@@ -14,12 +14,14 @@ module GrapeSwagger
14
14
 
15
15
  value_type = settings.merge(data_type: data_type, path: path, param_name: param, method: method)
16
16
 
17
+ # required properties
17
18
  @parsed_param = {
18
- in: param_type(value_type),
19
- name: settings[:full_name] || param,
20
- description: settings[:desc] || settings[:description] || nil
19
+ in: param_type(value_type),
20
+ name: settings[:full_name] || param
21
21
  }
22
22
 
23
+ # optional properties
24
+ document_description(settings)
23
25
  document_type_and_format(data_type)
24
26
  document_array_param(value_type)
25
27
  document_default_value(settings)
@@ -31,6 +33,11 @@ module GrapeSwagger
31
33
 
32
34
  private
33
35
 
36
+ def document_description(settings)
37
+ description = settings[:desc] || settings[:description]
38
+ @parsed_param[:description] = description if description
39
+ end
40
+
34
41
  def document_required(settings)
35
42
  @parsed_param[:required] = settings[:required] || false
36
43
  @parsed_param[:required] = true if @parsed_param[:in] == 'path'
@@ -14,7 +14,7 @@ module GrapeSwagger
14
14
  item = path.gsub(%r{/{(.+?)}}, '').split('/').last.singularize.underscore.camelize || 'Item'
15
15
 
16
16
  if options[:version] && options[:add_version]
17
- path.sub!('{version}', options[:version])
17
+ path.sub!('{version}', options[:version].to_s)
18
18
  else
19
19
  path.sub!('/{version}', '')
20
20
  end
@@ -8,7 +8,9 @@ module GrapeSwagger
8
8
  post: { code: 201, message: 'created {item}' },
9
9
  put: { code: 200, message: 'updated {item}' },
10
10
  patch: { code: 200, message: 'patched {item}' },
11
- delete: { code: 200, message: 'deleted {item}' }
11
+ delete: { code: 200, message: 'deleted {item}' },
12
+ head: { code: 200, message: 'head {item}' },
13
+ options: { code: 200, message: 'option {item}' }
12
14
  }
13
15
  end
14
16
  end
@@ -8,7 +8,7 @@ module GrapeSwagger
8
8
  namespace_routes = target_class.combined_namespace_routes
9
9
 
10
10
  namespace_routes.keys.map do |local_route|
11
- next if namespace_routes[local_route].map(&:route_hidden).all? { |value| value.respond_to?(:call) ? value.call : value }
11
+ next if namespace_routes[local_route].map { |route| route.options[:hidden] }.all? { |value| value.respond_to?(:call) ? value.call : value }
12
12
 
13
13
  original_namespace_name = target_class.combined_namespace_identifiers.key?(local_route) ? target_class.combined_namespace_identifiers[local_route] : local_route
14
14
  description = namespaces[original_namespace_name] && namespaces[original_namespace_name].options[:desc]
@@ -20,7 +20,7 @@ module Grape
20
20
  # required keys for SwaggerObject
21
21
  def swagger_object(target_class, request, options)
22
22
  {
23
- info: info_object(options[:info].merge(version: options[:api_version])),
23
+ info: info_object(options[:info].merge(version: options[:doc_version])),
24
24
  swagger: '2.0',
25
25
  produces: content_types_for(target_class),
26
26
  authorizations: options[:authorizations],
@@ -86,19 +86,18 @@ module Grape
86
86
  routes.each do |route|
87
87
  next if hidden?(route)
88
88
 
89
- @item, path = GrapeSwagger::DocMethods::PathString.build(route.route_path, options)
90
- @entity = route.route_entity || route.route_success
89
+ @item, path = GrapeSwagger::DocMethods::PathString.build(route.path, options)
90
+ @entity = route.entity || route.options[:success]
91
91
 
92
- method = route.route_method.downcase.to_sym
93
- request_params = method_object(route, options, path)
92
+ verb, method_object = method_object(route, options, path)
94
93
 
95
- if @paths.key?(path.to_sym)
96
- @paths[path.to_sym][method] = request_params
94
+ if @paths.key?(path.to_s)
95
+ @paths[path.to_s][verb] = method_object
97
96
  else
98
- @paths[path.to_sym] = { method => request_params }
97
+ @paths[path.to_s] = { verb => method_object }
99
98
  end
100
99
 
101
- GrapeSwagger::DocMethods::Extensions.add(@paths[path.to_sym], @definitions, route)
100
+ GrapeSwagger::DocMethods::Extensions.add(@paths[path.to_s], @definitions, route)
102
101
  end
103
102
  end
104
103
 
@@ -109,16 +108,18 @@ module Grape
109
108
  method[:consumes] = consumes_object(route, options[:format])
110
109
  method[:parameters] = params_object(route)
111
110
  method[:responses] = response_object(route, options[:markdown])
112
- method[:tags] = tag_object(route, options[:version])
113
- method[:operationId] = GrapeSwagger::DocMethods::OperationId.build(route.route_method, path)
111
+ method[:tags] = tag_object(route, options[:version].to_s)
112
+ method[:operationId] = GrapeSwagger::DocMethods::OperationId.build(route, path)
114
113
  method.delete_if { |_, value| value.blank? }
114
+
115
+ [route.request_method.downcase.to_sym, method]
115
116
  end
116
117
 
117
118
  def description_object(route, markdown)
118
- description = route.route_desc if route.route_desc.present?
119
- description = route.route_description if route.route_description.present?
119
+ description = route.options[:desc] if route.options.key?(:desc)
120
+ description = route.description if route.description.present?
120
121
  description = "# #{description} " if markdown
121
- description += "\n #{route.route_detail}" if route.route_detail
122
+ description += "\n #{route.options[:detail]}" if route.options.key?(:detail)
122
123
  description = markdown.markdown(description.to_s).chomp if markdown
123
124
 
124
125
  description
@@ -127,8 +128,8 @@ module Grape
127
128
  def produces_object(route, format)
128
129
  mime_types = GrapeSwagger::DocMethods::ProducesConsumes.call(format)
129
130
 
130
- route_mime_types = [:route_formats, :route_content_types, :route_produces].map do |producer|
131
- possible = route.send(producer)
131
+ route_mime_types = [:formats, :content_types, :produces].map do |producer|
132
+ possible = route.options[producer]
132
133
  GrapeSwagger::DocMethods::ProducesConsumes.call(possible) if possible.present?
133
134
  end.flatten.compact.uniq
134
135
 
@@ -136,8 +137,8 @@ module Grape
136
137
  end
137
138
 
138
139
  def consumes_object(route, format)
139
- method = route.route_method.downcase.to_sym
140
- format = route.route_settings[:description][:consumes] if route.route_settings[:description] && route.route_settings[:description][:consumes]
140
+ method = route.request_method.downcase.to_sym
141
+ format = route.settings[:description][:consumes] if route.settings[:description] && route.settings[:description][:consumes]
141
142
  mime_types = GrapeSwagger::DocMethods::ProducesConsumes.call(format) if [:post, :put].include?(method)
142
143
 
143
144
  mime_types
@@ -152,11 +153,11 @@ module Grape
152
153
  end
153
154
 
154
155
  def response_object(route, markdown)
155
- default_code = GrapeSwagger::DocMethods::StatusCodes.get[route.route_method.downcase.to_sym]
156
+ default_code = GrapeSwagger::DocMethods::StatusCodes.get[route.request_method.downcase.to_sym]
156
157
  default_code[:model] = @entity if @entity
157
- default_code[:message] = route.route_description || default_code[:message].sub('{item}', @item)
158
+ default_code[:message] = route.description || default_code[:message].sub('{item}', @item)
158
159
 
159
- codes = [default_code] + (route.route_http_codes || route.route_failure || [])
160
+ codes = [default_code] + (route.http_codes || route.options[:failure] || [])
160
161
  codes.map! { |x| x.is_a?(Array) ? { code: x[0], message: x[1], model: x[2] } : x }
161
162
 
162
163
  codes.each_with_object({}) do |value, memo|
@@ -165,7 +166,7 @@ module Grape
165
166
  response_model = @item
166
167
  response_model = expose_params_from_model(value[:model]) if value[:model]
167
168
 
168
- if memo.key?(200) && route.route_method == 'DELETE' && value[:model].nil?
169
+ if memo.key?(200) && route.request_method == 'DELETE' && value[:model].nil?
169
170
  memo[204] = memo.delete(200)
170
171
  value[:code] = 204
171
172
  end
@@ -176,7 +177,7 @@ module Grape
176
177
 
177
178
  @definitions[response_model][:description] = description_object(route, markdown)
178
179
  # TODO: proof that the definition exist, if model isn't specified
179
- memo[value[:code]][:schema] = if route.route_is_array
180
+ memo[value[:code]][:schema] = if route.options[:is_array]
180
181
  { 'type' => 'array', 'items' => { '$ref' => "#/definitions/#{response_model}" } }
181
182
  else
182
183
  { '$ref' => "#/definitions/#{response_model}" }
@@ -185,35 +186,23 @@ module Grape
185
186
  end
186
187
 
187
188
  def tag_object(route, version)
188
- Array(route.route_path.split('{')[0].split('/').reject(&:empty?).delete_if { |i| ((i == route.route_prefix.to_s) || (i == version)) }.first)
189
+ Array(route.path.split('{')[0].split('/').reject(&:empty?).delete_if { |i| ((i == route.prefix.to_s) || (i == version)) }.first)
189
190
  end
190
191
 
191
192
  private
192
193
 
193
194
  def partition_params(route)
194
- declared_params = route.route_settings[:declared_params] if route.route_settings[:declared_params].present?
195
- required, exposed = route.route_params.partition { |x| x.first.is_a? String }
196
- required.concat GrapeSwagger::DocMethods::Headers.parse(route) unless route.route_headers.nil?
195
+ declared_params = route.settings[:declared_params] if route.settings[:declared_params].present?
196
+ required, exposed = route.params.partition { |x| x.first.is_a? String }
197
+ required.concat GrapeSwagger::DocMethods::Headers.parse(route) unless route.headers.nil?
197
198
  default_type(required)
198
199
  default_type(exposed)
199
200
 
200
- unless declared_params.nil? && route.route_headers.nil?
201
+ unless declared_params.nil? && route.headers.nil?
201
202
  request_params = parse_request_params(required)
202
203
  end
203
- if !exposed.empty?
204
- exposed_params = exposed.each_with_object({}) { |x, memo| memo[x.first] = x.last }
205
- properties = parse_response_params(exposed_params)
206
- else
207
- properties = parse_response_params(required)
208
- end
209
-
210
- key = model_name(@entity || @item)
211
204
 
212
- unless properties.empty? || (route.route_method == 'DELETE' && !@entity)
213
- @definitions[key] = { type: 'object', properties: properties } unless @definitions.key?(key)
214
- @definitions[key][:properties].merge!(properties) if @definitions.key?(key)
215
- end
216
- return route.route_params if route.route_params.present? && !route.route_settings[:declared_params].present?
205
+ return route.params if route.params.present? && !route.settings[:declared_params].present?
217
206
  request_params || {}
218
207
  end
219
208
 
@@ -306,11 +295,9 @@ module Grape
306
295
  end
307
296
 
308
297
  def hidden?(route)
309
- if route.route_hidden
310
- return route.route_hidden.is_a?(Proc) ? route.route_hidden.call : route.route_hidden
311
- end
312
-
313
- false
298
+ route_hidden = route.options[:hidden]
299
+ route_hidden = route_hidden.call if route_hidden.is_a?(Proc)
300
+ route_hidden
314
301
  end
315
302
  end
316
303
  end