grape 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grape might be problematic. Click here for more details.

Files changed (87) hide show
  1. checksums.yaml +5 -5
  2. data/Appraisals +1 -1
  3. data/CHANGELOG.md +18 -0
  4. data/Dangerfile +1 -0
  5. data/Gemfile +9 -10
  6. data/Gemfile.lock +42 -40
  7. data/LICENSE +1 -1
  8. data/README.md +89 -40
  9. data/Rakefile +1 -46
  10. data/gemfiles/multi_json.gemfile +9 -10
  11. data/gemfiles/multi_xml.gemfile +9 -10
  12. data/gemfiles/rack_1.5.2.gemfile +9 -10
  13. data/gemfiles/rack_edge.gemfile +9 -10
  14. data/gemfiles/rails_3.gemfile +9 -10
  15. data/gemfiles/rails_4.gemfile +9 -10
  16. data/gemfiles/rails_5.gemfile +9 -10
  17. data/gemfiles/rails_edge.gemfile +9 -10
  18. data/grape.gemspec +3 -3
  19. data/lib/grape/api.rb +2 -2
  20. data/lib/grape/dsl/inside_route.rb +30 -10
  21. data/lib/grape/dsl/routing.rb +1 -1
  22. data/lib/grape/dsl/settings.rb +6 -6
  23. data/lib/grape/endpoint.rb +1 -1
  24. data/lib/grape/exceptions/incompatible_option_values.rb +0 -1
  25. data/lib/grape/exceptions/invalid_accept_header.rb +0 -1
  26. data/lib/grape/exceptions/invalid_formatter.rb +0 -1
  27. data/lib/grape/exceptions/invalid_message_body.rb +0 -1
  28. data/lib/grape/exceptions/invalid_version_header.rb +0 -1
  29. data/lib/grape/exceptions/invalid_versioner_option.rb +0 -1
  30. data/lib/grape/exceptions/invalid_with_option_for_represent.rb +0 -1
  31. data/lib/grape/exceptions/method_not_allowed.rb +0 -1
  32. data/lib/grape/exceptions/missing_group_type.rb +0 -1
  33. data/lib/grape/exceptions/missing_mime_type.rb +0 -1
  34. data/lib/grape/exceptions/missing_option.rb +0 -1
  35. data/lib/grape/exceptions/missing_vendor_option.rb +0 -1
  36. data/lib/grape/exceptions/unknown_options.rb +0 -1
  37. data/lib/grape/exceptions/unknown_parameter.rb +0 -1
  38. data/lib/grape/exceptions/unknown_validator.rb +0 -1
  39. data/lib/grape/exceptions/unsupported_group_type.rb +0 -1
  40. data/lib/grape/namespace.rb +1 -1
  41. data/lib/grape/router.rb +2 -0
  42. data/lib/grape/router/pattern.rb +1 -1
  43. data/lib/grape/router/route.rb +14 -14
  44. data/lib/grape/validations/params_scope.rb +3 -4
  45. data/lib/grape/validations/types.rb +14 -1
  46. data/lib/grape/validations/types/build_coercer.rb +8 -0
  47. data/lib/grape/validations/types/custom_type_coercer.rb +1 -1
  48. data/lib/grape/validations/types/custom_type_collection_coercer.rb +71 -0
  49. data/lib/grape/validations/validators/allow_blank.rb +1 -1
  50. data/lib/grape/validations/validators/base.rb +1 -0
  51. data/lib/grape/validations/validators/coerce.rb +6 -0
  52. data/lib/grape/version.rb +1 -1
  53. data/pkg/grape-1.0.1.gem +0 -0
  54. data/spec/grape/api_spec.rb +22 -12
  55. data/spec/grape/dsl/inside_route_spec.rb +1 -1
  56. data/spec/grape/dsl/parameters_spec.rb +5 -5
  57. data/spec/grape/dsl/settings_spec.rb +2 -2
  58. data/spec/grape/endpoint_spec.rb +25 -12
  59. data/spec/grape/entity_spec.rb +1 -1
  60. data/spec/grape/exceptions/invalid_formatter_spec.rb +0 -1
  61. data/spec/grape/exceptions/invalid_versioner_option_spec.rb +0 -1
  62. data/spec/grape/exceptions/missing_option_spec.rb +0 -1
  63. data/spec/grape/exceptions/unknown_options_spec.rb +1 -2
  64. data/spec/grape/exceptions/unknown_validator_spec.rb +0 -1
  65. data/spec/grape/exceptions/validation_errors_spec.rb +1 -1
  66. data/spec/grape/middleware/exception_spec.rb +36 -12
  67. data/spec/grape/middleware/formatter_spec.rb +1 -1
  68. data/spec/grape/middleware/versioner/header_spec.rb +1 -1
  69. data/spec/grape/middleware/versioner/param_spec.rb +1 -1
  70. data/spec/grape/middleware/versioner/path_spec.rb +1 -1
  71. data/spec/grape/path_spec.rb +3 -3
  72. data/spec/grape/util/inheritable_setting_spec.rb +2 -2
  73. data/spec/grape/util/reverse_stackable_values_spec.rb +13 -13
  74. data/spec/grape/util/stackable_values_spec.rb +13 -13
  75. data/spec/grape/util/strict_hash_configuration_spec.rb +1 -1
  76. data/spec/grape/validations/params_scope_spec.rb +19 -7
  77. data/spec/grape/validations/validators/all_or_none_spec.rb +1 -1
  78. data/spec/grape/validations/validators/at_least_one_of_spec.rb +1 -1
  79. data/spec/grape/validations/validators/coerce_spec.rb +94 -13
  80. data/spec/grape/validations/validators/default_spec.rb +40 -0
  81. data/spec/grape/validations/validators/exactly_one_of_spec.rb +1 -1
  82. data/spec/grape/validations/validators/mutual_exclusion_spec.rb +1 -1
  83. data/spec/grape/validations/validators/values_spec.rb +3 -3
  84. data/spec/grape/validations_spec.rb +9 -9
  85. data/spec/shared/versioning_examples.rb +58 -0
  86. data/spec/support/content_type_helpers.rb +1 -1
  87. metadata +26 -24
