apipie-rails 0.5.20 → 0.6.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/.github/workflows/build.yml +11 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/apipie-rails.gemspec +2 -1
- data/app/controllers/apipie/apipies_controller.rb +1 -1
- data/gemfiles/Gemfile.rails42 +2 -1
- data/gemfiles/Gemfile.rails42.lock +10 -48
- data/gemfiles/Gemfile.rails52 +2 -1
- data/gemfiles/Gemfile.rails60 +10 -3
- data/gemfiles/Gemfile.rails61 +10 -3
- data/lib/apipie/extractor/recorder.rb +1 -0
- data/lib/apipie/version.rb +1 -1
- data/lib/apipie-rails.rb +0 -4
- data/spec/controllers/apipies_controller_spec.rb +25 -0
- data/spec/dummy/config/application.rb +0 -3
- data/spec/dummy/config/environments/development.rb +0 -3
- data/spec/dummy/config/environments/production.rb +0 -3
- data/spec/dummy/config/environments/test.rb +0 -5
- data/spec/lib/swagger/response_validation_spec.rb +17 -17
- data/spec/spec_helper.rb +7 -1
- metadata +22 -90
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94b525fc29d73244428ef1e25397219f80e703701497ad82c507e9fe0c321300
|
|
4
|
+
data.tar.gz: 7ba3ffeceb46eb8115d1733820e87bef5a1c1be64bc19a5225c20eae430a476c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6eab6988a8d9bebb72a66096e2dbe22f04f83ab5e25070e1cb2b6176c13153b23e3499829af1f378ece9d07abfad18756ce845632ecf9711b6108fab1b8335a4
|
|
7
|
+
data.tar.gz: 8efcdcbf133414f77cb1cf9c15f34162ad395d42117275b74a68c9b4848723174dc4d79cf1b4c6739fe775324aa94da6d16b38f5fd62b33e0577539483fe8ea4
|
data/.github/workflows/build.yml
CHANGED
|
@@ -16,8 +16,10 @@ jobs:
|
|
|
16
16
|
fail-fast: false
|
|
17
17
|
matrix:
|
|
18
18
|
ruby:
|
|
19
|
-
- 2.7
|
|
20
19
|
- 2.6
|
|
20
|
+
- 2.7
|
|
21
|
+
- '3.0'
|
|
22
|
+
- 3.1
|
|
21
23
|
gemfile:
|
|
22
24
|
- Gemfile.rails42
|
|
23
25
|
- Gemfile.rails52 # Min ruby 2.2.2
|
|
@@ -26,8 +28,16 @@ jobs:
|
|
|
26
28
|
exclude:
|
|
27
29
|
- gemfile: Gemfile.rails42
|
|
28
30
|
ruby: 2.7
|
|
31
|
+
- gemfile: Gemfile.rails42
|
|
32
|
+
ruby: '3.0'
|
|
33
|
+
- gemfile: Gemfile.rails42
|
|
34
|
+
ruby: 3.1
|
|
29
35
|
- gemfile: Gemfile.rails52
|
|
30
36
|
ruby: 2.7
|
|
37
|
+
- gemfile: Gemfile.rails52
|
|
38
|
+
ruby: '3.0'
|
|
39
|
+
- gemfile: Gemfile.rails52
|
|
40
|
+
ruby: 3.1
|
|
31
41
|
|
|
32
42
|
env:
|
|
33
43
|
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
===========
|
|
3
|
+
|
|
4
|
+
## [v0.6.0](https://github.com/Apipie/apipie-rails/tree/v0.6.0) (2022-03-29)
|
|
5
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.20...v0.6.0)
|
|
6
|
+
* Ruby 3.0 fixes [#716](https://github.com/Apipie/apipie-rails/pull/716) (hank-spokeo)
|
|
7
|
+
* only depends on actionpack and activesupport [#741](https://github.com/Apipie/apipie-rails/pull/741) (Mathieu Jobin)
|
|
8
|
+
* language fix, fallback to default locale [#726](https://github.com/Apipie/apipie-rails/pull/726) (Alex Coomans)
|
|
9
|
+
|
|
3
10
|
## [v0.5.20](https://github.com/Apipie/apipie-rails/tree/v0.5.20) (2022-03-16)
|
|
4
11
|
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.19...v0.5.20)
|
|
5
12
|
* Update rel-eng (Oleh Fedorenko)
|
data/Gemfile
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Gemfile.rails61
|
data/apipie-rails.gemspec
CHANGED
|
@@ -16,7 +16,8 @@ Gem::Specification.new do |s|
|
|
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
17
17
|
s.require_paths = ["lib"]
|
|
18
18
|
|
|
19
|
-
s.add_dependency "
|
|
19
|
+
s.add_dependency "actionpack", ">= 4.1"
|
|
20
|
+
s.add_dependency "activesupport", ">= 4.1"
|
|
20
21
|
s.add_development_dependency "rspec-rails", "~> 3.0"
|
|
21
22
|
s.add_development_dependency "sqlite3"
|
|
22
23
|
s.add_development_dependency "minitest"
|
|
@@ -100,7 +100,7 @@ module Apipie
|
|
|
100
100
|
[:resource, :method, :version].each do |par|
|
|
101
101
|
if params[par]
|
|
102
102
|
splitted = params[par].split('.')
|
|
103
|
-
if splitted.length > 1 && Apipie.configuration.languages.include?(splitted.last)
|
|
103
|
+
if splitted.length > 1 && (Apipie.configuration.languages.include?(splitted.last) || Apipie.configuration.default_locale == splitted.last)
|
|
104
104
|
lang = splitted.last
|
|
105
105
|
params[par].sub!(".#{lang}", '')
|
|
106
106
|
end
|
data/gemfiles/Gemfile.rails42
CHANGED
|
@@ -6,19 +6,14 @@ PATH
|
|
|
6
6
|
PATH
|
|
7
7
|
remote: ..
|
|
8
8
|
specs:
|
|
9
|
-
apipie-rails (0.5.
|
|
10
|
-
|
|
9
|
+
apipie-rails (0.5.20)
|
|
10
|
+
actionpack (>= 4.1)
|
|
11
|
+
activesupport (>= 4.1)
|
|
11
12
|
|
|
12
13
|
GEM
|
|
13
14
|
remote: https://rubygems.org/
|
|
14
15
|
specs:
|
|
15
16
|
RedCloth (4.3.2)
|
|
16
|
-
actionmailer (4.2.11.3)
|
|
17
|
-
actionpack (= 4.2.11.3)
|
|
18
|
-
actionview (= 4.2.11.3)
|
|
19
|
-
activejob (= 4.2.11.3)
|
|
20
|
-
mail (~> 2.5, >= 2.5.4)
|
|
21
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
22
17
|
actionpack (4.2.11.3)
|
|
23
18
|
actionview (= 4.2.11.3)
|
|
24
19
|
activesupport (= 4.2.11.3)
|
|
@@ -32,16 +27,6 @@ GEM
|
|
|
32
27
|
erubis (~> 2.7.0)
|
|
33
28
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
34
29
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
35
|
-
activejob (4.2.11.3)
|
|
36
|
-
activesupport (= 4.2.11.3)
|
|
37
|
-
globalid (>= 0.3.0)
|
|
38
|
-
activemodel (4.2.11.3)
|
|
39
|
-
activesupport (= 4.2.11.3)
|
|
40
|
-
builder (~> 3.1)
|
|
41
|
-
activerecord (4.2.11.3)
|
|
42
|
-
activemodel (= 4.2.11.3)
|
|
43
|
-
activesupport (= 4.2.11.3)
|
|
44
|
-
arel (~> 6.0)
|
|
45
30
|
activesupport (4.2.11.3)
|
|
46
31
|
i18n (~> 0.7)
|
|
47
32
|
minitest (~> 5.1)
|
|
@@ -49,30 +34,24 @@ GEM
|
|
|
49
34
|
tzinfo (~> 1.1)
|
|
50
35
|
addressable (2.8.0)
|
|
51
36
|
public_suffix (>= 2.0.2, < 5.0)
|
|
52
|
-
arel (6.0.4)
|
|
53
37
|
builder (3.2.4)
|
|
54
|
-
concurrent-ruby (1.1.
|
|
38
|
+
concurrent-ruby (1.1.10)
|
|
55
39
|
crass (1.0.6)
|
|
56
40
|
diff-lcs (1.5.0)
|
|
57
41
|
erubis (2.7.0)
|
|
58
|
-
globalid (0.4.2)
|
|
59
|
-
activesupport (>= 4.2.0)
|
|
60
42
|
i18n (0.9.5)
|
|
61
43
|
concurrent-ruby (~> 1.0)
|
|
62
44
|
json-schema (2.8.1)
|
|
63
45
|
addressable (>= 2.4)
|
|
64
|
-
loofah (2.
|
|
46
|
+
loofah (2.15.0)
|
|
65
47
|
crass (~> 1.0.2)
|
|
66
48
|
nokogiri (>= 1.5.9)
|
|
67
|
-
mail (2.7.1)
|
|
68
|
-
mini_mime (>= 0.1.1)
|
|
69
49
|
maruku (0.7.3)
|
|
70
50
|
mime-types (2.99.3)
|
|
71
|
-
|
|
72
|
-
mini_portile2 (2.7.1)
|
|
51
|
+
mini_portile2 (2.8.0)
|
|
73
52
|
minitest (5.15.0)
|
|
74
|
-
nokogiri (1.13.
|
|
75
|
-
mini_portile2 (~> 2.
|
|
53
|
+
nokogiri (1.13.3)
|
|
54
|
+
mini_portile2 (~> 2.8.0)
|
|
76
55
|
racc (~> 1.4)
|
|
77
56
|
psych (4.0.3)
|
|
78
57
|
stringio
|
|
@@ -81,17 +60,6 @@ GEM
|
|
|
81
60
|
rack (1.6.13)
|
|
82
61
|
rack-test (0.6.3)
|
|
83
62
|
rack (>= 1.0)
|
|
84
|
-
rails (4.2.11.3)
|
|
85
|
-
actionmailer (= 4.2.11.3)
|
|
86
|
-
actionpack (= 4.2.11.3)
|
|
87
|
-
actionview (= 4.2.11.3)
|
|
88
|
-
activejob (= 4.2.11.3)
|
|
89
|
-
activemodel (= 4.2.11.3)
|
|
90
|
-
activerecord (= 4.2.11.3)
|
|
91
|
-
activesupport (= 4.2.11.3)
|
|
92
|
-
bundler (>= 1.3.0, < 2.0)
|
|
93
|
-
railties (= 4.2.11.3)
|
|
94
|
-
sprockets-rails
|
|
95
63
|
rails-deprecated_sanitizer (1.0.4)
|
|
96
64
|
activesupport (>= 4.2.0.alpha)
|
|
97
65
|
rails-dom-testing (1.0.9)
|
|
@@ -125,13 +93,6 @@ GEM
|
|
|
125
93
|
rspec-mocks (~> 3.9.0)
|
|
126
94
|
rspec-support (~> 3.9.0)
|
|
127
95
|
rspec-support (3.9.4)
|
|
128
|
-
sprockets (4.0.2)
|
|
129
|
-
concurrent-ruby (~> 1.0)
|
|
130
|
-
rack (> 1, < 3)
|
|
131
|
-
sprockets-rails (3.2.2)
|
|
132
|
-
actionpack (>= 4.0)
|
|
133
|
-
activesupport (>= 4.0)
|
|
134
|
-
sprockets (>= 3.0.0)
|
|
135
96
|
sqlite3 (1.3.13)
|
|
136
97
|
stringio (3.0.1)
|
|
137
98
|
thor (1.2.1)
|
|
@@ -144,12 +105,13 @@ PLATFORMS
|
|
|
144
105
|
|
|
145
106
|
DEPENDENCIES
|
|
146
107
|
RedCloth
|
|
108
|
+
actionpack (~> 4.2.5)
|
|
109
|
+
activesupport (~> 4.2.5)
|
|
147
110
|
apipie-rails!
|
|
148
111
|
json-schema (~> 2.8)
|
|
149
112
|
maruku
|
|
150
113
|
mime-types (~> 2.99.3)
|
|
151
114
|
minitest
|
|
152
|
-
rails (~> 4.2.5)
|
|
153
115
|
rake
|
|
154
116
|
rdoc
|
|
155
117
|
rspec-rails (~> 3.0)
|
data/gemfiles/Gemfile.rails52
CHANGED
data/gemfiles/Gemfile.rails60
CHANGED
|
@@ -2,9 +2,16 @@ source "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
gemspec path: '..'
|
|
4
4
|
|
|
5
|
-
gem '
|
|
6
|
-
gem '
|
|
5
|
+
gem 'actionpack', '~> 6.0.4'
|
|
6
|
+
gem 'activesupport', '~> 6.0.4'
|
|
7
|
+
gem 'mime-types', '~> 3.0'
|
|
7
8
|
gem 'rails-controller-testing'
|
|
8
|
-
gem 'rspec-rails', '~>
|
|
9
|
+
gem 'rspec-rails', '~> 5.0'
|
|
10
|
+
|
|
11
|
+
# net-smtp not included by default in Ruby 3.1
|
|
12
|
+
# Will be fixed by https://github.com/mikel/mail/pull/1439
|
|
13
|
+
if Gem.ruby_version >= Gem::Version.new("3.1.0")
|
|
14
|
+
gem 'net-smtp', require: false
|
|
15
|
+
end
|
|
9
16
|
|
|
10
17
|
gem 'test_engine', path: '../spec/dummy/components/test_engine', group: :test
|
data/gemfiles/Gemfile.rails61
CHANGED
|
@@ -2,9 +2,16 @@ source "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
gemspec path: '..'
|
|
4
4
|
|
|
5
|
-
gem '
|
|
6
|
-
gem '
|
|
5
|
+
gem 'actionpack', '~> 6.1.5'
|
|
6
|
+
gem 'activesupport', '~> 6.1.5'
|
|
7
|
+
gem 'mime-types', '~> 3.0'
|
|
7
8
|
gem 'rails-controller-testing'
|
|
8
|
-
gem 'rspec-rails', '~>
|
|
9
|
+
gem 'rspec-rails', '~> 5.0'
|
|
10
|
+
|
|
11
|
+
# net-smtp not included by default in Ruby 3.1
|
|
12
|
+
# Will be fixed by https://github.com/mikel/mail/pull/1439
|
|
13
|
+
if Gem.ruby_version >= Gem::Version.new("3.1.0")
|
|
14
|
+
gem 'net-smtp', require: false
|
|
15
|
+
end
|
|
9
16
|
|
|
10
17
|
gem 'test_engine', path: '../spec/dummy/components/test_engine', group: :test
|
data/lib/apipie/version.rb
CHANGED
data/lib/apipie-rails.rb
CHANGED
|
@@ -47,6 +47,31 @@ describe Apipie::ApipiesController do
|
|
|
47
47
|
|
|
48
48
|
assert_response :not_found
|
|
49
49
|
end
|
|
50
|
+
|
|
51
|
+
it "succeeds on method details with a supported language" do
|
|
52
|
+
allow(Apipie.configuration).to receive(:languages).and_return(%w[en es])
|
|
53
|
+
|
|
54
|
+
get :index, :params => { :version => "2.0", :resource => "architectures", :method => "index.es" }
|
|
55
|
+
|
|
56
|
+
assert_response :success
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "succeeds on method details with the default language" do
|
|
60
|
+
allow(Apipie.configuration).to receive(:default_locale).and_return("en")
|
|
61
|
+
allow(Apipie.configuration).to receive(:languages).and_return([])
|
|
62
|
+
|
|
63
|
+
get :index, :params => { :version => "2.0", :resource => "architectures", :method => "index.en" }
|
|
64
|
+
|
|
65
|
+
assert_response :success
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it "returns not_found on a method with an unsupported language" do
|
|
69
|
+
allow(Apipie.configuration).to receive(:languages).and_return(%w[en es])
|
|
70
|
+
|
|
71
|
+
get :index, :params => { :version => "2.0", :resource => "architectures", :method => "index.jp" }
|
|
72
|
+
|
|
73
|
+
assert_response :not_found
|
|
74
|
+
end
|
|
50
75
|
end
|
|
51
76
|
|
|
52
77
|
describe "reload_controllers" do
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
require File.expand_path('../boot', __FILE__)
|
|
2
2
|
|
|
3
|
-
require "active_model/railtie"
|
|
4
|
-
require "active_record/railtie"
|
|
5
3
|
require "action_controller/railtie"
|
|
6
4
|
require "action_view/railtie"
|
|
7
|
-
require "action_mailer/railtie"
|
|
8
5
|
|
|
9
6
|
Bundler.require
|
|
10
7
|
require "apipie-rails"
|
|
@@ -13,9 +13,6 @@ Dummy::Application.configure do
|
|
|
13
13
|
config.consider_all_requests_local = true
|
|
14
14
|
config.action_controller.perform_caching = false
|
|
15
15
|
|
|
16
|
-
# Don't care if the mailer can't send
|
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
|
18
|
-
|
|
19
16
|
# Print deprecation notices to the Rails logger
|
|
20
17
|
config.active_support.deprecation = :log
|
|
21
18
|
|
|
@@ -34,9 +34,6 @@ Dummy::Application.configure do
|
|
|
34
34
|
# Enable serving of images, stylesheets, and javascripts from an asset server
|
|
35
35
|
# config.action_controller.asset_host = "http://assets.example.com"
|
|
36
36
|
|
|
37
|
-
# Disable delivery errors, bad email addresses will be ignored
|
|
38
|
-
# config.action_mailer.raise_delivery_errors = false
|
|
39
|
-
|
|
40
37
|
# Enable threaded mode
|
|
41
38
|
# config.threadsafe!
|
|
42
39
|
|
|
@@ -20,11 +20,6 @@ Dummy::Application.configure do
|
|
|
20
20
|
# Disable request forgery protection in test environment
|
|
21
21
|
config.action_controller.allow_forgery_protection = false
|
|
22
22
|
|
|
23
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
|
24
|
-
# The :test delivery method accumulates sent emails in the
|
|
25
|
-
# ActionMailer::Base.deliveries array.
|
|
26
|
-
config.action_mailer.delivery_method = :test
|
|
27
|
-
|
|
28
23
|
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
|
29
24
|
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
30
25
|
# like if you have constraints or database-specific column types
|
|
@@ -10,78 +10,78 @@ RSpec.describe PetsController, :type => :controller do
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it "does not raise error when rendered output matches the described response" do
|
|
13
|
-
response = get :return_and_validate_expected_response,
|
|
13
|
+
response = get :return_and_validate_expected_response, format: :json
|
|
14
14
|
expect(response).to match_declared_responses
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
it "does not raise error when rendered output (array) matches the described response" do
|
|
18
|
-
response = get :return_and_validate_expected_array_response,
|
|
18
|
+
response = get :return_and_validate_expected_array_response, format: :json
|
|
19
19
|
expect(response).to match_declared_responses
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
it "does not raises error when rendered output includes null in the response" do
|
|
23
|
-
response = get :return_and_validate_expected_response_with_null,
|
|
23
|
+
response = get :return_and_validate_expected_response_with_null, format: :json
|
|
24
24
|
expect(response).to match_declared_responses
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
it "does not raise error when rendered output includes null (instead of an object) in the response" do
|
|
28
|
-
response = get :return_and_validate_expected_response_with_null_object,
|
|
28
|
+
response = get :return_and_validate_expected_response_with_null_object, format: :json
|
|
29
29
|
expect(response).to match_declared_responses
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
it "raises error when a response field has the wrong type" do
|
|
33
|
-
response = get :return_and_validate_type_mismatch,
|
|
33
|
+
response = get :return_and_validate_type_mismatch, format: :json
|
|
34
34
|
expect(response).not_to match_declared_responses
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
it "raises error when a response has a missing field" do
|
|
38
|
-
response = get :return_and_validate_missing_field,
|
|
38
|
+
response = get :return_and_validate_missing_field, format: :json
|
|
39
39
|
expect(response).not_to match_declared_responses
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
it "raises error when a response has an extra property and 'swagger_allow_additional_properties_in_response' is false" do
|
|
43
|
-
response = get :return_and_validate_extra_property,
|
|
43
|
+
response = get :return_and_validate_extra_property, format: :json
|
|
44
44
|
expect(response).not_to match_declared_responses
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
it "raises error when a response has is array instead of object" do
|
|
48
48
|
# note: this action returns HTTP 201, not HTTP 200!
|
|
49
|
-
response = get :return_and_validate_unexpected_array_response,
|
|
49
|
+
response = get :return_and_validate_unexpected_array_response, format: :json
|
|
50
50
|
expect(response).not_to match_declared_responses
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
it "does not raise error when a response has an extra property and 'swagger_allow_additional_properties_in_response' is true" do
|
|
54
54
|
Apipie.configuration.swagger_allow_additional_properties_in_response = true
|
|
55
|
-
response = get :return_and_validate_extra_property,
|
|
55
|
+
response = get :return_and_validate_extra_property, format: :json
|
|
56
56
|
expect(response).to match_declared_responses
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
it "does not raise error when a response has an extra field and 'additional_properties' is specified in the response" do
|
|
60
60
|
Apipie.configuration.swagger_allow_additional_properties_in_response = false
|
|
61
|
-
response = get :return_and_validate_allowed_extra_property,
|
|
61
|
+
response = get :return_and_validate_allowed_extra_property, format: :json
|
|
62
62
|
expect(response).to match_declared_responses
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
it "raises error when a response sub-object has an extra field and 'additional_properties' is not specified on it, but specified on the top level of the response" do
|
|
66
66
|
Apipie.configuration.swagger_allow_additional_properties_in_response = false
|
|
67
|
-
response = get :sub_object_invalid_extra_property,
|
|
67
|
+
response = get :sub_object_invalid_extra_property, format: :json
|
|
68
68
|
expect(response).not_to match_declared_responses
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
it "does not
|
|
71
|
+
it "does not raise error when a response sub-object has an extra field and 'additional_properties' is specified on it" do
|
|
72
72
|
Apipie.configuration.swagger_allow_additional_properties_in_response = false
|
|
73
|
-
response = get :sub_object_allowed_extra_property,
|
|
73
|
+
response = get :sub_object_allowed_extra_property, format: :json
|
|
74
74
|
expect(response).to match_declared_responses
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
describe "auto validation" do
|
|
78
78
|
auto_validate_rendered_views
|
|
79
79
|
it "raises exception when a response field has the wrong type and auto validation is turned on" do
|
|
80
|
-
expect { get :return_and_validate_type_mismatch,
|
|
80
|
+
expect { get :return_and_validate_type_mismatch, format: :json }.to raise_error(Apipie::ResponseDoesNotMatchSwaggerSchema)
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
it "does not raise an exception when calling an undocumented method" do
|
|
84
|
-
expect { get :undocumented_method,
|
|
84
|
+
expect { get :undocumented_method, format: :json }.not_to raise_error
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
end
|
|
@@ -89,12 +89,12 @@ RSpec.describe PetsController, :type => :controller do
|
|
|
89
89
|
|
|
90
90
|
describe "with array field" do
|
|
91
91
|
it "no error for valid response" do
|
|
92
|
-
response = get :returns_response_with_valid_array,
|
|
92
|
+
response = get :returns_response_with_valid_array, format: :json
|
|
93
93
|
expect(response).to match_declared_responses
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
it "error if type of element in the array is wrong" do
|
|
97
|
-
response = get :returns_response_with_invalid_array,
|
|
97
|
+
response = get :returns_response_with_invalid_array, format: :json
|
|
98
98
|
expect(response).not_to match_declared_responses
|
|
99
99
|
end
|
|
100
100
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -13,7 +13,13 @@ require 'test_engine'
|
|
|
13
13
|
module Rails4Compatibility
|
|
14
14
|
module Testing
|
|
15
15
|
def process(*args)
|
|
16
|
-
compatible_request(*args)
|
|
16
|
+
compatible_request(*args) do |*new_args|
|
|
17
|
+
if Gem.ruby_version < Gem::Version.new('3.0.0')
|
|
18
|
+
super(*new_args)
|
|
19
|
+
else
|
|
20
|
+
super(new_args[0], **new_args[1])
|
|
21
|
+
end
|
|
22
|
+
end
|
|
17
23
|
end
|
|
18
24
|
|
|
19
25
|
def compatible_request(method, action, hash = {})
|
metadata
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: apipie-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pavel Pokorny
|
|
8
8
|
- Ivan Necas
|
|
9
|
-
autorequire:
|
|
9
|
+
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2022-03-
|
|
12
|
+
date: 2022-03-29 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
|
-
name:
|
|
15
|
+
name: actionpack
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
requirements:
|
|
18
|
+
- - ">="
|
|
19
|
+
- !ruby/object:Gem::Version
|
|
20
|
+
version: '4.1'
|
|
21
|
+
type: :runtime
|
|
22
|
+
prerelease: false
|
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
24
|
+
requirements:
|
|
25
|
+
- - ">="
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: '4.1'
|
|
28
|
+
- !ruby/object:Gem::Dependency
|
|
29
|
+
name: activesupport
|
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
|
17
31
|
requirements:
|
|
18
32
|
- - ">="
|
|
@@ -328,7 +342,7 @@ files:
|
|
|
328
342
|
homepage: http://github.com/Apipie/apipie-rails
|
|
329
343
|
licenses: []
|
|
330
344
|
metadata: {}
|
|
331
|
-
post_install_message:
|
|
345
|
+
post_install_message:
|
|
332
346
|
rdoc_options: []
|
|
333
347
|
require_paths:
|
|
334
348
|
- lib
|
|
@@ -343,90 +357,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
343
357
|
- !ruby/object:Gem::Version
|
|
344
358
|
version: '0'
|
|
345
359
|
requirements: []
|
|
346
|
-
rubygems_version: 3.
|
|
347
|
-
signing_key:
|
|
360
|
+
rubygems_version: 3.2.32
|
|
361
|
+
signing_key:
|
|
348
362
|
specification_version: 4
|
|
349
363
|
summary: Rails REST API documentation tool
|
|
350
|
-
test_files:
|
|
351
|
-
- spec/controllers/api/v1/architectures_controller_spec.rb
|
|
352
|
-
- spec/controllers/api/v2/architectures_controller_spec.rb
|
|
353
|
-
- spec/controllers/api/v2/nested/resources_controller_spec.rb
|
|
354
|
-
- spec/controllers/apipies_controller_spec.rb
|
|
355
|
-
- spec/controllers/concerns_controller_spec.rb
|
|
356
|
-
- spec/controllers/extended_controller_spec.rb
|
|
357
|
-
- spec/controllers/memes_controller_spec.rb
|
|
358
|
-
- spec/controllers/users_controller_spec.rb
|
|
359
|
-
- spec/dummy/Rakefile
|
|
360
|
-
- spec/dummy/app/controllers/api/base_controller.rb
|
|
361
|
-
- spec/dummy/app/controllers/api/v1/architectures_controller.rb
|
|
362
|
-
- spec/dummy/app/controllers/api/v1/base_controller.rb
|
|
363
|
-
- spec/dummy/app/controllers/api/v2/architectures_controller.rb
|
|
364
|
-
- spec/dummy/app/controllers/api/v2/base_controller.rb
|
|
365
|
-
- spec/dummy/app/controllers/api/v2/nested/architectures_controller.rb
|
|
366
|
-
- spec/dummy/app/controllers/api/v2/nested/resources_controller.rb
|
|
367
|
-
- spec/dummy/app/controllers/application_controller.rb
|
|
368
|
-
- spec/dummy/app/controllers/concerns/extending_concern.rb
|
|
369
|
-
- spec/dummy/app/controllers/concerns/sample_controller.rb
|
|
370
|
-
- spec/dummy/app/controllers/concerns_controller.rb
|
|
371
|
-
- spec/dummy/app/controllers/extended_controller.rb
|
|
372
|
-
- spec/dummy/app/controllers/files_controller.rb
|
|
373
|
-
- spec/dummy/app/controllers/overridden_concerns_controller.rb
|
|
374
|
-
- spec/dummy/app/controllers/pets_controller.rb
|
|
375
|
-
- spec/dummy/app/controllers/pets_using_auto_views_controller.rb
|
|
376
|
-
- spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb
|
|
377
|
-
- spec/dummy/app/controllers/tagged_cats_controller.rb
|
|
378
|
-
- spec/dummy/app/controllers/tagged_dogs_controller.rb
|
|
379
|
-
- spec/dummy/app/controllers/twitter_example_controller.rb
|
|
380
|
-
- spec/dummy/app/controllers/users_controller.rb
|
|
381
|
-
- spec/dummy/app/views/layouts/application.html.erb
|
|
382
|
-
- spec/dummy/components/test_engine/Gemfile
|
|
383
|
-
- spec/dummy/components/test_engine/app/controllers/test_engine/application_controller.rb
|
|
384
|
-
- spec/dummy/components/test_engine/app/controllers/test_engine/memes_controller.rb
|
|
385
|
-
- spec/dummy/components/test_engine/config/routes.rb
|
|
386
|
-
- spec/dummy/components/test_engine/db/.gitkeep
|
|
387
|
-
- spec/dummy/components/test_engine/lib/test_engine.rb
|
|
388
|
-
- spec/dummy/components/test_engine/test_engine.gemspec
|
|
389
|
-
- spec/dummy/config.ru
|
|
390
|
-
- spec/dummy/config/application.rb
|
|
391
|
-
- spec/dummy/config/boot.rb
|
|
392
|
-
- spec/dummy/config/database.yml
|
|
393
|
-
- spec/dummy/config/environment.rb
|
|
394
|
-
- spec/dummy/config/environments/development.rb
|
|
395
|
-
- spec/dummy/config/environments/production.rb
|
|
396
|
-
- spec/dummy/config/environments/test.rb
|
|
397
|
-
- spec/dummy/config/initializers/apipie.rb
|
|
398
|
-
- spec/dummy/config/initializers/backtrace_silencers.rb
|
|
399
|
-
- spec/dummy/config/initializers/inflections.rb
|
|
400
|
-
- spec/dummy/config/initializers/mime_types.rb
|
|
401
|
-
- spec/dummy/config/initializers/secret_token.rb
|
|
402
|
-
- spec/dummy/config/initializers/session_store.rb
|
|
403
|
-
- spec/dummy/config/locales/en.yml
|
|
404
|
-
- spec/dummy/config/routes.rb
|
|
405
|
-
- spec/dummy/db/.gitkeep
|
|
406
|
-
- spec/dummy/doc/apipie_examples.json
|
|
407
|
-
- spec/dummy/doc/users/desc_from_file.md
|
|
408
|
-
- spec/dummy/public/404.html
|
|
409
|
-
- spec/dummy/public/422.html
|
|
410
|
-
- spec/dummy/public/500.html
|
|
411
|
-
- spec/dummy/public/favicon.ico
|
|
412
|
-
- spec/dummy/public/stylesheets/.gitkeep
|
|
413
|
-
- spec/dummy/script/rails
|
|
414
|
-
- spec/lib/application_spec.rb
|
|
415
|
-
- spec/lib/extractor/extractor_spec.rb
|
|
416
|
-
- spec/lib/extractor/middleware_spec.rb
|
|
417
|
-
- spec/lib/extractor/writer_spec.rb
|
|
418
|
-
- spec/lib/file_handler_spec.rb
|
|
419
|
-
- spec/lib/method_description_spec.rb
|
|
420
|
-
- spec/lib/param_description_spec.rb
|
|
421
|
-
- spec/lib/param_group_spec.rb
|
|
422
|
-
- spec/lib/rake_spec.rb
|
|
423
|
-
- spec/lib/resource_description_spec.rb
|
|
424
|
-
- spec/lib/swagger/openapi_2_0_schema.json
|
|
425
|
-
- spec/lib/swagger/rake_swagger_spec.rb
|
|
426
|
-
- spec/lib/swagger/response_validation_spec.rb
|
|
427
|
-
- spec/lib/swagger/swagger_dsl_spec.rb
|
|
428
|
-
- spec/lib/validator_spec.rb
|
|
429
|
-
- spec/lib/validators/array_validator_spec.rb
|
|
430
|
-
- spec/spec_helper.rb
|
|
431
|
-
- spec/support/rails-42-ruby-26.rb
|
|
432
|
-
- spec/support/rake.rb
|
|
364
|
+
test_files: []
|