apipie-rails 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop-challenger.yml +1 -1
- data/.github/workflows/rubocop.yml +20 -0
- data/.rubocop.yml +6 -0
- data/.rubocop_todo.yml +256 -371
- data/CHANGELOG.md +10 -1
- data/README.rst +20 -0
- data/apipie-rails.gemspec +4 -0
- data/app/views/apipie/apipies/_deprecation.html.erb +16 -0
- data/app/views/apipie/apipies/_params.html.erb +7 -1
- data/config/locales/en.yml +7 -0
- data/lib/apipie/application.rb +4 -6
- data/lib/apipie/configuration.rb +13 -2
- data/lib/apipie/dsl_definition.rb +2 -2
- data/lib/apipie/extractor/recorder.rb +1 -1
- data/lib/apipie/extractor.rb +1 -1
- data/lib/apipie/markup.rb +9 -8
- data/lib/apipie/param_description/deprecation.rb +24 -0
- data/lib/apipie/param_description.rb +38 -11
- data/lib/apipie/resource_description.rb +1 -1
- data/lib/apipie/validator.rb +7 -8
- data/lib/apipie/version.rb +1 -1
- data/lib/apipie-rails.rb +1 -0
- data/lib/tasks/apipie.rake +1 -0
- data/spec/controllers/users_controller_spec.rb +8 -1
- data/spec/{controllers → lib/apipie}/apipies_controller_spec.rb +2 -2
- data/spec/lib/{application_spec.rb → apipie/application_spec.rb} +6 -3
- data/spec/lib/apipie/configuration_spec.rb +23 -0
- data/spec/lib/apipie/extractor/recorder_spec.rb +40 -0
- data/spec/lib/{method_description_spec.rb → apipie/method_description_spec.rb} +4 -4
- data/spec/lib/apipie/param_description/deprecation_spec.rb +31 -0
- data/spec/lib/{param_description_spec.rb → apipie/param_description_spec.rb} +81 -1
- data/spec/lib/{resource_description_spec.rb → apipie/resource_description_spec.rb} +2 -2
- data/spec/lib/swagger/swagger_dsl_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +76 -28
- /data/spec/{lib/swagger/response_validation_spec.rb → controllers/pets_controller_spec.rb} +0 -0
- /data/spec/lib/{extractor → apipie/extractor/recorder}/middleware_spec.rb +0 -0
- /data/spec/lib/{extractor → apipie/extractor}/writer_spec.rb +0 -0
- /data/spec/lib/{extractor → apipie}/extractor_spec.rb +0 -0
- /data/spec/lib/{file_handler_spec.rb → apipie/file_handler_spec.rb} +0 -0
- /data/spec/lib/{generator → apipie/generator}/swagger/context_spec.rb +0 -0
- /data/spec/lib/{generator → apipie/generator}/swagger/operation_id_spec.rb +0 -0
- /data/spec/lib/{generator → apipie/generator}/swagger/param_description/builder_spec.rb +0 -0
- /data/spec/lib/{generator → apipie/generator}/swagger/param_description/composite_spec.rb +0 -0
- /data/spec/lib/{generator → apipie/generator}/swagger/param_description/description_spec.rb +0 -0
- /data/spec/lib/{generator → apipie/generator}/swagger/param_description/in_spec.rb +0 -0
- /data/spec/lib/{generator → apipie/generator}/swagger/param_description/name_spec.rb +0 -0
- /data/spec/lib/{generator → apipie/generator}/swagger/param_description/type_spec.rb +0 -0
- /data/spec/lib/{generator → apipie/generator}/swagger/param_description_spec.rb +0 -0
- /data/spec/lib/{generator → apipie/generator}/swagger/type_extractor_spec.rb +0 -0
- /data/spec/lib/{generator → apipie/generator}/swagger/warning_spec.rb +0 -0
- /data/spec/lib/{generator → apipie/generator}/swagger/warning_writer_spec.rb +0 -0
- /data/spec/lib/{method_description → apipie/method_description}/apis_service_spec.rb +0 -0
- /data/spec/lib/{param_group_spec.rb → apipie/param_group_spec.rb} +0 -0
- /data/spec/lib/{validator_spec.rb → apipie/validator_spec.rb} +0 -0
- /data/spec/{controllers → test_engine}/memes_controller_spec.rb +0 -0
@@ -188,7 +188,9 @@ describe Apipie::ParamDescription do
|
|
188
188
|
end
|
189
189
|
context 'when allow_blank is specified as false' do
|
190
190
|
it "should throw an exception when passed an empty value" do
|
191
|
-
expect
|
191
|
+
expect do
|
192
|
+
Apipie::ParamDescription.new(method_desc, :param, String, allow_blank: false).validate('')
|
193
|
+
end.to raise_error(Apipie::ParamInvalid)
|
192
194
|
end
|
193
195
|
end
|
194
196
|
context 'when allow_blank is not specified' do
|
@@ -428,4 +430,82 @@ describe Apipie::ParamDescription do
|
|
428
430
|
end
|
429
431
|
end
|
430
432
|
|
433
|
+
describe '#deprecated?' do
|
434
|
+
subject do
|
435
|
+
Apipie::ParamDescription.new(method_desc, :param, Integer, options)
|
436
|
+
end
|
437
|
+
|
438
|
+
let(:options) { {} }
|
439
|
+
|
440
|
+
it { is_expected.not_to be_deprecated }
|
441
|
+
|
442
|
+
context 'when deprecated option is passed' do
|
443
|
+
context 'and is true' do
|
444
|
+
let(:options) { { deprecated: true } }
|
445
|
+
|
446
|
+
it { is_expected.to be_deprecated }
|
447
|
+
end
|
448
|
+
|
449
|
+
context 'and is false' do
|
450
|
+
let(:options) { { deprecated: false } }
|
451
|
+
|
452
|
+
it { is_expected.not_to be_deprecated }
|
453
|
+
end
|
454
|
+
|
455
|
+
context 'and is a string' do
|
456
|
+
let(:options) { { deprecated: 'Some description' } }
|
457
|
+
|
458
|
+
it { is_expected.to be_deprecated }
|
459
|
+
end
|
460
|
+
|
461
|
+
context 'and deprecation options are given' do
|
462
|
+
let(:options) do
|
463
|
+
{ deprecated: { in: '2.3', info: 'Something', sunset: '3.0' } }
|
464
|
+
end
|
465
|
+
|
466
|
+
it { is_expected.to be_deprecated }
|
467
|
+
end
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
471
|
+
describe '#deprecation' do
|
472
|
+
subject { param_description.deprecation }
|
473
|
+
|
474
|
+
let(:options) { {} }
|
475
|
+
|
476
|
+
let(:param_description) do
|
477
|
+
Apipie::ParamDescription.new(method_desc, :param, Integer, options)
|
478
|
+
end
|
479
|
+
|
480
|
+
it { is_expected.to be_blank }
|
481
|
+
|
482
|
+
context 'when deprecated option is passed' do
|
483
|
+
context 'and is true' do
|
484
|
+
let(:options) { { deprecated: true } }
|
485
|
+
|
486
|
+
it { is_expected.to be_blank }
|
487
|
+
end
|
488
|
+
|
489
|
+
context 'and is false' do
|
490
|
+
let(:options) { { deprecated: false } }
|
491
|
+
|
492
|
+
it { is_expected.to be_blank }
|
493
|
+
end
|
494
|
+
|
495
|
+
context 'and is a string' do
|
496
|
+
let(:options) { { deprecated: 'Some description' } }
|
497
|
+
|
498
|
+
it { is_expected.to be_an_instance_of(Apipie::ParamDescription::Deprecation) }
|
499
|
+
end
|
500
|
+
|
501
|
+
context 'and deprecation options are given' do
|
502
|
+
let(:options) do
|
503
|
+
{ deprecated: { in: '2.3', info: 'Something', sunset: '3.0' } }
|
504
|
+
end
|
505
|
+
|
506
|
+
it { is_expected.to be_an_instance_of(Apipie::ParamDescription::Deprecation) }
|
507
|
+
end
|
508
|
+
end
|
509
|
+
end
|
510
|
+
|
431
511
|
end
|
@@ -36,12 +36,12 @@ describe Apipie::ResourceDescription do
|
|
36
36
|
|
37
37
|
it "should be ordered" do
|
38
38
|
expect(@resource._methods.keys).to eq([:a, :b, :c])
|
39
|
-
expect(@resource.to_json[:methods].map{|h| h[:name]}).to eq(['a', 'b', 'c'])
|
39
|
+
expect(@resource.to_json[:methods].map { |h| h[:name] }).to eq(['a', 'b', 'c'])
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should be still ordered" do
|
43
43
|
expect(@resource._methods.keys).to eq([:a, :b, :c])
|
44
|
-
expect(@resource.to_json[:methods].map{|h| h[:name]}).to eq(['a', 'b', 'c'])
|
44
|
+
expect(@resource.to_json[:methods].map { |h| h[:name] }).to eq(['a', 'b', 'c'])
|
45
45
|
end
|
46
46
|
|
47
47
|
end
|
@@ -37,7 +37,7 @@ describe "Swagger Responses" do
|
|
37
37
|
def swagger_param_by_name(param_name, path, method='get')
|
38
38
|
params = swagger_params_for(path, method)
|
39
39
|
matching = params.select{|p| p[:name] == param_name }
|
40
|
-
raise "multiple params named [#{param_name}] in swagger definition for [#{method
|
40
|
+
raise "multiple params named [#{param_name}] in swagger definition for [#{method} #{path}]" if matching.length > 1
|
41
41
|
|
42
42
|
nil if matching.length == 0
|
43
43
|
|
data/spec/spec_helper.rb
CHANGED
@@ -55,7 +55,7 @@ end
|
|
55
55
|
|
56
56
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
57
57
|
# in spec/support/ and its subdirectories.
|
58
|
-
Dir[File.expand_path('support/**/*.rb', __dir__)].each {|f| require f}
|
58
|
+
Dir[File.expand_path('support/**/*.rb', __dir__)].sort.each {|f| require f}
|
59
59
|
|
60
60
|
RSpec.configure do |config|
|
61
61
|
|
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: 0.9.
|
4
|
+
version: 0.9.3
|
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: 2023-
|
12
|
+
date: 2023-03-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -123,6 +123,48 @@ dependencies:
|
|
123
123
|
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rubocop-rails
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: rubocop-rspec
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: rubocop-performance
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
126
168
|
- !ruby/object:Gem::Dependency
|
127
169
|
name: simplecov
|
128
170
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,6 +203,7 @@ extra_rdoc_files: []
|
|
161
203
|
files:
|
162
204
|
- ".github/workflows/build.yml"
|
163
205
|
- ".github/workflows/rubocop-challenger.yml"
|
206
|
+
- ".github/workflows/rubocop.yml"
|
164
207
|
- ".gitignore"
|
165
208
|
- ".rspec"
|
166
209
|
- ".rubocop.yml"
|
@@ -184,6 +227,7 @@ files:
|
|
184
227
|
- app/public/apipie/stylesheets/bundled/bootstrap-responsive.min.css
|
185
228
|
- app/public/apipie/stylesheets/bundled/bootstrap.min.css
|
186
229
|
- app/public/apipie/stylesheets/bundled/prettify.css
|
230
|
+
- app/views/apipie/apipies/_deprecation.html.erb
|
187
231
|
- app/views/apipie/apipies/_disqus.html.erb
|
188
232
|
- app/views/apipie/apipies/_errors.html.erb
|
189
233
|
- app/views/apipie/apipies/_headers.html.erb
|
@@ -256,6 +300,7 @@ files:
|
|
256
300
|
- lib/apipie/method_description/apis_service.rb
|
257
301
|
- lib/apipie/middleware/checksum_in_headers.rb
|
258
302
|
- lib/apipie/param_description.rb
|
303
|
+
- lib/apipie/param_description/deprecation.rb
|
259
304
|
- lib/apipie/railtie.rb
|
260
305
|
- lib/apipie/resource_description.rb
|
261
306
|
- lib/apipie/response_description.rb
|
@@ -281,11 +326,10 @@ files:
|
|
281
326
|
- spec/controllers/api/v1/architectures_controller_spec.rb
|
282
327
|
- spec/controllers/api/v2/architectures_controller_spec.rb
|
283
328
|
- spec/controllers/api/v2/nested/resources_controller_spec.rb
|
284
|
-
- spec/controllers/apipies_controller_spec.rb
|
285
329
|
- spec/controllers/concerns_controller_spec.rb
|
286
330
|
- spec/controllers/extended_controller_spec.rb
|
287
331
|
- spec/controllers/included_param_group_controller_spec.rb
|
288
|
-
- spec/controllers/
|
332
|
+
- spec/controllers/pets_controller_spec.rb
|
289
333
|
- spec/controllers/users_controller_spec.rb
|
290
334
|
- spec/dummy/Rakefile
|
291
335
|
- spec/dummy/app/controllers/api/base_controller.rb
|
@@ -344,38 +388,42 @@ files:
|
|
344
388
|
- spec/dummy/public/favicon.ico
|
345
389
|
- spec/dummy/public/stylesheets/.gitkeep
|
346
390
|
- spec/dummy/script/rails
|
347
|
-
- spec/lib/
|
348
|
-
- spec/lib/
|
349
|
-
- spec/lib/
|
350
|
-
- spec/lib/extractor/
|
351
|
-
- spec/lib/
|
352
|
-
- spec/lib/
|
353
|
-
- spec/lib/
|
354
|
-
- spec/lib/
|
355
|
-
- spec/lib/generator/swagger/
|
356
|
-
- spec/lib/generator/swagger/
|
357
|
-
- spec/lib/generator/swagger/param_description/
|
358
|
-
- spec/lib/generator/swagger/param_description/
|
359
|
-
- spec/lib/generator/swagger/param_description/
|
360
|
-
- spec/lib/generator/swagger/
|
361
|
-
- spec/lib/generator/swagger/
|
362
|
-
- spec/lib/generator/swagger/
|
363
|
-
- spec/lib/generator/swagger/
|
364
|
-
- spec/lib/
|
365
|
-
- spec/lib/
|
366
|
-
- spec/lib/
|
367
|
-
- spec/lib/
|
391
|
+
- spec/lib/apipie/apipies_controller_spec.rb
|
392
|
+
- spec/lib/apipie/application_spec.rb
|
393
|
+
- spec/lib/apipie/configuration_spec.rb
|
394
|
+
- spec/lib/apipie/extractor/recorder/middleware_spec.rb
|
395
|
+
- spec/lib/apipie/extractor/recorder_spec.rb
|
396
|
+
- spec/lib/apipie/extractor/writer_spec.rb
|
397
|
+
- spec/lib/apipie/extractor_spec.rb
|
398
|
+
- spec/lib/apipie/file_handler_spec.rb
|
399
|
+
- spec/lib/apipie/generator/swagger/context_spec.rb
|
400
|
+
- spec/lib/apipie/generator/swagger/operation_id_spec.rb
|
401
|
+
- spec/lib/apipie/generator/swagger/param_description/builder_spec.rb
|
402
|
+
- spec/lib/apipie/generator/swagger/param_description/composite_spec.rb
|
403
|
+
- spec/lib/apipie/generator/swagger/param_description/description_spec.rb
|
404
|
+
- spec/lib/apipie/generator/swagger/param_description/in_spec.rb
|
405
|
+
- spec/lib/apipie/generator/swagger/param_description/name_spec.rb
|
406
|
+
- spec/lib/apipie/generator/swagger/param_description/type_spec.rb
|
407
|
+
- spec/lib/apipie/generator/swagger/param_description_spec.rb
|
408
|
+
- spec/lib/apipie/generator/swagger/type_extractor_spec.rb
|
409
|
+
- spec/lib/apipie/generator/swagger/warning_spec.rb
|
410
|
+
- spec/lib/apipie/generator/swagger/warning_writer_spec.rb
|
411
|
+
- spec/lib/apipie/method_description/apis_service_spec.rb
|
412
|
+
- spec/lib/apipie/method_description_spec.rb
|
413
|
+
- spec/lib/apipie/param_description/deprecation_spec.rb
|
414
|
+
- spec/lib/apipie/param_description_spec.rb
|
415
|
+
- spec/lib/apipie/param_group_spec.rb
|
416
|
+
- spec/lib/apipie/resource_description_spec.rb
|
417
|
+
- spec/lib/apipie/validator_spec.rb
|
368
418
|
- spec/lib/rake_spec.rb
|
369
|
-
- spec/lib/resource_description_spec.rb
|
370
419
|
- spec/lib/swagger/openapi_2_0_schema.json
|
371
420
|
- spec/lib/swagger/rake_swagger_spec.rb
|
372
|
-
- spec/lib/swagger/response_validation_spec.rb
|
373
421
|
- spec/lib/swagger/swagger_dsl_spec.rb
|
374
|
-
- spec/lib/validator_spec.rb
|
375
422
|
- spec/lib/validators/array_validator_spec.rb
|
376
423
|
- spec/spec_helper.rb
|
377
424
|
- spec/support/custom_bool_validator.rb
|
378
425
|
- spec/support/rake.rb
|
426
|
+
- spec/test_engine/memes_controller_spec.rb
|
379
427
|
homepage: http://github.com/Apipie/apipie-rails
|
380
428
|
licenses: []
|
381
429
|
metadata: {}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|