data/Rakefile CHANGED
@@ -22,49 +22,4 @@ require 'rainbow/ext/string' unless String.respond_to?(:color)
22
22
  require 'rubocop/rake_task'
23
23
  RuboCop::RakeTask.new
24
24
 
25
- task default: [:rubocop, :spec]
26
-
27
- begin
28
- require 'yard'
29
- DOC_FILES = ['lib/**/*.rb', 'README.md'].freeze
30
-
31
- YARD::Rake::YardocTask.new(:doc) do |t|
32
- t.files = DOC_FILES
33
- end
34
-
35
- namespace :doc do
36
- YARD::Rake::YardocTask.new(:pages) do |t|
37
- t.files = DOC_FILES
38
- t.options = ['-o', '../grape.doc/docs']
39
- end
40
-
41
- namespace :pages do
42
- desc 'Check out gh-pages.'
43
- task :checkout do
44
- dir = File.dirname(__FILE__) + '/../grape.doc'
45
- unless Dir.exist?(dir)
46
- Dir.mkdir(dir)
47
- Dir.chdir(dir) do
48
- system('git init')
49
- system('git remote add origin git@github.com:ruby-grape/grape.git')
50
- system('git pull')
51
- system('git checkout gh-pages')
52
- end
53
- end
54
- end
55
-
56
- desc 'Generate and publish YARD docs to GitHub pages.'
57
- task publish: ['doc:pages:checkout', 'doc:pages'] do
58
- Dir.chdir(File.dirname(__FILE__) + '/../grape.doc') do
59
- system('git checkout gh-pages')
60
- system('git add .')
61
- system('git add -u')
62
- system("git commit -m 'Generating docs for version #{Grape::VERSION}.'")
63
- system('git push origin gh-pages')
64
- end
65
- end
66
- end
67
- end
68
- rescue LoadError # rubocop:disable Lint/HandleExceptions
69
- # ignore
70
- end
25
+ task default: %i[rubocop spec]
@@ -6,31 +6,30 @@ gem 'multi_json', require: 'multi_json'
6
6
 
7
7
  group :development, :test do
8
8
  gem 'bundler'
9
- gem 'rake'
10
- gem 'rubocop', '0.47.0'
11
9
  gem 'hashie'
10
+ gem 'rake'
11
+ gem 'rubocop', '0.51.0'
12
12
  end
13
13
 
14
14
  group :development do
15
+ gem 'appraisal'
16
+ gem 'benchmark-ips'
15
17
  gem 'guard'
16
18
  gem 'guard-rspec'
17
19
  gem 'guard-rubocop'
