grape-swagger 0.10.5 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3f8731df44d1ab1e6d42e1a7d564b4af02bd869
4
- data.tar.gz: 4be17285838269c75ae17474f76f4c50cd9de15d
3
+ metadata.gz: d4e52b2b16e5431c3ef42aa544c85b084c003cf9
4
+ data.tar.gz: 86d13f947c54e91c207d58fda741b47f3cddd231
5
5
  SHA512:
6
- metadata.gz: b4821a7d1447484af17e69003e451f2e009315c81e074843037f229aaf48bbe9e1482413f4a99d2bce972dfadbc546f92982483f7ea6f92711cbdf33be9636cf
7
- data.tar.gz: 185563d4b0e9e1b2ddcb9930e283f685108b7d710db340136e31f0e37fb1a25904f0138987b2fe6b046e0d6f0fb4bfffca18ff4b1cae0f7a8bd48c9f65b47daf
6
+ metadata.gz: f96ee66b108a5880309103e38fc2137bdbb3e993c679c192d943fdec6a467a57008babc39c4379c2a9f6c77e5da93d80f8c98b0996a35d09d4117a1355b13d37
7
+ data.tar.gz: 6041bc57d9612d87ccc5acf9c38089703835b3fa3f5a78233e63fec91866e5a82973da24c22cd78cf0b77758116562c5f3f7258cb48e0b0d23e5ea54d308ff46
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-02-07 23:26:32 +0900 using RuboCop version 0.33.0.
3
+ # on 2016-04-09 20:38:17 -0400 using RuboCop version 0.33.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -8,35 +8,35 @@
8
8
 
9
9
  # Offense count: 14
10
10
  Metrics/AbcSize:
11
- Max: 214
11
+ Max: 222
12
12
 
13
13
  # Offense count: 1
14
14
  # Configuration parameters: CountComments.
15
15
  Metrics/ClassLength:
16
- Max: 150
16
+ Max: 149
17
17
 
18
18
  # Offense count: 7
19
19
  Metrics/CyclomaticComplexity:
20
- Max: 39
20
+ Max: 42
21
21
 
22
- # Offense count: 354
22
+ # Offense count: 359
23
23
  # Configuration parameters: AllowURI, URISchemes.
24
24
  Metrics/LineLength:
25
- Max: 242
25
+ Max: 206
26
26
 
27
27
  # Offense count: 24
28
28
  # Configuration parameters: CountComments.
29
29
  Metrics/MethodLength:
30
- Max: 169
30
+ Max: 175
31
31
 
32
32
  # Offense count: 1
33
33
  # Configuration parameters: CountComments.
34
34
  Metrics/ModuleLength:
35
- Max: 472
35
+ Max: 478
36
36
 
37
37
  # Offense count: 5
38
38
  Metrics/PerceivedComplexity:
39
- Max: 40
39
+ Max: 44
40
40
 
41
41
  # Offense count: 8
42
42
  Style/ClassVars:
@@ -44,7 +44,7 @@ Style/ClassVars:
44
44
  - 'example/api.rb'
45
45
  - 'lib/grape-swagger/doc_methods.rb'
46
46
 
47
- # Offense count: 95
47
+ # Offense count: 96
48
48
  Style/Documentation:
49
49
  Enabled: false
50
50
 
@@ -61,6 +61,11 @@ Style/FileName:
61
61
  - 'spec/grape-swagger_helper_spec.rb'
62
62
  - 'spec/grape-swagger_spec.rb'
63
63
 
64
+ # Offense count: 1
65
+ Style/MultilineBlockChain:
66
+ Exclude:
67
+ - 'lib/grape-swagger/doc_methods.rb'
68
+
64
69
  # Offense count: 1
65
70
  # Configuration parameters: NamePrefix, NamePrefixBlacklist.
66
71
  Style/PredicateName:
data/.travis.yml CHANGED
@@ -10,13 +10,8 @@ rvm:
10
10
  - rbx-2
11
11
 
12
12
  env:
