apipie-rails 1.3.0 → 1.4.1
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/.github/workflows/build.yml +4 -3
- data/.github/workflows/rubocop-challenger.yml +1 -3
- data/.github/workflows/rubocop.yml +1 -1
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +22 -99
- data/CHANGELOG.md +24 -0
- data/Gemfile +2 -3
- data/README.md +2088 -0
- data/apipie-rails.gemspec +8 -1
- data/app/views/apipie/apipies/_method_detail.erb +2 -0
- data/app/views/apipie/apipies/_params.html.erb +1 -0
- data/app/views/apipie/apipies/_params_plain.html.erb +1 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/lib/apipie/application.rb +1 -1
- data/lib/apipie/dsl_definition.rb +3 -3
- data/lib/apipie/error_description.rb +7 -5
- data/lib/apipie/extractor/recorder.rb +3 -3
- data/lib/apipie/extractor/writer.rb +7 -7
- data/lib/apipie/generator/swagger/method_description/response_service.rb +14 -1
- data/lib/apipie/generator/swagger/param_description/in.rb +1 -1
- data/lib/apipie/generator/swagger/type_extractor.rb +1 -1
- data/lib/apipie/generator/swagger/warning.rb +2 -2
- data/lib/apipie/helpers.rb +1 -1
- data/lib/apipie/param_description.rb +1 -1
- data/lib/apipie/response_description.rb +44 -14
- data/lib/apipie/response_description_adapter.rb +1 -1
- data/lib/apipie/routes_formatter.rb +2 -2
- data/lib/apipie/version.rb +1 -1
- data/lib/tasks/apipie.rake +4 -4
- data/rel-eng/gem_release.ipynb +5 -5
- data/spec/controllers/api/v1/architectures_controller_spec.rb +3 -3
- data/spec/controllers/api/v2/nested/resources_controller_spec.rb +1 -1
- data/spec/controllers/concerns_controller_spec.rb +2 -2
- data/spec/controllers/extended_controller_spec.rb +2 -2
- data/spec/controllers/included_param_group_controller_spec.rb +1 -1
- data/spec/controllers/users_controller_spec.rb +65 -64
- data/spec/dummy/app/controllers/api/v2/empty_middle_controller.rb +1 -1
- data/spec/dummy/app/controllers/extending_concern.rb +7 -7
- data/spec/dummy/app/controllers/pets_controller.rb +5 -5
- data/spec/dummy/app/controllers/pets_using_auto_views_controller.rb +2 -2
- data/spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb +16 -16
- data/spec/dummy/app/controllers/sample_controller.rb +31 -31
- data/spec/dummy/app/controllers/twitter_example_controller.rb +3 -3
- data/spec/lib/apipie/apipies_controller_spec.rb +1 -1
- data/spec/lib/apipie/application_spec.rb +2 -2
- data/spec/lib/apipie/extractor/writer_spec.rb +8 -8
- data/spec/lib/apipie/file_handler_spec.rb +1 -1
- data/spec/lib/apipie/generator/swagger/method_description/response_service_spec.rb +62 -0
- data/spec/lib/apipie/generator/swagger/param_description/builder_spec.rb +2 -2
- data/spec/lib/apipie/method_description_spec.rb +2 -2
- data/spec/lib/apipie/param_description_spec.rb +48 -48
- data/spec/lib/apipie/param_group_spec.rb +4 -4
- data/spec/lib/apipie/resource_description_spec.rb +2 -2
- data/spec/lib/apipie/response_description/response_object_spec.rb +22 -0
- data/spec/lib/apipie/response_description_spec.rb +56 -0
- data/spec/lib/apipie/validator_spec.rb +12 -12
- data/spec/lib/swagger/swagger_dsl_spec.rb +39 -39
- data/spec/test_engine/memes_controller_spec.rb +1 -1
- metadata +147 -7
- data/README.rst +0 -1968
@@ -20,22 +20,22 @@ describe Apipie::Validator do
|
|
20
20
|
|
21
21
|
context "expected type" do
|
22
22
|
|
23
|
-
it "
|
23
|
+
it "returns hash for type Hash" do
|
24
24
|
validator = Apipie::Validator::TypeValidator.new(params_desc, Hash)
|
25
25
|
expect(validator.expected_type).to eq('hash')
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "returns array for type Array" do
|
29
29
|
validator = Apipie::Validator::TypeValidator.new(params_desc, Array)
|
30
30
|
expect(validator.expected_type).to eq('array')
|
31
31
|
end
|
32
32
|
|
33
|
-
it "
|
33
|
+
it "returns numeric for type Numeric" do
|
34
34
|
validator = Apipie::Validator::TypeValidator.new(params_desc, Numeric)
|
35
35
|
expect(validator.expected_type).to eq('numeric')
|
36
36
|
end
|
37
37
|
|
38
|
-
it "
|
38
|
+
it "returns string by default" do
|
39
39
|
validator = Apipie::Validator::TypeValidator.new(params_desc, Symbol)
|
40
40
|
expect(validator.expected_type).to eq('string')
|
41
41
|
end
|
@@ -43,7 +43,7 @@ describe Apipie::Validator do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
describe 'NumberValidator' do
|
46
|
-
it '
|
46
|
+
it 'expects a Numeric type' do
|
47
47
|
validator = Apipie::Validator::BaseValidator.find(params_desc, :number, nil, nil)
|
48
48
|
expect(validator.expected_type).to eq('numeric')
|
49
49
|
end
|
@@ -86,7 +86,7 @@ describe Apipie::Validator do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
describe '#validate' do
|
89
|
-
it "
|
89
|
+
it "validates by object class" do
|
90
90
|
expect(validator_instance.validate("1")).to be_truthy
|
91
91
|
expect(validator_instance.validate(1)).to be_truthy
|
92
92
|
expect(validator_instance.validate(true)).to be_truthy
|
@@ -104,21 +104,21 @@ describe Apipie::Validator do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
describe 'ArrayClassValidator' do
|
107
|
-
it "
|
107
|
+
it "validates by object class" do
|
108
108
|
validator = Apipie::Validator::ArrayClassValidator.new(params_desc, [Integer, String])
|
109
109
|
expect(validator.validate("1")).to be_truthy
|
110
110
|
expect(validator.validate(1)).to be_truthy
|
111
111
|
expect(validator.validate({ 1 => 1 })).to be_falsey
|
112
112
|
end
|
113
113
|
|
114
|
-
it "
|
114
|
+
it "has a valid description" do
|
115
115
|
validator = Apipie::Validator::ArrayClassValidator.new(params_desc, [Float, String])
|
116
116
|
expect(validator.description).to eq('Must be one of: <code>Float</code>, <code>String</code>.')
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
120
|
describe 'RegexpValidator' do
|
121
|
-
it "
|
121
|
+
it "validates by object class" do
|
122
122
|
validator = Apipie::Validator::RegexpValidator.new(params_desc, /^valid( extra)*$/)
|
123
123
|
expect(validator.validate("valid")).to be_truthy
|
124
124
|
expect(validator.validate("valid extra")).to be_truthy
|
@@ -126,14 +126,14 @@ describe Apipie::Validator do
|
|
126
126
|
expect(validator.validate("invalid")).to be_falsey
|
127
127
|
end
|
128
128
|
|
129
|
-
it "
|
129
|
+
it "has a valid description" do
|
130
130
|
validator = Apipie::Validator::RegexpValidator.new(params_desc, /^valid( extra)*$/)
|
131
131
|
expect(validator.description).to eq('Must match regular expression <code>/^valid( extra)*$/</code>.')
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
135
|
describe 'EnumValidator' do
|
136
|
-
it "
|
136
|
+
it "validates by object class" do
|
137
137
|
validator = Apipie::Validator::EnumValidator.new(params_desc, ['first', 'second & third'])
|
138
138
|
expect(validator.validate("first")).to be_truthy
|
139
139
|
expect(validator.validate("second & third")).to be_truthy
|
@@ -141,7 +141,7 @@ describe Apipie::Validator do
|
|
141
141
|
expect(validator.validate({ 1 => 1 })).to be_falsey
|
142
142
|
end
|
143
143
|
|
144
|
-
it "
|
144
|
+
it "has a valid description" do
|
145
145
|
validator = Apipie::Validator::EnumValidator.new(params_desc, ['first', 'second & third'])
|
146
146
|
expect(validator.description).to eq('Must be one of: <code>first</code>, <code>second & third</code>.')
|
147
147
|
end
|
@@ -5,10 +5,10 @@ require 'rspec/expectations'
|
|
5
5
|
describe "Swagger Responses" do
|
6
6
|
let(:desc) { Apipie.get_resource_description(controller_class, Apipie.configuration.default_version) }
|
7
7
|
|
8
|
-
let(:swagger)
|
8
|
+
let(:swagger) do
|
9
9
|
Apipie.configuration.generator.swagger.suppress_warnings = true
|
10
10
|
Apipie.to_swagger_json(Apipie.configuration.default_version, controller_class.to_s.underscore.sub("_controller", ""))
|
11
|
-
|
11
|
+
end
|
12
12
|
|
13
13
|
let(:controller_class ) { described_class }
|
14
14
|
|
@@ -122,7 +122,7 @@ describe "Swagger Responses" do
|
|
122
122
|
desc._methods[:index]
|
123
123
|
end
|
124
124
|
|
125
|
-
it "
|
125
|
+
it "returns code 200 with array of entries of the format {'pet_name', 'animal_type'}" do
|
126
126
|
returns_obj = subject.returns.detect{|e| e.code == 200 }
|
127
127
|
|
128
128
|
puts returns_obj.to_json
|
@@ -132,7 +132,7 @@ describe "Swagger Responses" do
|
|
132
132
|
expect(returns_obj).to match_field_structure([:pet_name, :animal_type])
|
133
133
|
end
|
134
134
|
|
135
|
-
it '
|
135
|
+
it 'has the response described in the swagger' do
|
136
136
|
response = swagger_response_for('/pets')
|
137
137
|
expect(response[:description]).to eq("list of pets")
|
138
138
|
|
@@ -145,7 +145,7 @@ describe "Swagger Responses" do
|
|
145
145
|
end
|
146
146
|
|
147
147
|
|
148
|
-
it "
|
148
|
+
it "returns code 401 with a String description field" do
|
149
149
|
returns_obj = subject.returns.detect{|e| e.code == 404 }
|
150
150
|
|
151
151
|
expect(returns_obj.code).to eq(404)
|
@@ -155,7 +155,7 @@ describe "Swagger Responses" do
|
|
155
155
|
end
|
156
156
|
|
157
157
|
|
158
|
-
it "
|
158
|
+
it "returns code 401 with a :reason field (defined in the superclass)" do
|
159
159
|
returns_obj = subject.returns.detect{|e| e.code == 401 }
|
160
160
|
|
161
161
|
expect(returns_obj.code).to eq(401)
|
@@ -164,7 +164,7 @@ describe "Swagger Responses" do
|
|
164
164
|
expect(returns_obj).to match_field_structure([:reason])
|
165
165
|
end
|
166
166
|
|
167
|
-
it '
|
167
|
+
it 'has the 404 response described in the swagger' do
|
168
168
|
response = swagger_response_for('/pets', 404)
|
169
169
|
expect(response[:description]).to eq("Not Found")
|
170
170
|
|
@@ -181,7 +181,7 @@ describe "Swagger Responses" do
|
|
181
181
|
desc._methods[:show_plain_response_with_tags]
|
182
182
|
end
|
183
183
|
|
184
|
-
it "
|
184
|
+
it "returns tags with 'Dogs', 'Cats', and 'LivingBeings'" do
|
185
185
|
returns_obj = subject.tag_list
|
186
186
|
puts returns_obj.inspect
|
187
187
|
|
@@ -194,7 +194,7 @@ describe "Swagger Responses" do
|
|
194
194
|
desc._methods[:show_as_properties]
|
195
195
|
end
|
196
196
|
|
197
|
-
it "
|
197
|
+
it "returns code 200 with 'pet_name' and 'animal_type'" do
|
198
198
|
returns_obj = subject.returns.detect{|e| e.code == 200 }
|
199
199
|
|
200
200
|
puts returns_obj.to_json
|
@@ -204,7 +204,7 @@ describe "Swagger Responses" do
|
|
204
204
|
expect(returns_obj).to match_field_structure([:pet_name, :animal_type])
|
205
205
|
end
|
206
206
|
|
207
|
-
it '
|
207
|
+
it 'has the response described in the swagger' do
|
208
208
|
response = swagger_response_for('/pets/{id}/as_properties')
|
209
209
|
expect(response[:description]).to eq("OK")
|
210
210
|
|
@@ -213,7 +213,7 @@ describe "Swagger Responses" do
|
|
213
213
|
expect(schema).to have_field(:animal_type, 'string', {:description => 'Type of pet', :enum => %w[dog cat iguana kangaroo]})
|
214
214
|
end
|
215
215
|
|
216
|
-
it '
|
216
|
+
it 'has the 404 response description overridden' do
|
217
217
|
returns_obj = subject.returns.detect{|e| e.code == 404 }
|
218
218
|
|
219
219
|
# puts returns_obj.to_json
|
@@ -229,7 +229,7 @@ describe "Swagger Responses" do
|
|
229
229
|
desc._methods[:show_as_param_group_of_properties]
|
230
230
|
end
|
231
231
|
|
232
|
-
it "
|
232
|
+
it "returns code 200 with 'pet_name' and 'animal_type'" do
|
233
233
|
returns_obj = subject.returns.detect{|e| e.code == 200 }
|
234
234
|
|
235
235
|
puts returns_obj.to_json
|
@@ -241,7 +241,7 @@ describe "Swagger Responses" do
|
|
241
241
|
expect(returns_obj.params_ordered[1].is_required?).to be_truthy
|
242
242
|
end
|
243
243
|
|
244
|
-
it '
|
244
|
+
it 'has the response described in the swagger' do
|
245
245
|
response = swagger_response_for('/pets/{id}/as_param_group_of_properties')
|
246
246
|
expect(response[:description]).to eq("The pet")
|
247
247
|
|
@@ -256,7 +256,7 @@ describe "Swagger Responses" do
|
|
256
256
|
desc._methods[:show_pet_by_id]
|
257
257
|
end
|
258
258
|
|
259
|
-
it "
|
259
|
+
it "has only oauth (from ApplicationController), common_param (from resource) and pet_id as an input parameters" do
|
260
260
|
params_obj = subject.params_ordered
|
261
261
|
|
262
262
|
expect(params_obj[0].name).to eq(:oauth)
|
@@ -264,7 +264,7 @@ describe "Swagger Responses" do
|
|
264
264
|
expect(params_obj[2].name).to eq(:pet_id)
|
265
265
|
end
|
266
266
|
|
267
|
-
it "
|
267
|
+
it "returns code 200 with 'pet_id', pet_name' and 'animal_type'" do
|
268
268
|
returns_obj = subject.returns.detect{|e| e.code == 200 }
|
269
269
|
|
270
270
|
puts returns_obj.to_json
|
@@ -275,7 +275,7 @@ describe "Swagger Responses" do
|
|
275
275
|
expect(returns_obj).to match_field_structure([:pet_id, :pet_name, :animal_type])
|
276
276
|
end
|
277
277
|
|
278
|
-
it '
|
278
|
+
it 'has the response described in the swagger' do
|
279
279
|
response = swagger_response_for('/pets/pet_by_id')
|
280
280
|
expect(response[:description]).to eq("OK")
|
281
281
|
|
@@ -304,7 +304,7 @@ describe "Swagger Responses" do
|
|
304
304
|
desc._methods[:get_vote_by_owner_name]
|
305
305
|
end
|
306
306
|
|
307
|
-
it "
|
307
|
+
it "returns code 200 with 'owner_name' and 'vote'" do
|
308
308
|
returns_obj = subject.returns.detect{|e| e.code == 200 }
|
309
309
|
|
310
310
|
puts returns_obj.to_json
|
@@ -314,7 +314,7 @@ describe "Swagger Responses" do
|
|
314
314
|
expect(returns_obj).to match_field_structure([:owner_name, :vote])
|
315
315
|
end
|
316
316
|
|
317
|
-
it '
|
317
|
+
it 'has the response described in the swagger' do
|
318
318
|
response = swagger_response_for('/pets/by_owner_name/did_vote')
|
319
319
|
expect(response[:description]).to eq("OK")
|
320
320
|
|
@@ -329,7 +329,7 @@ describe "Swagger Responses" do
|
|
329
329
|
desc._methods[:show_extra_info]
|
330
330
|
end
|
331
331
|
|
332
|
-
it "
|
332
|
+
it "returns code 201 with 'pet_name' and 'animal_type'" do
|
333
333
|
returns_obj = subject.returns.detect{|e| e.code == 201 }
|
334
334
|
|
335
335
|
puts returns_obj.to_json
|
@@ -339,7 +339,7 @@ describe "Swagger Responses" do
|
|
339
339
|
expect(returns_obj).to match_field_structure([:pet_name, :animal_type])
|
340
340
|
end
|
341
341
|
|
342
|
-
it '
|
342
|
+
it 'has the 201 response described in the swagger' do
|
343
343
|
response = swagger_response_for('/pets/{id}/extra_info', 201)
|
344
344
|
expect(response[:description]).to eq("Found a pet")
|
345
345
|
|
@@ -348,7 +348,7 @@ describe "Swagger Responses" do
|
|
348
348
|
expect(schema).to have_field(:animal_type, 'string')
|
349
349
|
end
|
350
350
|
|
351
|
-
it "
|
351
|
+
it "returns code 202 with spread out 'pet' and encapsulated 'pet_measurements'" do
|
352
352
|
returns_obj = subject.returns.detect{|e| e.code == 202 }
|
353
353
|
|
354
354
|
puts returns_obj.to_json
|
@@ -361,7 +361,7 @@ describe "Swagger Responses" do
|
|
361
361
|
])
|
362
362
|
end
|
363
363
|
|
364
|
-
it '
|
364
|
+
it 'has the 202 response described in the swagger' do
|
365
365
|
response = swagger_response_for('/pets/{id}/extra_info', 202)
|
366
366
|
expect(response[:description]).to eq('Accepted')
|
367
367
|
|
@@ -376,7 +376,7 @@ describe "Swagger Responses" do
|
|
376
376
|
expect(pm_schema).to have_field(:num_legs, 'number', {:description => "Number of legs", :required => false})
|
377
377
|
end
|
378
378
|
|
379
|
-
it "
|
379
|
+
it "returns code 203 with spread out 'pet', encapsulated 'pet_measurements' and encapsulated 'pet_history'" do
|
380
380
|
returns_obj = subject.returns.detect{|e| e.code == 203 }
|
381
381
|
|
382
382
|
puts returns_obj.to_json
|
@@ -391,7 +391,7 @@ describe "Swagger Responses" do
|
|
391
391
|
])
|
392
392
|
end
|
393
393
|
|
394
|
-
it '
|
394
|
+
it 'has the 203 response described in the swagger' do
|
395
395
|
response = swagger_response_for('/pets/{id}/extra_info', 203)
|
396
396
|
expect(response[:description]).to eq('Non-Authoritative Information')
|
397
397
|
|
@@ -418,7 +418,7 @@ describe "Swagger Responses" do
|
|
418
418
|
expect(pai_schema).to have_field(:avg_meals_per_day, 'number')
|
419
419
|
end
|
420
420
|
|
421
|
-
it "
|
421
|
+
it "returns code 204 with array of integer" do
|
422
422
|
returns_obj = subject.returns.detect{|e| e.code == 204 }
|
423
423
|
|
424
424
|
puts returns_obj.to_json
|
@@ -428,7 +428,7 @@ describe "Swagger Responses" do
|
|
428
428
|
expect(returns_obj).to match_field_structure([:int_array, :enum_array])
|
429
429
|
end
|
430
430
|
|
431
|
-
it '
|
431
|
+
it 'has the 204 response described in the swagger' do
|
432
432
|
response = swagger_response_for('/pets/{id}/extra_info', 204)
|
433
433
|
|
434
434
|
schema = response[:schema]
|
@@ -437,7 +437,7 @@ describe "Swagger Responses" do
|
|
437
437
|
end
|
438
438
|
|
439
439
|
|
440
|
-
it "
|
440
|
+
it "returns code matching :unprocessable_entity (422) with spread out 'pet' and 'num_fleas'" do
|
441
441
|
returns_obj = subject.returns.detect{|e| e.code == 422 }
|
442
442
|
|
443
443
|
puts returns_obj.to_json
|
@@ -449,7 +449,7 @@ describe "Swagger Responses" do
|
|
449
449
|
])
|
450
450
|
end
|
451
451
|
|
452
|
-
it '
|
452
|
+
it 'has the 422 response described in the swagger' do
|
453
453
|
response = swagger_response_for('/pets/{id}/extra_info', 422)
|
454
454
|
expect(response[:description]).to eq('Fleas were discovered on the pet')
|
455
455
|
|
@@ -475,7 +475,7 @@ describe "Swagger Responses" do
|
|
475
475
|
desc._methods[:show_as_properties]
|
476
476
|
end
|
477
477
|
|
478
|
-
it "
|
478
|
+
it "returns tags with 'Dogs', and 'Wolves'" do
|
479
479
|
returns_obj = subject.tag_list
|
480
480
|
puts returns_obj.inspect
|
481
481
|
|
@@ -496,7 +496,7 @@ describe "Swagger Responses" do
|
|
496
496
|
desc._methods[:show_as_properties]
|
497
497
|
end
|
498
498
|
|
499
|
-
it "
|
499
|
+
it "returns tags with 'Dogs', 'Pets', and 'Animals'" do
|
500
500
|
returns_obj = subject.tag_list
|
501
501
|
puts returns_obj.inspect
|
502
502
|
|
@@ -509,7 +509,7 @@ describe "Swagger Responses" do
|
|
509
509
|
desc._methods[:show_as_same_properties]
|
510
510
|
end
|
511
511
|
|
512
|
-
it "
|
512
|
+
it "returns tags with 'Dogs', 'Pets', 'Puma', and 'Animals'" do
|
513
513
|
returns_obj = subject.tag_list
|
514
514
|
puts returns_obj.inspect
|
515
515
|
|
@@ -532,7 +532,7 @@ describe "Swagger Responses" do
|
|
532
532
|
desc._methods[:pets_described_as_class]
|
533
533
|
end
|
534
534
|
|
535
|
-
it "
|
535
|
+
it "returns code 200 with array of entries of the format {'pet_name', 'animal_type'}" do
|
536
536
|
returns_obj = subject.returns.detect{|e| e.code == 200 }
|
537
537
|
|
538
538
|
puts returns_obj.to_json
|
@@ -542,7 +542,7 @@ describe "Swagger Responses" do
|
|
542
542
|
expect(returns_obj).to match_field_structure([:pet_name, :animal_type])
|
543
543
|
end
|
544
544
|
|
545
|
-
it '
|
545
|
+
it 'has the response described in the swagger' do
|
546
546
|
response = swagger_response_for('/pets_described_as_class')
|
547
547
|
expect(response[:description]).to eq("list of pets")
|
548
548
|
|
@@ -561,7 +561,7 @@ describe "Swagger Responses" do
|
|
561
561
|
desc._methods[:pets_with_measurements_described_as_class]
|
562
562
|
end
|
563
563
|
|
564
|
-
it "
|
564
|
+
it "returns code 200 with spread out 'pet' and encapsulated 'pet_measurements'" do
|
565
565
|
returns_obj = subject.returns.detect{|e| e.code == 200 }
|
566
566
|
|
567
567
|
puts returns_obj.to_json
|
@@ -574,7 +574,7 @@ describe "Swagger Responses" do
|
|
574
574
|
])
|
575
575
|
end
|
576
576
|
|
577
|
-
it '
|
577
|
+
it 'has the 200 response described in the swagger' do
|
578
578
|
response = swagger_response_for('/pets_with_measurements_described_as_class/{id}', 200)
|
579
579
|
expect(response[:description]).to eq('measurements of the pet')
|
580
580
|
|
@@ -595,7 +595,7 @@ describe "Swagger Responses" do
|
|
595
595
|
desc._methods[:pets_with_many_measurements_as_class]
|
596
596
|
end
|
597
597
|
|
598
|
-
it "
|
598
|
+
it "returns code 200 with pet_name (string) and many_pet_measurements (array of objects)" do
|
599
599
|
returns_obj = subject.returns.detect{|e| e.code == 200 }
|
600
600
|
|
601
601
|
puts returns_obj.to_json
|
@@ -608,7 +608,7 @@ describe "Swagger Responses" do
|
|
608
608
|
end
|
609
609
|
|
610
610
|
|
611
|
-
it '
|
611
|
+
it 'has the 200 response described in the swagger' do
|
612
612
|
response = swagger_response_for('/pets_with_many_measurements_as_class/{id}', 200)
|
613
613
|
expect(response[:description]).to eq('measurements of the pet')
|
614
614
|
|
@@ -637,7 +637,7 @@ describe "Swagger Responses" do
|
|
637
637
|
desc._methods[:pet_described_using_automated_view]
|
638
638
|
end
|
639
639
|
|
640
|
-
it "
|
640
|
+
it "returns code 200 with array of entries of the format {'pet_name', 'animal_type'}" do
|
641
641
|
returns_obj = subject.returns.detect{|e| e.code == 200 }
|
642
642
|
|
643
643
|
expect(returns_obj.code).to eq(200)
|
@@ -646,7 +646,7 @@ describe "Swagger Responses" do
|
|
646
646
|
expect(returns_obj).to match_field_structure([:pet_name, :animal_type, :age])
|
647
647
|
end
|
648
648
|
|
649
|
-
it '
|
649
|
+
it 'has the response described in the swagger' do
|
650
650
|
response = swagger_response_for('/pet_described_using_automated_view/{id}')
|
651
651
|
expect(response[:description]).to eq("like Pet, but different")
|
652
652
|
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe TestEngine::MemesController do
|
4
4
|
|
5
5
|
describe "#index" do
|
6
|
-
it "
|
6
|
+
it "has the full mounted path of engine" do
|
7
7
|
expect(Apipie.routes_for_action(TestEngine::MemesController, :index, {}).first[:path]).to eq("/test/memes")
|
8
8
|
end
|
9
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apipie-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Pokorny
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -165,6 +165,20 @@ dependencies:
|
|
165
165
|
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: rubocop-rspec_rails
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
type: :development
|
176
|
+
prerelease: false
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
168
182
|
- !ruby/object:Gem::Dependency
|
169
183
|
name: simplecov
|
170
184
|
requirement: !ruby/object:Gem::Requirement
|
@@ -215,7 +229,7 @@ files:
|
|
215
229
|
- MIT-LICENSE
|
216
230
|
- NOTICE
|
217
231
|
- PROPOSAL_FOR_RESPONSE_DESCRIPTIONS.md
|
218
|
-
- README.
|
232
|
+
- README.md
|
219
233
|
- Rakefile
|
220
234
|
- apipie-rails.gemspec
|
221
235
|
- app/controllers/apipie/apipies_controller.rb
|
@@ -419,6 +433,7 @@ files:
|
|
419
433
|
- spec/lib/apipie/generator/swagger/context_spec.rb
|
420
434
|
- spec/lib/apipie/generator/swagger/method_description/api_schema_service_spec.rb
|
421
435
|
- spec/lib/apipie/generator/swagger/method_description/response_schema_service_spec.rb
|
436
|
+
- spec/lib/apipie/generator/swagger/method_description/response_service_spec.rb
|
422
437
|
- spec/lib/apipie/generator/swagger/operation_id_spec.rb
|
423
438
|
- spec/lib/apipie/generator/swagger/param_description/builder_spec.rb
|
424
439
|
- spec/lib/apipie/generator/swagger/param_description/composite_spec.rb
|
@@ -442,6 +457,8 @@ files:
|
|
442
457
|
- spec/lib/apipie/param_description_spec.rb
|
443
458
|
- spec/lib/apipie/param_group_spec.rb
|
444
459
|
- spec/lib/apipie/resource_description_spec.rb
|
460
|
+
- spec/lib/apipie/response_description/response_object_spec.rb
|
461
|
+
- spec/lib/apipie/response_description_spec.rb
|
445
462
|
- spec/lib/apipie/response_does_not_match_swagger_schema_spec.rb
|
446
463
|
- spec/lib/apipie/swagger_generator_spec.rb
|
447
464
|
- spec/lib/apipie/validator_spec.rb
|
@@ -454,9 +471,12 @@ files:
|
|
454
471
|
- spec/support/custom_bool_validator.rb
|
455
472
|
- spec/support/rake.rb
|
456
473
|
- spec/test_engine/memes_controller_spec.rb
|
457
|
-
homepage:
|
474
|
+
homepage: https://github.com/Apipie/apipie-rails
|
458
475
|
licenses: []
|
459
|
-
metadata:
|
476
|
+
metadata:
|
477
|
+
bug_tracker_uri: https://github.com/Apipie/apipie-rails/issues
|
478
|
+
changelog_uri: https://github.com/Apipie/apipie-rails/blob/master/CHANGELOG.md
|
479
|
+
source_code_uri: https://github.com/Apipie/apipie-rails
|
460
480
|
post_install_message:
|
461
481
|
rdoc_options: []
|
462
482
|
require_paths:
|
@@ -472,8 +492,128 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
472
492
|
- !ruby/object:Gem::Version
|
473
493
|
version: '0'
|
474
494
|
requirements: []
|
475
|
-
rubygems_version: 3.
|
495
|
+
rubygems_version: 3.5.11
|
476
496
|
signing_key:
|
477
497
|
specification_version: 4
|
478
498
|
summary: Rails REST API documentation tool
|
479
|
-
test_files:
|
499
|
+
test_files:
|
500
|
+
- spec/controllers/api/v1/architectures_controller_spec.rb
|
501
|
+
- spec/controllers/api/v2/architectures_controller_spec.rb
|
502
|
+
- spec/controllers/api/v2/empty_middle_controller_spec.rb
|
503
|
+
- spec/controllers/api/v2/nested/resources_controller_spec.rb
|
504
|
+
- spec/controllers/api/v2/sub/footguns_controller_spec.rb
|
505
|
+
- spec/controllers/concerns_controller_spec.rb
|
506
|
+
- spec/controllers/extended_controller_spec.rb
|
507
|
+
- spec/controllers/included_param_group_controller_spec.rb
|
508
|
+
- spec/controllers/pets_controller_spec.rb
|
509
|
+
- spec/controllers/users_controller_spec.rb
|
510
|
+
- spec/dummy/Rakefile
|
511
|
+
- spec/dummy/app/controllers/api/base_controller.rb
|
512
|
+
- spec/dummy/app/controllers/api/v1/architectures_controller.rb
|
513
|
+
- spec/dummy/app/controllers/api/v1/base_controller.rb
|
514
|
+
- spec/dummy/app/controllers/api/v2/architectures_controller.rb
|
515
|
+
- spec/dummy/app/controllers/api/v2/base_controller.rb
|
516
|
+
- spec/dummy/app/controllers/api/v2/empty_middle_controller.rb
|
517
|
+
- spec/dummy/app/controllers/api/v2/nested/architectures_controller.rb
|
518
|
+
- spec/dummy/app/controllers/api/v2/nested/resources_controller.rb
|
519
|
+
- spec/dummy/app/controllers/api/v2/sub/footguns_controller.rb
|
520
|
+
- spec/dummy/app/controllers/application_controller.rb
|
521
|
+
- spec/dummy/app/controllers/concerns_controller.rb
|
522
|
+
- spec/dummy/app/controllers/extended_controller.rb
|
523
|
+
- spec/dummy/app/controllers/extending_concern.rb
|
524
|
+
- spec/dummy/app/controllers/files_controller.rb
|
525
|
+
- spec/dummy/app/controllers/included_param_group_controller.rb
|
526
|
+
- spec/dummy/app/controllers/overridden_concerns_controller.rb
|
527
|
+
- spec/dummy/app/controllers/pets_controller.rb
|
528
|
+
- spec/dummy/app/controllers/pets_using_auto_views_controller.rb
|
529
|
+
- spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb
|
530
|
+
- spec/dummy/app/controllers/sample_controller.rb
|
531
|
+
- spec/dummy/app/controllers/tagged_cats_controller.rb
|
532
|
+
- spec/dummy/app/controllers/tagged_dogs_controller.rb
|
533
|
+
- spec/dummy/app/controllers/twitter_example_controller.rb
|
534
|
+
- spec/dummy/app/controllers/users_controller.rb
|
535
|
+
- spec/dummy/app/helpers/random_param_group.rb
|
536
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
537
|
+
- spec/dummy/components/test_engine/Gemfile
|
538
|
+
- spec/dummy/components/test_engine/app/controllers/test_engine/application_controller.rb
|
539
|
+
- spec/dummy/components/test_engine/app/controllers/test_engine/memes_controller.rb
|
540
|
+
- spec/dummy/components/test_engine/config/routes.rb
|
541
|
+
- spec/dummy/components/test_engine/db/.gitkeep
|
542
|
+
- spec/dummy/components/test_engine/lib/test_engine.rb
|
543
|
+
- spec/dummy/components/test_engine/test_engine.gemspec
|
544
|
+
- spec/dummy/config.ru
|
545
|
+
- spec/dummy/config/application.rb
|
546
|
+
- spec/dummy/config/boot.rb
|
547
|
+
- spec/dummy/config/database.yml
|
548
|
+
- spec/dummy/config/environment.rb
|
549
|
+
- spec/dummy/config/environments/development.rb
|
550
|
+
- spec/dummy/config/environments/production.rb
|
551
|
+
- spec/dummy/config/environments/test.rb
|
552
|
+
- spec/dummy/config/initializers/apipie.rb
|
553
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
554
|
+
- spec/dummy/config/initializers/inflections.rb
|
555
|
+
- spec/dummy/config/initializers/mime_types.rb
|
556
|
+
- spec/dummy/config/initializers/secret_token.rb
|
557
|
+
- spec/dummy/config/initializers/session_store.rb
|
558
|
+
- spec/dummy/config/locales/en.yml
|
559
|
+
- spec/dummy/config/routes.rb
|
560
|
+
- spec/dummy/db/.gitkeep
|
561
|
+
- spec/dummy/doc/apipie_examples.json
|
562
|
+
- spec/dummy/doc/users/desc_from_file.md
|
563
|
+
- spec/dummy/public/404.html
|
564
|
+
- spec/dummy/public/422.html
|
565
|
+
- spec/dummy/public/500.html
|
566
|
+
- spec/dummy/public/favicon.ico
|
567
|
+
- spec/dummy/public/stylesheets/.gitkeep
|
568
|
+
- spec/dummy/script/rails
|
569
|
+
- spec/lib/apipie/apipies_controller_spec.rb
|
570
|
+
- spec/lib/apipie/application_spec.rb
|
571
|
+
- spec/lib/apipie/configuration_spec.rb
|
572
|
+
- spec/lib/apipie/extractor/collector_spec.rb
|
573
|
+
- spec/lib/apipie/extractor/recorder/middleware_spec.rb
|
574
|
+
- spec/lib/apipie/extractor/recorder_spec.rb
|
575
|
+
- spec/lib/apipie/extractor/writer_spec.rb
|
576
|
+
- spec/lib/apipie/extractor_spec.rb
|
577
|
+
- spec/lib/apipie/file_handler_spec.rb
|
578
|
+
- spec/lib/apipie/generator/swagger/config_spec.rb
|
579
|
+
- spec/lib/apipie/generator/swagger/context_spec.rb
|
580
|
+
- spec/lib/apipie/generator/swagger/method_description/api_schema_service_spec.rb
|
581
|
+
- spec/lib/apipie/generator/swagger/method_description/response_schema_service_spec.rb
|
582
|
+
- spec/lib/apipie/generator/swagger/method_description/response_service_spec.rb
|
583
|
+
- spec/lib/apipie/generator/swagger/operation_id_spec.rb
|
584
|
+
- spec/lib/apipie/generator/swagger/param_description/builder_spec.rb
|
585
|
+
- spec/lib/apipie/generator/swagger/param_description/composite_spec.rb
|
586
|
+
- spec/lib/apipie/generator/swagger/param_description/description_spec.rb
|
587
|
+
- spec/lib/apipie/generator/swagger/param_description/in_spec.rb
|
588
|
+
- spec/lib/apipie/generator/swagger/param_description/name_spec.rb
|
589
|
+
- spec/lib/apipie/generator/swagger/param_description/type_spec.rb
|
590
|
+
- spec/lib/apipie/generator/swagger/param_description_spec.rb
|
591
|
+
- spec/lib/apipie/generator/swagger/path_decorator_spec.rb
|
592
|
+
- spec/lib/apipie/generator/swagger/referenced_definitions_spec.rb
|
593
|
+
- spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb
|
594
|
+
- spec/lib/apipie/generator/swagger/resource_descriptions_collection_spec.rb
|
595
|
+
- spec/lib/apipie/generator/swagger/schema_spec.rb
|
596
|
+
- spec/lib/apipie/generator/swagger/type_extractor_spec.rb
|
597
|
+
- spec/lib/apipie/generator/swagger/warning_spec.rb
|
598
|
+
- spec/lib/apipie/generator/swagger/warning_writer_spec.rb
|
599
|
+
- spec/lib/apipie/method_description/apis_service_spec.rb
|
600
|
+
- spec/lib/apipie/method_description_spec.rb
|
601
|
+
- spec/lib/apipie/no_documented_method_spec.rb
|
602
|
+
- spec/lib/apipie/param_description/deprecation_spec.rb
|
603
|
+
- spec/lib/apipie/param_description_spec.rb
|
604
|
+
- spec/lib/apipie/param_group_spec.rb
|
605
|
+
- spec/lib/apipie/resource_description_spec.rb
|
606
|
+
- spec/lib/apipie/response_description/response_object_spec.rb
|
607
|
+
- spec/lib/apipie/response_description_spec.rb
|
608
|
+
- spec/lib/apipie/response_does_not_match_swagger_schema_spec.rb
|
609
|
+
- spec/lib/apipie/swagger_generator_spec.rb
|
610
|
+
- spec/lib/apipie/validator_spec.rb
|
611
|
+
- spec/lib/rake_spec.rb
|
612
|
+
- spec/lib/swagger/openapi_2_0_schema.json
|
613
|
+
- spec/lib/swagger/rake_swagger_spec.rb
|
614
|
+
- spec/lib/swagger/swagger_dsl_spec.rb
|
615
|
+
- spec/lib/validators/array_validator_spec.rb
|
616
|
+
- spec/spec_helper.rb
|
617
|
+
- spec/support/custom_bool_validator.rb
|
618
|
+
- spec/support/rake.rb
|
619
|
+
- spec/test_engine/memes_controller_spec.rb
|