18
- gem 'yard'
19
- gem 'appraisal'
20
- gem 'benchmark-ips'
21
- gem 'redcarpet'
22
20
  end
23
21
 
24
22
  group :test do
23
+ gem 'cookiejar'
24
+ gem 'coveralls', '~> 0.8.17', require: false
25
+ gem 'danger-toc', '~> 0.1.0'
25
26
  gem 'grape-entity', '~> 0.6'
26
27
  gem 'maruku'
28
+ gem 'mime-types'
29
+ gem 'rack-jsonp', require: 'rack/jsonp'
27
30
  gem 'rack-test', '~> 0.6.3'
28
31
  gem 'rspec', '~> 3.0'
29
- gem 'cookiejar'
30
- gem 'rack-jsonp', require: 'rack/jsonp'
31
- gem 'mime-types'
32
32
  gem 'ruby-grape-danger', '~> 0.1.0', require: false
33
- gem 'coveralls', '~> 0.8.17', require: false
34
33
  end
35
34
 
36
35
  gemspec path: '../'
@@ -6,31 +6,30 @@ gem 'multi_xml', require: 'multi_xml'
6
6
 
7
7
  group :development, :test do
8
8
  gem 'bundler'
9
- gem 'rake'
10
- gem 'rubocop', '0.47.0'
11
9
  gem 'hashie'
10
+ gem 'rake'
11
+ gem 'rubocop', '0.51.0'
12
12
  end
13
13
 
14
14
  group :development do
15
+ gem 'appraisal'
16
+ gem 'benchmark-ips'
15
17
  gem 'guard'
16
18
  gem 'guard-rspec'
17
19
  gem 'guard-rubocop'
18
- gem 'yard'
19
- gem 'appraisal'
20
- gem 'benchmark-ips'
21
- gem 'redcarpet'
22
20
  end
23
21
 
24
22
  group :test do
23
+ gem 'cookiejar'
24
+ gem 'coveralls', '~> 0.8.17', require: false
25
+ gem 'danger-toc', '~> 0.1.0'
25
26
  gem 'grape-entity', '~> 0.6'
26
27
  gem 'maruku'
28
+ gem 'mime-types'
29
+ gem 'rack-jsonp', require: 'rack/jsonp'
27
30
  gem 'rack-test', '~> 0.6.3'
28
31
  gem 'rspec', '~> 3.0'
29
- gem 'cookiejar'
30
- gem 'rack-jsonp', require: 'rack/jsonp'
31
- gem 'mime-types'
32
32
  gem 'ruby-grape-danger', '~> 0.1.0', require: false
33
- gem 'coveralls', '~> 0.8.17', require: false
34
33
  end
35
34
 
36
35
  gemspec path: '../'
@@ -6,31 +6,30 @@ gem 'rack', '1.5.2'
6
6
 
7
7
  group :development, :test do
8
8
  gem 'bundler'
9
- gem 'rake'
10
- gem 'rubocop', '0.47.0'
11
9
  gem 'hashie'
10
+ gem 'rake'
11
+ gem 'rubocop', '0.51.0'
12
12
  end
13
13
 
14
14
  group :development do
15
+ gem 'appraisal'
16
+ gem 'benchmark-ips'
15
17
  gem 'guard'
16
18
  gem 'guard-rspec'
17
19
  gem 'guard-rubocop'
18
- gem 'yard'
19
- gem 'appraisal'
20
- gem 'benchmark-ips'
21
- gem 'redcarpet'
22
20
  end
23
21
 
24
22
  group :test do
23
+ gem 'cookiejar'
24
+ gem 'coveralls', '~> 0.8.17', require: false
25
+ gem 'danger-toc', '~> 0.1.0'
25
26
  gem 'grape-entity', '~> 0.6'
26
27
  gem 'maruku'
28
+ gem 'mime-types'
29
+ gem 'rack-jsonp', require: 'rack/jsonp'
27
30
  gem 'rack-test', '~> 0.6.3'
28
31
  gem 'rspec', '~> 3.0'
29
- gem 'cookiejar'
30
- gem 'rack-jsonp', require: 'rack/jsonp'
31
- gem 'mime-types'
32
32
  gem 'ruby-grape-danger', '~> 0.1.0', require: false
33
- gem 'coveralls', '~> 0.8.17', require: false
34
33
  end
35
34
 
36
35
  gemspec path: '../'
