grape-swagger 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +10 -10
- data/.travis.yml +4 -1
- data/CHANGELOG.md +89 -65
- data/CONTRIBUTING.md +8 -8
- data/Gemfile +1 -1
- data/README.md +90 -16
- data/RELEASING.md +1 -1
- data/UPGRADING.md +20 -3
- data/grape-swagger.gemspec +1 -1
- data/lib/grape-swagger.rb +49 -476
- data/lib/grape-swagger/doc_methods.rb +495 -0
- data/lib/grape-swagger/version.rb +1 -1
- data/spec/api_description_spec.rb +2 -2
- data/spec/api_global_models_spec.rb +21 -21
- data/spec/api_models_spec.rb +62 -42
- data/spec/api_paths_spec.rb +64 -0
- data/spec/api_with_standalone_namespace_spec.rb +16 -16
- data/spec/array_entity_spec.rb +34 -0
- data/spec/array_params_spec.rb +35 -6
- data/spec/default_api_spec.rb +42 -0
- data/spec/float_api_spec.rb +1 -1
- data/spec/grape-swagger_helper_spec.rb +14 -1
- data/spec/mounted_target_class_spec.rb +63 -0
- data/spec/non_default_api_spec.rb +47 -16
- data/spec/param_type_spec.rb +52 -0
- data/spec/param_values_spec.rb +130 -0
- data/spec/reference_entity.rb +80 -0
- data/spec/simple_mounted_api_spec.rb +2 -2
- data/spec/support/grape_version.rb +11 -0
- metadata +50 -40
- data/.ruby-version +0 -1
- data/spec/range_values_spec.rb +0 -49
@@ -139,8 +139,8 @@ describe 'a simple mounted api' do
|
|
139
139
|
'nickname' => 'GET-simple_with_headers---format-',
|
140
140
|
'method' => 'GET',
|
141
141
|
'parameters' => [
|
142
|
-
{ 'paramType' => 'header', 'name' => 'XAuthToken', 'description' => 'A required header.', 'type' => '
|
143
|
-
{ 'paramType' => 'header', 'name' => 'XOtherHeader', 'description' => 'An optional header.', 'type' => '
|
142
|
+
{ 'paramType' => 'header', 'name' => 'XAuthToken', 'description' => 'A required header.', 'type' => 'string', 'required' => true },
|
143
|
+
{ 'paramType' => 'header', 'name' => 'XOtherHeader', 'description' => 'An optional header.', 'type' => 'string', 'required' => false }
|
144
144
|
],
|
145
145
|
'type' => 'void',
|
146
146
|
'responseMessages' => [
|
metadata
CHANGED
@@ -1,139 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-swagger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Vandecasteele
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.8.0
|
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
26
|
version: 0.8.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: grape-entity
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: shoulda
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rdoc
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '3.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: bundler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rack-test
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rack-cors
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
@@ -154,42 +154,42 @@ dependencies:
|
|
154
154
|
name: kramdown
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ~>
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: 1.4.1
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ~>
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 1.4.1
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: redcarpet
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ~>
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: 3.1.2
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - ~>
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: 3.1.2
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: rouge
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - ~>
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: 1.6.1
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - ~>
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: 1.6.1
|
195
195
|
description:
|
@@ -199,14 +199,13 @@ executables: []
|
|
199
199
|
extensions: []
|
200
200
|
extra_rdoc_files: []
|
201
201
|
files:
|
202
|
-
-
|
203
|
-
-
|
204
|
-
-
|
205
|
-
-
|
206
|
-
-
|
207
|
-
-
|
208
|
-
-
|
209
|
-
- ".travis.yml"
|
202
|
+
- .document
|
203
|
+
- .gitignore
|
204
|
+
- .rspec
|
205
|
+
- .rubocop.yml
|
206
|
+
- .rubocop_todo.yml
|
207
|
+
- .ruby-gemset
|
208
|
+
- .travis.yml
|
210
209
|
- CHANGELOG.md
|
211
210
|
- CONTRIBUTING.md
|
212
211
|
- Gemfile
|
@@ -220,6 +219,7 @@ files:
|
|
220
219
|
- example/splines.png
|
221
220
|
- grape-swagger.gemspec
|
222
221
|
- lib/grape-swagger.rb
|
222
|
+
- lib/grape-swagger/doc_methods.rb
|
223
223
|
- lib/grape-swagger/errors.rb
|
224
224
|
- lib/grape-swagger/markdown.rb
|
225
225
|
- lib/grape-swagger/markdown/kramdown_adapter.rb
|
@@ -234,6 +234,7 @@ files:
|
|
234
234
|
- spec/api_with_path_versioning_spec.rb
|
235
235
|
- spec/api_with_prefix_and_namespace_spec.rb
|
236
236
|
- spec/api_with_standalone_namespace_spec.rb
|
237
|
+
- spec/array_entity_spec.rb
|
237
238
|
- spec/array_params_spec.rb
|
238
239
|
- spec/boolean_params_spec.rb
|
239
240
|
- spec/default_api_spec.rb
|
@@ -247,15 +248,19 @@ files:
|
|
247
248
|
- spec/markdown/kramdown_adapter_spec.rb
|
248
249
|
- spec/markdown/markdown_spec.rb
|
249
250
|
- spec/markdown/redcarpet_adapter_spec.rb
|
251
|
+
- spec/mounted_target_class_spec.rb
|
250
252
|
- spec/mutually_exclusive_spec.rb
|
251
253
|
- spec/namespaced_api_spec.rb
|
252
254
|
- spec/non_default_api_spec.rb
|
253
|
-
- spec/
|
255
|
+
- spec/param_type_spec.rb
|
256
|
+
- spec/param_values_spec.rb
|
257
|
+
- spec/reference_entity.rb
|
254
258
|
- spec/response_model_spec.rb
|
255
259
|
- spec/simple_mounted_api_spec.rb
|
256
260
|
- spec/spec_helper.rb
|
261
|
+
- spec/support/grape_version.rb
|
257
262
|
- spec/version_spec.rb
|
258
|
-
homepage: https://github.com/
|
263
|
+
homepage: https://github.com/ruby-grape/grape-swagger
|
259
264
|
licenses:
|
260
265
|
- MIT
|
261
266
|
metadata: {}
|
@@ -265,17 +270,17 @@ require_paths:
|
|
265
270
|
- lib
|
266
271
|
required_ruby_version: !ruby/object:Gem::Requirement
|
267
272
|
requirements:
|
268
|
-
- -
|
273
|
+
- - '>='
|
269
274
|
- !ruby/object:Gem::Version
|
270
275
|
version: '0'
|
271
276
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
272
277
|
requirements:
|
273
|
-
- -
|
278
|
+
- - '>='
|
274
279
|
- !ruby/object:Gem::Version
|
275
280
|
version: '0'
|
276
281
|
requirements: []
|
277
282
|
rubyforge_project:
|
278
|
-
rubygems_version: 2.
|
283
|
+
rubygems_version: 2.4.5
|
279
284
|
signing_key:
|
280
285
|
specification_version: 4
|
281
286
|
summary: A simple way to add auto generated documentation to your Grape API that can
|
@@ -290,6 +295,7 @@ test_files:
|
|
290
295
|
- spec/api_with_path_versioning_spec.rb
|
291
296
|
- spec/api_with_prefix_and_namespace_spec.rb
|
292
297
|
- spec/api_with_standalone_namespace_spec.rb
|
298
|
+
- spec/array_entity_spec.rb
|
293
299
|
- spec/array_params_spec.rb
|
294
300
|
- spec/boolean_params_spec.rb
|
295
301
|
- spec/default_api_spec.rb
|
@@ -303,11 +309,15 @@ test_files:
|
|
303
309
|
- spec/markdown/kramdown_adapter_spec.rb
|
304
310
|
- spec/markdown/markdown_spec.rb
|
305
311
|
- spec/markdown/redcarpet_adapter_spec.rb
|
312
|
+
- spec/mounted_target_class_spec.rb
|
306
313
|
- spec/mutually_exclusive_spec.rb
|
307
314
|
- spec/namespaced_api_spec.rb
|
308
315
|
- spec/non_default_api_spec.rb
|
309
|
-
- spec/
|
316
|
+
- spec/param_type_spec.rb
|
317
|
+
- spec/param_values_spec.rb
|
318
|
+
- spec/reference_entity.rb
|
310
319
|
- spec/response_model_spec.rb
|
311
320
|
- spec/simple_mounted_api_spec.rb
|
312
321
|
- spec/spec_helper.rb
|
322
|
+
- spec/support/grape_version.rb
|
313
323
|
- spec/version_spec.rb
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby-2.1.2
|
data/spec/range_values_spec.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Range Params' do
|
4
|
-
def app
|
5
|
-
Class.new(Grape::API) do
|
6
|
-
format :json
|
7
|
-
|
8
|
-
params do
|
9
|
-
requires :letter, type: String, values: 'a'..'z'
|
10
|
-
end
|
11
|
-
post :letter do
|
12
|
-
end
|
13
|
-
|
14
|
-
params do
|
15
|
-
requires :number, type: Integer, values: -5..5
|
16
|
-
end
|
17
|
-
post :integer do
|
18
|
-
end
|
19
|
-
|
20
|
-
add_swagger_documentation
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
subject(:letter) do
|
25
|
-
get '/swagger_doc/letter'
|
26
|
-
expect(last_response.status).to eq 200
|
27
|
-
body = JSON.parse last_response.body
|
28
|
-
body['apis'].first['operations'].first['parameters']
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'has letter range values' do
|
32
|
-
expect(letter).to eq [
|
33
|
-
{ 'paramType' => 'form', 'name' => 'letter', 'description' => nil, 'type' => 'string', 'required' => true, 'allowMultiple' => false, 'enum' => ('a'..'z').to_a }
|
34
|
-
]
|
35
|
-
end
|
36
|
-
|
37
|
-
subject(:number) do
|
38
|
-
get '/swagger_doc/integer'
|
39
|
-
expect(last_response.status).to eq 200
|
40
|
-
body = JSON.parse last_response.body
|
41
|
-
body['apis'].first['operations'].first['parameters']
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'has number range values' do
|
45
|
-
expect(number).to eq [
|
46
|
-
{ 'paramType' => 'form', 'name' => 'number', 'description' => nil, 'type' => 'integer', 'required' => true, 'allowMultiple' => false, 'format' => 'int32', 'enum' => (-5..5).to_a }
|
47
|
-
]
|
48
|
-
end
|
49
|
-
end
|