13
- - GRAPE_VERSION=0.10.0
14
- - GRAPE_VERSION=0.10.1
15
- - GRAPE_VERSION=0.11.0
16
- - GRAPE_VERSION=0.12.0
17
- - GRAPE_VERSION=0.13.0
18
- - GRAPE_VERSION=0.14.0
19
- # - GRAPE_VERSION=HEAD
13
+ - GRAPE_VERSION=0.16.2
14
+ - GRAPE_VERSION=HEAD
20
15
 
21
16
  matrix:
22
17
  allow_failures:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 0.11.0 (Next)
2
+
3
+ #### Features
4
+
5
+ * [#368](https://github.com/ruby-grape/grape-swagger/pull/368): Requires Grape 0.16.2, fixes `route_xxx` deprecation messages - [@dblock](https://github.com/dblock).
6
+
1
7
  ### 0.10.5 (2016-04-12)
2
8
 
3
9
  * [#338](https://github.com/ruby-grape/grape-swagger/pull/338): Fixed handling of nested Array parameters - [@itoufo](https://github.com/itoufo).
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- case version = ENV['GRAPE_VERSION'] || '~> 0.10.0'
5
+ case version = ENV['GRAPE_VERSION'] || '~> 0.16.2'
6
6
  when 'HEAD'
7
7
  gem 'grape', github: 'ruby-grape/grape'
8
8
  else
@@ -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.10.0'
14
+ s.add_runtime_dependency 'grape', '>= 0.16.2'
15
15
  s.add_runtime_dependency 'grape-entity', '< 0.5.0'
16
16
 
17
17
  s.add_development_dependency 'rake'
data/lib/grape-swagger.rb CHANGED
@@ -23,15 +23,15 @@ module Grape
23
23
 
24
24
  @target_class.combined_routes = {}
25
25
  @target_class.routes.each do |route|
26
- route_path = route.route_path
27
- route_match = route_path.split(/^.*?#{route.route_prefix.to_s}/).last
26
+ route_path = route.path
27
+ route_match = route_path.split(/^.*?#{route.prefix.to_s}/).last
28
28
  next unless route_match
29
29
  route_match = route_match.match('\/([\w|-]*?)[\.\/\(]') || route_match.match('\/([\w|-]*)$')
30
30
  next unless route_match
31
31
  resource = route_match.captures.first
32
32
  next if resource.empty?
33
33
  @target_class.combined_routes[resource] ||= []
34
- next if documentation_class.hide_documentation_path && route.route_path.match(/#{documentation_class.mount_path}($|\/|\(\.)/)
34
+ next if documentation_class.hide_documentation_path && route.path.match(/#{documentation_class.mount_path}($|\/|\(\.)/)
35
35
  @target_class.combined_routes[resource] << route
36
36
  end
37
37
 
@@ -77,17 +77,17 @@ module Grape
77
77
  parent_route = @target_class.combined_routes[parent_route_name]
78
78
  # fetch all routes that are within the current namespace
79
79
  namespace_routes = parent_route.collect do |route|
80
- route if (route.route_path.start_with?(route.route_prefix ? "/#{route.route_prefix}/#{name}" : "/#{name}") || route.route_path.start_with?((route.route_prefix ? "/#{route.route_prefix}/:version/#{name}" : "/:version/#{name}"))) &&
80
+ route if (route.path.start_with?(route.prefix ? "/#{route.prefix}/#{name}" : "/#{name}") || route.path.start_with?((route.prefix ? "/#{route.prefix}/:version/#{name}" : "/:version/#{name}"))) &&
81
81
  (route.instance_variable_get(:@options)[:namespace] == "/#{name}" || route.instance_variable_get(:@options)[:namespace] == "/:version/#{name}")
82
82
  end.compact
83
83
 
84
84
  if namespace.options.key?(:swagger) && namespace.options[:swagger][:nested] == false
85
85
  # Namespace shall appear as standalone resource, use specified name or use normalized path as name
86
- if namespace.options[:swagger].key?(:name)
87
- identifier = namespace.options[:swagger][:name].tr(' ', '-')
88
- else
89
- identifier = name.tr('_', '-').gsub(/\//, '_')
90
- end
86
+ identifier = if namespace.options[:swagger].key?(:name)
87
+ namespace.options[:swagger][:name].tr(' ', '-')
88
+ else
89
+ name.tr('_', '-').gsub(/\//, '_')
90
+ end
91
91
  @target_class.combined_namespace_identifiers[identifier] = name
92
92
  @target_class.combined_namespace_routes[identifier] = namespace_routes
93
93
 
@@ -10,7 +10,7 @@ module GrapeSwagger
10
10
  'byte' => %w(string byte),
11
11
  'date' => %w(string date),
12
12
  'dateTime' => %w(string date-time)
13
- }
13
+ }.freeze
14
14
 
15
15
  def name
16
16
  @@class_name
@@ -64,31 +64,31 @@ module GrapeSwagger
64
64
 
65
65
  raw_data_type = value[:type] if value.is_a?(Hash)
66
66
  raw_data_type ||= 'string'
67
- data_type = case raw_data_type.to_s
68
- when 'Hash'
69
- 'object'
70
- when 'Rack::Multipart::UploadedFile'
71
- 'File'
72
- when 'Virtus::Attribute::Boolean'
73
- 'boolean'
74
- when 'Boolean', 'Date', 'Integer', 'String', 'Float'
75
- raw_data_type.to_s.downcase
76
- when 'BigDecimal'
77
- 'long'
78
- when 'DateTime'
79
- 'dateTime'
80
- when 'Numeric'
81
- 'double'
82
- when 'Symbol'
83
- 'string'
84
- when /^\[(?<type>.*)\]$/
85
- items[:type] = Regexp.last_match[:type].downcase
86
- if PRIMITIVE_MAPPINGS.key?(items[:type])
87
- items[:type], items[:format] = PRIMITIVE_MAPPINGS[items[:type]]
88
- end
89
- 'array'
90
- else
91
- @@documentation_class.parse_entity_name(raw_data_type)
67
+ data_type = case raw_data_type.to_s
68
+ when 'Hash'
69
+ 'object'
70
+ when 'Rack::Multipart::UploadedFile'
71
+ 'File'
72
+ when 'Virtus::Attribute::Boolean'
73
+ 'boolean'
74
+ when 'Boolean', 'Date', 'Integer', 'String', 'Float'
75
+ raw_data_type.to_s.downcase
76
+ when 'BigDecimal'
77
+ 'long'
78
+ when 'DateTime'
79
+ 'dateTime'
80
+ when 'Numeric'
81
+ 'double'
82
+ when 'Symbol'
83
+ 'string'
84
+ when /^\[(?<type>.*)\]$/
85
+ items[:type] = Regexp.last_match[:type].downcase
86
+ if PRIMITIVE_MAPPINGS.key?(items[:type])
87
+ items[:type], items[:format] = PRIMITIVE_MAPPINGS[items[:type]]
88
+ end
89
+ 'array'
90
+ else
91
+ @@documentation_class.parse_entity_name(raw_data_type)
92
92
  end
93
93
 
94
94
  additional_documentation = value.is_a?(Hash) ? value[:documentation] : nil
@@ -125,7 +125,7 @@ module GrapeSwagger
125
125
  'query'
126
126
  end
127
127
  end
128
- name = (value.is_a?(Hash) && value[:full_name]) || param
128
+ name = (value.is_a?(Hash) && value[:full_name]) || param
129
129
  description = translate(description, scope,
130
130
  i18n_keys.map { |key| :"#{key}.params.#{name}" })
131
131
 
@@ -202,7 +202,7 @@ module GrapeSwagger
202
202
  required: required
203
203
  }
204
204
 
205
- parsed_params.merge!(defaultValue: default_value) if default_value
205
+ parsed_params[:defaultValue] = default_value if default_value
206
206
 
207
207
  parsed_params
208
208
  end
@@ -330,7 +330,7 @@ module GrapeSwagger
330
330
  end
331
331
 
332
332
  def generate_typeref(type)
333
- type_s = type.to_s.sub(/^[A-Z]/) { |f| f.downcase }
333
+ type_s = type.to_s.sub(/^[A-Z]/, &:downcase)
334
334
  if is_primitive? type_s
335
335
  { 'type' => type_s }
336
336
  else
@@ -423,7 +423,7 @@ module GrapeSwagger
423
423
  params do
424
424
  optional :locale, type: Symbol, desc: 'Locale of API documentation'
425
425
  end
426
- get "#{@@mount_path}" do
426
+ get @@mount_path.to_s do
427
427
  I18n.locale = params[:locale] || I18n.default_locale
428
428
  header['Access-Control-Allow-Origin'] = '*'
429
429
  header['Access-Control-Request-Method'] = '*'
@@ -436,7 +436,9 @@ module GrapeSwagger
436
436
  end
437
437
 
438
438
  namespace_routes_array = namespace_routes.keys.map do |local_route|
439
- next if namespace_routes[local_route].map(&:route_hidden).all? { |value| value.respond_to?(:call) ? value.call : value }
439
+ next if namespace_routes[local_route].map do |route|
440
+ route.settings[:description] && route.settings[:description][:hidden]
441
+ end.all? { |value| value.respond_to?(:call) ? value.call : value }
440
442
 
441
443
  url_format = '.{format}' unless @@hide_format
442
444
  url_locale = "?locale=#{params[:locale]}" unless params[:locale].blank?
@@ -488,11 +490,12 @@ module GrapeSwagger
488
490
  error!('Not Found', 404) unless routes
489
491
 
490
492
  visible_ops = routes.reject do |route|
491
- route.route_hidden.respond_to?(:call) ? route.route_hidden.call : route.route_hidden
493
+ hidden = route.options[:hidden]
494
+ hidden && hidden.respond_to?(:call) ? hidden.call : hidden
492
495
  end
493
496
 
494
497
  ops = visible_ops.group_by do |route|
495
- @@documentation_class.parse_path(route.route_path, api_version)
498
+ @@documentation_class.parse_path(route.path, api_version)
496
499
  end
497
500
 
498
501
  error!('Not Found', 404) unless ops.any?
@@ -501,51 +504,57 @@ module GrapeSwagger
501
504
 
502
505
  ops.each do |path, op_routes|
503
506
  operations = op_routes.map do |route|
507
+ route_settings_description = route.settings[:description] || {}
504
508
  endpoint = target_class.endpoint_mapping[route.to_s.sub('(.:format)', '')]
505
509
  endpoint_path = endpoint.options[:path] unless endpoint.nil?
506
- i18n_key = [route.route_namespace, endpoint_path, route.route_method.downcase].flatten.join('/')
510
+ i18n_key = [route.namespace, endpoint_path, route.request_method.downcase].flatten.join('/')
507
511
  i18n_key = i18n_key.split('/').reject(&:empty?).join('.')
508
512
 
509
513
  summary = @@documentation_class.translate(
510
- route.route_description, i18n_scope,
514
+ route.description, i18n_scope,
511
515
  [:"#{i18n_key}.desc", :"#{i18n_key}.description"]
512
516
  )
513
517
  notes = @@documentation_class.translate(
514
- route.route_detail || route.route_notes, i18n_scope,
518
+ route_settings_description[:detail] || route_settings_description[:notes], i18n_scope,
515
519
  [:"#{i18n_key}.detail", :"#{i18n_key}.notes"]
516
520
  )
517
521
  notes = @@documentation_class.as_markdown(notes)
518
522
 
519
- http_codes = @@documentation_class.parse_http_codes(route.route_http_codes, models)
523
+ http_codes = @@documentation_class.parse_http_codes(route.http_codes, models)
524
+
525
+ models.merge(Array(route.entity)) if route.entity.present?
520
526
 
521
- models.merge(Array(route.route_entity)) if route.route_entity.present?
527
+ route_settings_description = route.settings[:description] || {}
522
528
 
523
529
  operation = {
524
530
  notes: notes.to_s,
525
531
  summary: summary,
526
- nickname: route.route_nickname || (route.route_method + route.route_path.gsub(/[\/:\(\)\.]/, '-')),
527
- method: route.route_method,
528
- parameters: @@documentation_class.parse_header_params(route.route_headers, scope: i18n_scope, key: i18n_key) +
529
- @@documentation_class.parse_params(route.route_params, route.route_path, route.route_method,
532
+ nickname: route_settings_description[:nickname] || (route.request_method + route.path.gsub(/[\/:\(\)\.]/, '-')),
533
+ method: route.request_method,
534
+ parameters: @@documentation_class.parse_header_params(route.headers, scope: i18n_scope, key: i18n_key) +
535
+ @@documentation_class.parse_params(route.params, route.path, route.request_method,
530
536
  scope: i18n_scope, key: i18n_key),
531
- type: route.route_is_array ? 'array' : 'void'
537
+ type: route_settings_description[:is_array] ? 'array' : 'void'
532
538
  }
533
- operation[:authorizations] = route.route_authorizations unless route.route_authorizations.nil? || route.route_authorizations.empty?
539
+
540
+ authorizations = route_settings_description[:authorizations]
541
+ operation[:authorizations] = authorizations if authorizations && authorizations.any?
542
+
534
543
  if operation[:parameters].any? { |param| param[:type] == 'File' }
535
- operation.merge!(consumes: ['multipart/form-data'])
544
+ operation[:consumes] = ['multipart/form-data']
536
545
  end
537
- operation.merge!(responseMessages: http_codes) unless http_codes.empty?
546
+ operation[:responseMessages] = http_codes unless http_codes.empty?
538
547
 
539
- if route.route_entity
540
- type = @@documentation_class.parse_entity_name(Array(route.route_entity).first)
541
- if route.route_is_array
542
- operation.merge!(items: { '$ref' => type })
548
+ if route.entity
549
+ type = @@documentation_class.parse_entity_name(Array(route.entity).first)
550
+ if route_settings_description[:is_array]
551
+ operation[:items] = { '$ref' => type }
543
552
  else
544
- operation.merge!(type: type)
553
+ operation[:type] = type
545
554
  end
546
555
  end
547
556
 
548
- operation[:nickname] = route.route_nickname if route.route_nickname
557
+ operation[:nickname] = route_settings_description[:nickname] if route_settings_description.key?(:nickname)
549
558
  operation
550
559
  end.compact
551
560
  apis << {
@@ -557,11 +566,11 @@ module GrapeSwagger
557
566
  models = @@documentation_class.models_with_included_presenters(models.to_a.flatten.compact)
558
567
 
559
568
  # use custom resource naming if available
560
- if target_class.combined_namespace_identifiers.key? params[:name]
561
- resource_path = target_class.combined_namespace_identifiers[params[:name]]
562
- else
563
- resource_path = params[:name]
564
- end
569
+ resource_path = if target_class.combined_namespace_identifiers.key? params[:name]
570
+ target_class.combined_namespace_identifiers[params[:name]]
571
+ else
572
+ params[:name]
573
+ end
565
574
  api_description = {
566
575
  apiVersion: api_version,
567
576
  swaggerVersion: '1.2',
@@ -571,7 +580,7 @@ module GrapeSwagger
571
580
  }
572
581
 
573
582
  base_path = @@documentation_class.parse_base_path(options[:base_path], request)
574
- api_description[:basePath] = base_path if base_path && base_path.size > 0 && root_base_path != false
583
+ api_description[:basePath] = base_path if base_path && !base_path.empty? && root_base_path != false
575
584
  api_description[:models] = @@documentation_class.parse_entity_models(models, scope: i18n_scope) unless models.empty?
576
585
  api_description[:authorizations] = authorizations if authorizations
577
586
 
@@ -9,7 +9,7 @@ module GrapeSwagger
9
9
  ###
10
10
  def initialize(adapter)
11
11
  adapter = adapter.new if adapter.is_a?(Class)
12
- fail(ArgumentError, "The configured markdown adapter should implement the method #{:markdown}") unless adapter.respond_to? :markdown
12
+ fail(ArgumentError, 'The configured markdown adapter should implement the method markdown') unless adapter.respond_to? :markdown
13
13
  @adapter = adapter
14
14
  end
15
15
 
@@ -1,3 +1,3 @@
1
1
  module GrapeSwagger
2
- VERSION = '0.10.5'
2
+ VERSION = '0.11.0'.freeze
3
3
  end
@@ -11,11 +11,11 @@ describe 'API Description' do
11
11
  it 'describes the API with defaults' do
12
12
  routes = subject.endpoints.first.routes
13
13
  expect(routes.count).to eq 2
14
- expect(routes.first.route_description).to eq 'Swagger compatible API description'
15
- expect(routes.first.route_params).to eq('locale' => { desc: 'Locale of API documentation', type: 'Symbol', required: false })
16
- expect(routes.last.route_description).to eq 'Swagger compatible API description for specific API'
17
- expect(routes.last.route_params).to eq('name' => { desc: 'Resource name of mounted API', type: 'String', required: true },
18
- 'locale' => { desc: 'Locale of API documentation', type: 'Symbol', required: false })
14
+ expect(routes.first.description).to eq 'Swagger compatible API description'
15
+ expect(routes.first.params).to eq('locale' => { desc: 'Locale of API documentation', type: 'Symbol', required: false })
16
+ expect(routes.last.description).to eq 'Swagger compatible API description for specific API'
17
+ expect(routes.last.params).to eq('name' => { desc: 'Resource name of mounted API', type: 'String', required: true },
18
+ 'locale' => { desc: 'Locale of API documentation', type: 'Symbol', required: false })
19
19
  end
20
20
  end
21
21
 
@@ -31,13 +31,13 @@ describe 'API Description' do
31
31
  it 'describes the API with defaults' do
32
32
  routes = subject.endpoints.first.routes
33
33
  expect(routes.count).to eq 2
34
- expect(routes.first.route_description).to eq 'First'
35
- expect(routes.first.route_params).to eq(x: 1, 'locale' => { desc: 'Locale of API documentation', type: 'Symbol', required: false })
36
- expect(routes.first.route_xx).to eq(11)
37
- expect(routes.last.route_description).to eq 'Second'
38
- expect(routes.last.route_params).to eq('name' => { desc: 'Resource name of mounted API', type: 'String', required: true }, y: 42,
39
- 'locale' => { desc: 'Locale of API documentation', type: 'Symbol', required: false })
40
- expect(routes.last.route_yy).to eq(4242)
34
+ expect(routes.first.description).to eq 'First'
35
+ expect(routes.first.params).to eq(x: 1, 'locale' => { desc: 'Locale of API documentation', type: 'Symbol', required: false })
36
+ expect(routes.first.settings[:description][:xx]).to eq(11)
37
+ expect(routes.last.description).to eq 'Second'
38
+ expect(routes.last.params).to eq('name' => { desc: 'Resource name of mounted API', type: 'String', required: true }, y: 42,
39
+ 'locale' => { desc: 'Locale of API documentation', type: 'Symbol', required: false })
40
+ expect(routes.last.options[:yy]).to eq(4242)
41
41
  end
42
42
  end
43
43
  end
data/spec/i18n_spec.rb CHANGED
@@ -164,8 +164,8 @@ describe 'I18n Default Translation' do
164
164
  summary: 'Finds user by id', notes: ''
165
165
  )
166
166
  expect(result[:apis][api_index][:operations][0][:parameters]).to eq [
167
- { paramType: 'path', name: 'id', description: 'User id', type: 'string', required: true, allowMultiple: false },
168
- { paramType: 'query', name: 'locale', description: "Used to change locale of endpoint's responding message", type: 'string', required: false, allowMultiple: false }
167
+ { paramType: 'query', name: 'locale', description: "Used to change locale of endpoint's responding message", type: 'string', required: false, allowMultiple: false },
168
+ { paramType: 'path', name: 'id', description: 'User id', type: 'string', required: true, allowMultiple: false }
169
169
  ]
170
170
 
171
171
  api_index += 1
@@ -173,8 +173,8 @@ describe 'I18n Default Translation' do
173
173
  summary: "Changes a user's email", notes: ''
174
174
  )
175
175
  expect(result[:apis][api_index][:operations][0][:parameters]).to eq [
176
- { paramType: 'path', name: 'id', description: 'User id', type: 'string', required: true, allowMultiple: false },
177
176
  { paramType: 'form', name: 'locale', description: "Used to change locale of endpoint's responding message", type: 'string', required: false, allowMultiple: false },
177
+ { paramType: 'path', name: 'id', description: 'User id', type: 'string', required: true, allowMultiple: false },
178
178
  { paramType: 'form', name: 'email', description: 'A new email', type: 'string', required: true, allowMultiple: false }
179
179
  ]
180
180
 
@@ -183,8 +183,8 @@ describe 'I18n Default Translation' do
183
183
  summary: "Gets the strength estimation of a user's password", notes: 'The estimation is done by a well-known algorithm when he changed his password'
184
184
  )
185
185
  expect(result[:apis][api_index][:operations][0][:parameters]).to eq [
186
- { paramType: 'path', name: 'id', description: 'User id', type: 'string', required: true, allowMultiple: false },
187
- { paramType: 'query', name: 'locale', description: "Used to change locale of endpoint's responding message", type: 'string', required: false, allowMultiple: false }
186
+ { paramType: 'query', name: 'locale', description: "Used to change locale of endpoint's responding message", type: 'string', required: false, allowMultiple: false },
187
+ { paramType: 'path', name: 'id', description: 'User id', type: 'string', required: true, allowMultiple: false }
188
188
  ]
189
189
  end
190
190
 
@@ -207,8 +207,8 @@ describe 'I18n Default Translation' do
207
207
  summary: 'Gets specific resource API document'
208
208
  )
209
209
  expect(result[:apis][api_index][:operations][0][:parameters]).to eq [
210
- { paramType: 'path', name: 'name', description: 'Resource name', type: 'string', required: true, allowMultiple: false },
211
- { paramType: 'query', name: 'locale', description: "Used to change locale of endpoint's responding message", type: 'string', required: false, allowMultiple: false }
210
+ { paramType: 'query', name: 'locale', description: "Used to change locale of endpoint's responding message", type: 'string', required: false, allowMultiple: false },
211
+ { paramType: 'path', name: 'name', description: 'Resource name', type: 'string', required: true, allowMultiple: false }
212
212
  ]
213
213
  end
214
214
  end
@@ -42,7 +42,7 @@ describe GrapeSwagger::Markdown::RedcarpetAdapter, unless: RUBY_PLATFORM.eql?('j
42
42
  it 'marks down with the configured options' do
43
43
  text = '# hello world #'
44
44
  extensions = { fenced_code_blocks: true, autolink: true }
45
- render_options = { highlighter: :none, no_links: true, highlighter: :none }
45
+ render_options = { highlighter: :none, no_links: true }
46
46
  expect_any_instance_of(Redcarpet::Markdown).to receive(:render).with(text).and_call_original
47
47
 
48
48
  output = GrapeSwagger::Markdown::RedcarpetAdapter.new(extensions: extensions, render_options: render_options).markdown(text)
@@ -11,7 +11,7 @@ describe 'options: ' do
11
11
  end
12
12
 
13
13
  class SimpleApiWithBasePath < Grape::API
14
- NON_DEFAULT_BASE_PATH = 'http://www.breakcoregivesmewood.com'
14
+ NON_DEFAULT_BASE_PATH = 'http://www.breakcoregivesmewood.com'.freeze
15
15
 
16
16
  mount BasePathMountedApi
17
17
  add_swagger_documentation base_path: NON_DEFAULT_BASE_PATH
@@ -119,7 +119,7 @@ describe 'options: ' do
119
119
  end
120
120
 
121
121
  class SimpleApiWithApiVersion < Grape::API
122
- API_VERSION = '101'
122
+ API_VERSION = '101'.freeze
123
123
 
124
124
  mount ApiVersionMountedApi
125
125
  add_swagger_documentation api_version: API_VERSION
@@ -345,7 +345,7 @@ describe 'options: ' do
345
345
  end
346
346
 
347
347
  class SimpleApiWithDifferentMount < Grape::API
348
- MOUNT_PATH = '/api_doc'
348
+ MOUNT_PATH = '/api_doc'.freeze
349
349
 
350
350
  mount DifferentMountMountedApi
351
351
  add_swagger_documentation mount_path: MOUNT_PATH
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-swagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.5
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Vandecasteele
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.10.0
19
+ version: 0.16.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.10.0
26
+ version: 0.16.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: grape-entity
29
29
  requirement: !ruby/object:Gem::Requirement