@@ -6,31 +6,30 @@ gem 'rack', github: 'rack/rack'
6
6
 
7
7
  group :development, :test do
8
8
  gem 'bundler'
9
- gem 'rake'
10
- gem 'rubocop', '0.47.0'
11
9
  gem 'hashie'
10
+ gem 'rake'
11
+ gem 'rubocop', '0.51.0'
12
12
  end
13
13
 
14
14
  group :development do
15
+ gem 'appraisal'
16
+ gem 'benchmark-ips'
15
17
  gem 'guard'
16
18
  gem 'guard-rspec'
17
19
  gem 'guard-rubocop'
18
- gem 'yard'
19
- gem 'appraisal'
20
- gem 'benchmark-ips'
21
- gem 'redcarpet'
22
20
  end
23
21
 
24
22
  group :test do
23
+ gem 'cookiejar'
24
+ gem 'coveralls', '~> 0.8.17', require: false
25
+ gem 'danger-toc', '~> 0.1.0'
25
26
  gem 'grape-entity', '~> 0.6'
26
27
  gem 'maruku'
28
+ gem 'mime-types'
29
+ gem 'rack-jsonp', require: 'rack/jsonp'
27
30
  gem 'rack-test', '~> 0.6.3'
28
31
  gem 'rspec', '~> 3.0'
29
- gem 'cookiejar'
30
- gem 'rack-jsonp', require: 'rack/jsonp'
31
- gem 'mime-types'
32
32
  gem 'ruby-grape-danger', '~> 0.1.0', require: false
33
- gem 'coveralls', '~> 0.8.17', require: false
34
33
  end
35
34
 
36
35
  gemspec path: '../'
@@ -7,31 +7,30 @@ gem 'rack-cache', '<= 1.2'
7
7
 
8
8
  group :development, :test do
9
9
  gem 'bundler'
10
- gem 'rake'
11
- gem 'rubocop', '0.47.0'
12
10
  gem 'hashie'
11
+ gem 'rake'
12
+ gem 'rubocop', '0.51.0'
13
13
  end
14
14
 
15
15
  group :development do
16
+ gem 'appraisal'
17
+ gem 'benchmark-ips'
16
18
  gem 'guard'
17
19
  gem 'guard-rspec'
18
20
  gem 'guard-rubocop'
19
- gem 'yard'
20
- gem 'appraisal'
21
- gem 'benchmark-ips'
22
- gem 'redcarpet'
23
21
  end
24
22
 
25
23
  group :test do
24
+ gem 'cookiejar'
25
+ gem 'coveralls', '~> 0.8.17', require: false
26
+ gem 'danger-toc', '~> 0.1.0'
26
27
  gem 'grape-entity', '~> 0.6'
27
28
  gem 'maruku'
29
+ gem 'mime-types'
30
+ gem 'rack-jsonp', require: 'rack/jsonp'
28
31
  gem 'rack-test', '~> 0.6.3'
29
32
  gem 'rspec', '~> 3.0'
30
- gem 'cookiejar'
31
- gem 'rack-jsonp', require: 'rack/jsonp'
32
- gem 'mime-types'
33
33
  gem 'ruby-grape-danger', '~> 0.1.0', require: false
34
- gem 'coveralls', '~> 0.8.17', require: false
35
34
  end
36
35
 
37
36
  gemspec path: '../'
@@ -6,31 +6,30 @@ gem 'rails', '4.1.6'
6
6
 
7
7
  group :development, :test do
8
8
  gem 'bundler'
9
- gem 'rake'
10
- gem 'rubocop', '0.47.0'
11
9
  gem 'hashie'
10
+ gem 'rake'
11
+ gem 'rubocop', '0.51.0'
12
12
  end
13
13
 
14
14
  group :development do
15
+ gem 'appraisal'
16
+ gem 'benchmark-ips'
15
17
  gem 'guard'
16
18
  gem 'guard-rspec'
17
19
  gem 'guard-rubocop'
18
- gem 'yard'
19
- gem 'appraisal'
20
- gem 'benchmark-ips'
21
- gem 'redcarpet'
22
20
  end
23
21
 
24
22
  group :test do
23
+ gem 'cookiejar'
24
+ gem 'coveralls', '~> 0.8.17', require: false
25
+ gem 'danger-toc', '~> 0.1.0'
25
26
  gem 'grape-entity', '~> 0.6'
26
27
  gem 'maruku'
