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 +4 -4
- data/.rubocop_todo.yml +15 -10
- data/.travis.yml +2 -7
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/grape-swagger.gemspec +1 -1
- data/lib/grape-swagger.rb +9 -9
- data/lib/grape-swagger/doc_methods.rb +67 -58
- data/lib/grape-swagger/markdown.rb +1 -1
- data/lib/grape-swagger/version.rb +1 -1
- data/spec/api_description_spec.rb +12 -12
- data/spec/i18n_spec.rb +7 -7
- data/spec/markdown/redcarpet_adapter_spec.rb +1 -1
- data/spec/non_default_api_spec.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4e52b2b16e5431c3ef42aa544c85b084c003cf9
|
4
|
+
data.tar.gz: 86d13f947c54e91c207d58fda741b47f3cddd231
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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-
|
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:
|
11
|
+
Max: 222
|
12
12
|
|
13
13
|
# Offense count: 1
|
14
14
|
# Configuration parameters: CountComments.
|
15
15
|
Metrics/ClassLength:
|
16
|
-
Max:
|
16
|
+
Max: 149
|
17
17
|
|
18
18
|
# Offense count: 7
|
19
19
|
Metrics/CyclomaticComplexity:
|
20
|
-
Max:
|
20
|
+
Max: 42
|
21
21
|
|
22
|
-
# Offense count:
|
22
|
+
# Offense count: 359
|
23
23
|
# Configuration parameters: AllowURI, URISchemes.
|
24
24
|
Metrics/LineLength:
|
25
|
-
Max:
|
25
|
+
Max: 206
|
26
26
|
|
27
27
|
# Offense count: 24
|
28
28
|
# Configuration parameters: CountComments.
|
29
29
|
Metrics/MethodLength:
|
30
|
-
Max:
|
30
|
+
Max: 175
|
31
31
|
|
32
32
|
# Offense count: 1
|
33
33
|
# Configuration parameters: CountComments.
|
34
34
|
Metrics/ModuleLength:
|
35
|
-
Max:
|
35
|
+
Max: 478
|
36
36
|
|
37
37
|
# Offense count: 5
|
38
38
|
Metrics/PerceivedComplexity:
|
39
|
-
Max:
|
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:
|
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.
|
14
|
-
- GRAPE_VERSION=
|
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
data/grape-swagger.gemspec
CHANGED
@@ -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.
|
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.
|
27
|
-
route_match = route_path.split(/^.*?#{route.
|
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.
|
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.
|
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
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
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
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
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
|
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
|
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]
|
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
|
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
|
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
|
-
|
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.
|
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.
|
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.
|
514
|
+
route.description, i18n_scope,
|
511
515
|
[:"#{i18n_key}.desc", :"#{i18n_key}.description"]
|
512
516
|
)
|
513
517
|
notes = @@documentation_class.translate(
|
514
|
-
|
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.
|
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
|
-
|
527
|
+
route_settings_description = route.settings[:description] || {}
|
522
528
|
|
523
529
|
operation = {
|
524
530
|
notes: notes.to_s,
|
525
531
|
summary: summary,
|
526
|
-
nickname:
|
527
|
-
method: route.
|
528
|
-
parameters: @@documentation_class.parse_header_params(route.
|
529
|
-
@@documentation_class.parse_params(route.
|
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:
|
537
|
+
type: route_settings_description[:is_array] ? 'array' : 'void'
|
532
538
|
}
|
533
|
-
|
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
|
544
|
+
operation[:consumes] = ['multipart/form-data']
|
536
545
|
end
|
537
|
-
operation
|
546
|
+
operation[:responseMessages] = http_codes unless http_codes.empty?
|
538
547
|
|
539
|
-
if route.
|
540
|
-
type = @@documentation_class.parse_entity_name(Array(route.
|
541
|
-
if
|
542
|
-
operation
|
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
|
553
|
+
operation[:type] = type
|
545
554
|
end
|
546
555
|
end
|
547
556
|
|
548
|
-
operation[: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
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
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.
|
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,
|
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
|
|
@@ -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.
|
15
|
-
expect(routes.first.
|
16
|
-
expect(routes.last.
|
17
|
-
expect(routes.last.
|
18
|
-
|
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.
|
35
|
-
expect(routes.first.
|
36
|
-
expect(routes.first.
|
37
|
-
expect(routes.last.
|
38
|
-
expect(routes.last.
|
39
|
-
|
40
|
-
expect(routes.last.
|
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: '
|
168
|
-
{ paramType: '
|
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: '
|
187
|
-
{ paramType: '
|
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: '
|
211
|
-
{ paramType: '
|
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
|
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.
|
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.
|
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.
|
26
|
+
version: 0.16.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: grape-entity
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|