28
+ gem 'mime-types'
29
+ gem 'rack-jsonp', require: 'rack/jsonp'
27
30
  gem 'rack-test', '~> 0.6.3'
28
31
  gem 'rspec', '~> 3.0'
29
- gem 'cookiejar'
30
- gem 'rack-jsonp', require: 'rack/jsonp'
31
- gem 'mime-types'
32
32
  gem 'ruby-grape-danger', '~> 0.1.0', require: false
33
- gem 'coveralls', '~> 0.8.17', require: false
34
33
  end
35
34
 
36
35
  gemspec path: '../'
@@ -6,31 +6,30 @@ gem 'rails', '5.0.0'
6
6
 
7
7
  group :development, :test do
8
8
  gem 'bundler'
9
- gem 'rake'
10
- gem 'rubocop', '0.47.0'
11
9
  gem 'hashie'
10
+ gem 'rake'
11
+ gem 'rubocop', '0.51.0'
12
12
  end
13
13
 
14
14
  group :development do
15
+ gem 'appraisal'
16
+ gem 'benchmark-ips'
15
17
  gem 'guard'
16
18
  gem 'guard-rspec'
17
19
  gem 'guard-rubocop'
18
- gem 'yard'
19
- gem 'appraisal'
20
- gem 'benchmark-ips'
21
- gem 'redcarpet'
22
20
  end
23
21
 
24
22
  group :test do
23
+ gem 'cookiejar'
24
+ gem 'coveralls', '~> 0.8.17', require: false
25
+ gem 'danger-toc', '~> 0.1.0'
25
26
  gem 'grape-entity', '~> 0.6'
26
27
  gem 'maruku'
28
+ gem 'mime-types'
29
+ gem 'rack-jsonp', require: 'rack/jsonp'
27
30
  gem 'rack-test', '~> 0.6.3'
28
31
  gem 'rspec', '~> 3.0'
29
- gem 'cookiejar'
30
- gem 'rack-jsonp', require: 'rack/jsonp'
31
- gem 'mime-types'
32
32
  gem 'ruby-grape-danger', '~> 0.1.0', require: false
33
- gem 'coveralls', '~> 0.8.17', require: false
34
33
  end
35
34
 
36
35
  gemspec path: '../'
@@ -6,31 +6,30 @@ gem 'arel', github: 'rails/arel'
6
6
 
7
7
  group :development, :test do
8
8
  gem 'bundler'
9
- gem 'rake'
10
- gem 'rubocop', '0.47.0'
11
9
  gem 'hashie'
10
+ gem 'rake'
11
+ gem 'rubocop', '0.51.0'
12
12
  end
13
13
 
14
14
  group :development do
15
+ gem 'appraisal'
16
+ gem 'benchmark-ips'
15
17
  gem 'guard'
16
18
  gem 'guard-rspec'
17
19
  gem 'guard-rubocop'
18
- gem 'yard'
19
- gem 'appraisal'
20
- gem 'benchmark-ips'
21
- gem 'redcarpet'
22
20
  end
23
21
 
24
22
  group :test do
23
+ gem 'cookiejar'
24
+ gem 'coveralls', '~> 0.8.17', require: false
25
+ gem 'danger-toc', '~> 0.1.0'
25
26
  gem 'grape-entity', '~> 0.6'
26
27
  gem 'maruku'
28
+ gem 'mime-types'
29
+ gem 'rack-jsonp', require: 'rack/jsonp'
27
30
  gem 'rack-test', '~> 0.6.3'
28
31
  gem 'rspec', '~> 3.0'
29
- gem 'cookiejar'
30
- gem 'rack-jsonp', require: 'rack/jsonp'
31
- gem 'mime-types'
32
32
  gem 'ruby-grape-danger', '~> 0.1.0', require: false
33
- gem 'coveralls', '~> 0.8.17', require: false
34
33
  end
35
34
 
36
35
  gemspec path: '../'
@@ -12,12 +12,12 @@ Gem::Specification.new do |s|
12
12
  s.description = 'A Ruby framework for rapid API development with great conventions.'
13
13
  s.license = 'MIT'
14
14
 
15
- s.add_runtime_dependency 'rack', '>= 1.3.0'
15
+ s.add_runtime_dependency 'activesupport'
16
+ s.add_runtime_dependency 'builder'
16
17
  s.add_runtime_dependency 'mustermann-grape', '~> 1.0.0'
18
+ s.add_runtime_dependency 'rack', '>= 1.3.0'
17
19
  s.add_runtime_dependency 'rack-accept'
18
- s.add_runtime_dependency 'activesupport'
19
20
  s.add_runtime_dependency 'virtus', '>= 1.0.0'
20
- s.add_runtime_dependency 'builder'
21
21
 
22
22
  s.files = Dir['**/*'].keep_if { |file| File.file?(file) }
23
23
  s.test_files = Dir['spec/**/*']
@@ -161,7 +161,7 @@ module Grape
161
161
  route_settings[:endpoint] = route.app
162
162
 
163
163
  # using the :any shorthand produces [nil] for route methods, substitute all manually
164
- route_settings[:methods] = %w(GET PUT POST DELETE PATCH HEAD OPTIONS) if route_settings[:methods].include?('*')
164
+ route_settings[:methods] = %w[GET PUT POST DELETE PATCH HEAD OPTIONS] if route_settings[:methods].include?('*')
165
165
  end
166
166
  end
167
167
 
@@ -195,7 +195,7 @@ module Grape
195
195
  # Generate a route that returns an HTTP 405 response for a user defined
196
196
  # path on methods not specified
197
197
  def generate_not_allowed_method(pattern, allowed_methods: [], **attributes)
198
- not_allowed_methods = %w(GET PUT POST DELETE PATCH HEAD) - allowed_methods
198
+ not_allowed_methods = %w[GET PUT POST DELETE PATCH HEAD] - allowed_methods
199
199
  not_allowed_methods << Grape::Http::Headers::OPTIONS if self.class.namespace_inheritable(:do_not_route_options)
200
200
 
201
201
  return if not_allowed_methods.empty?
@@ -47,9 +47,20 @@ module Grape
47
47
 
48
48
  def declared_hash(passed_params, options, declared_params)
49
49
  declared_params.each_with_object(passed_params.class.new) do |declared_param, memo|
50
- # If it is not a Hash then it does not have children.
51
- # Find its value or set it to nil.
52
- if !declared_param.is_a?(Hash)
50
+ if declared_param.is_a?(Hash)
51
+ declared_param.each_pair do |declared_parent_param, declared_children_params|
52
+ next unless options[:include_missing] || passed_params.key?(declared_parent_param)
53
+
54
+ passed_children_params = passed_params[declared_parent_param] || passed_params.class.new
55
+ memo_key = optioned_param_key(declared_parent_param, options)
56
+
57
+ memo[memo_key] = handle_passed_param(declared_parent_param, passed_children_params) do
58
+ declared(passed_children_params, options, declared_children_params)
59
+ end
60
+ end
61
+ else
62
+ # If it is not a Hash then it does not have children.
63
+ # Find its value or set it to nil.
53
64
  has_alias = route_setting(:aliased_params) && route_setting(:aliased_params).find { |current| current[declared_param] }
54
65
  param_alias = has_alias[declared_param] if has_alias
55
66
 
@@ -60,17 +71,26 @@ module Grape
60
71
  else
61
72
  memo[optioned_param_key(declared_param, options)] = passed_params[declared_param]
62
73
  end
63
- else
64
- declared_param.each_pair do |declared_parent_param, declared_children_params|
65
- next unless options[:include_missing] || passed_params.key?(declared_parent_param)
66
-
67
- passed_children_params = passed_params[declared_parent_param] || passed_params.class.new
68
- memo[optioned_param_key(declared_parent_param, options)] = declared(passed_children_params, options, declared_children_params)
69
- end
70
74
  end
71
75
  end
72
76
  end
73
77
 
78
+ def handle_passed_param(declared_param, passed_children_params, &_block)
79
+ should_be_empty_array?(declared_param, passed_children_params) ? [] : yield
80
+ end
81
+
82
+ def should_be_empty_array?(declared_param, passed_children_params)
83
+ declared_param_is_array?(declared_param) && passed_children_params.empty?
84
+ end
85
+
86
+ def declared_param_is_array?(declared_param)
87
+ route_options_params[declared_param.to_s] && route_options_params[declared_param.to_s][:type] == 'Array'
88
+ end
89
+
90
+ def route_options_params
91
+ options[:route_options][:params] || {}
92
+ end
93
+
74
94
  def optioned_param_key(declared_param, options)
75
95
  options[:stringify] ? declared_param.to_s : declared_param.to_sym
76
96
  end