apipie-rails 0.5.19 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +50 -0
- data/CHANGELOG.md +15 -0
- data/Gemfile +1 -1
- data/README.rst +5 -5
- data/apipie-rails.gemspec +2 -1
- data/app/controllers/apipie/apipies_controller.rb +1 -1
- data/{Gemfile.rails42 → gemfiles/Gemfile.rails42} +4 -3
- data/gemfiles/Gemfile.rails42.lock +122 -0
- data/gemfiles/Gemfile.rails52 +10 -0
- data/gemfiles/Gemfile.rails60 +17 -0
- data/gemfiles/Gemfile.rails61 +17 -0
- data/lib/apipie/extractor/recorder.rb +3 -2
- data/lib/apipie/validator.rb +1 -1
- data/lib/apipie/version.rb +1 -1
- data/lib/apipie-rails.rb +0 -4
- data/rel-eng/gem_release.ipynb +41 -9
- 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
- data/spec/support/rails-42-ruby-26.rb +15 -0
- metadata +26 -93
- data/.travis.yml +0 -41
- data/Gemfile.rails41 +0 -7
- data/Gemfile.rails50 +0 -9
- data/Gemfile.rails51 +0 -9
- data/Gemfile.rails60 +0 -10
- data/Gemfile.rails61 +0 -10
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
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: build
|
9
|
+
|
10
|
+
on: [push, pull_request]
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
runs-on: ubuntu-20.04
|
15
|
+
strategy:
|
16
|
+
fail-fast: false
|
17
|
+
matrix:
|
18
|
+
ruby:
|
19
|
+
- 2.6
|
20
|
+
- 2.7
|
21
|
+
- '3.0'
|
22
|
+
- 3.1
|
23
|
+
gemfile:
|
24
|
+
- Gemfile.rails42
|
25
|
+
- Gemfile.rails52 # Min ruby 2.2.2
|
26
|
+
- Gemfile.rails60 # Min ruby 2.5.0
|
27
|
+
- Gemfile.rails61 # Min ruby 2.5.0
|
28
|
+
exclude:
|
29
|
+
- gemfile: Gemfile.rails42
|
30
|
+
ruby: 2.7
|
31
|
+
- gemfile: Gemfile.rails42
|
32
|
+
ruby: '3.0'
|
33
|
+
- gemfile: Gemfile.rails42
|
34
|
+
ruby: 3.1
|
35
|
+
- gemfile: Gemfile.rails52
|
36
|
+
ruby: 2.7
|
37
|
+
- gemfile: Gemfile.rails52
|
38
|
+
ruby: '3.0'
|
39
|
+
- gemfile: Gemfile.rails52
|
40
|
+
ruby: 3.1
|
41
|
+
|
42
|
+
env:
|
43
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}
|
44
|
+
steps:
|
45
|
+
- uses: actions/checkout@v2
|
46
|
+
- uses: ruby/setup-ruby@v1
|
47
|
+
with:
|
48
|
+
ruby-version: ${{ matrix.ruby }}
|
49
|
+
bundler-cache: true
|
50
|
+
- run: bundle exec rspec
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
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
|
+
|
10
|
+
## [v0.5.20](https://github.com/Apipie/apipie-rails/tree/v0.5.20) (2022-03-16)
|
11
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.19...v0.5.20)
|
12
|
+
* Update rel-eng (Oleh Fedorenko)
|
13
|
+
* Deprecate travis, run tests on github actions [#740](https://github.com/Apipie/apipie-rails/pull/740) (Mathieu Jobin)
|
14
|
+
* Update validator.rb [#739](https://github.com/Apipie/apipie-rails/pull/739) (Dmytro Budnyk)
|
15
|
+
* Fix wrong number of arguments for recorder#process [#725](https://github.com/Apipie/apipie-rails/pull/725) (rob mathews)
|
16
|
+
* Change "an" to "a" [#723](https://github.com/Apipie/apipie-rails/pull/723) (Naokimi)
|
17
|
+
|
3
18
|
## [v0.5.19](https://github.com/Apipie/apipie-rails/tree/v0.5.19) (2021-07-25)
|
4
19
|
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.18...v0.5.19)
|
5
20
|
* Add rel-eng notebook (Oleh Fedorenko)
|
data/Gemfile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Gemfile.rails61
|
data/README.rst
CHANGED
@@ -387,20 +387,20 @@ Example:
|
|
387
387
|
end
|
388
388
|
end
|
389
389
|
|
390
|
-
api :POST, "/users", "Create
|
390
|
+
api :POST, "/users", "Create a user"
|
391
391
|
param_group :user
|
392
392
|
def create
|
393
393
|
# ...
|
394
394
|
end
|
395
395
|
|
396
|
-
api :PUT, "/users/:id", "Update
|
396
|
+
api :PUT, "/users/:id", "Update a user"
|
397
397
|
param_group :user
|
398
398
|
def update
|
399
399
|
# ...
|
400
400
|
end
|
401
401
|
|
402
402
|
# v2/users_controller.rb
|
403
|
-
api :POST, "/users", "Create
|
403
|
+
api :POST, "/users", "Create a user"
|
404
404
|
param_group :user, V1::UsersController
|
405
405
|
def create
|
406
406
|
# ...
|
@@ -434,7 +434,7 @@ Example
|
|
434
434
|
end
|
435
435
|
end
|
436
436
|
|
437
|
-
api :POST, "/users", "Create
|
437
|
+
api :POST, "/users", "Create a user"
|
438
438
|
param_group :user
|
439
439
|
def create
|
440
440
|
# ...
|
@@ -446,7 +446,7 @@ Example
|
|
446
446
|
# ...
|
447
447
|
end
|
448
448
|
|
449
|
-
api :PUT, "/users/:id", "Update
|
449
|
+
api :PUT, "/users/:id", "Update a user"
|
450
450
|
param_group :user
|
451
451
|
def update
|
452
452
|
# ...
|
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
|
@@ -1,8 +1,9 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gemspec
|
3
|
+
gemspec path: '..'
|
4
4
|
|
5
|
-
gem '
|
5
|
+
gem 'actionpack', '~> 4.2.5'
|
6
|
+
gem 'activesupport', '~> 4.2.5'
|
6
7
|
gem 'mime-types', '~> 2.99.3'
|
7
8
|
gem 'sqlite3', '~> 1.3.6'
|
8
9
|
|
@@ -11,4 +12,4 @@ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.1.0')
|
|
11
12
|
gem 'rdoc', '~> 4.2.2'
|
12
13
|
end
|
13
14
|
|
14
|
-
gem 'test_engine', path: 'spec/dummy/components/test_engine', group: :test
|
15
|
+
gem 'test_engine', path: '../spec/dummy/components/test_engine', group: :test
|
@@ -0,0 +1,122 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../spec/dummy/components/test_engine
|
3
|
+
specs:
|
4
|
+
test_engine (0.0.1)
|
5
|
+
|
6
|
+
PATH
|
7
|
+
remote: ..
|
8
|
+
specs:
|
9
|
+
apipie-rails (0.5.20)
|
10
|
+
actionpack (>= 4.1)
|
11
|
+
activesupport (>= 4.1)
|
12
|
+
|
13
|
+
GEM
|
14
|
+
remote: https://rubygems.org/
|
15
|
+
specs:
|
16
|
+
RedCloth (4.3.2)
|
17
|
+
actionpack (4.2.11.3)
|
18
|
+
actionview (= 4.2.11.3)
|
19
|
+
activesupport (= 4.2.11.3)
|
20
|
+
rack (~> 1.6)
|
21
|
+
rack-test (~> 0.6.2)
|
22
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
23
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
24
|
+
actionview (4.2.11.3)
|
25
|
+
activesupport (= 4.2.11.3)
|
26
|
+
builder (~> 3.1)
|
27
|
+
erubis (~> 2.7.0)
|
28
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
29
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
30
|
+
activesupport (4.2.11.3)
|
31
|
+
i18n (~> 0.7)
|
32
|
+
minitest (~> 5.1)
|
33
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
34
|
+
tzinfo (~> 1.1)
|
35
|
+
addressable (2.8.0)
|
36
|
+
public_suffix (>= 2.0.2, < 5.0)
|
37
|
+
builder (3.2.4)
|
38
|
+
concurrent-ruby (1.1.10)
|
39
|
+
crass (1.0.6)
|
40
|
+
diff-lcs (1.5.0)
|
41
|
+
erubis (2.7.0)
|
42
|
+
i18n (0.9.5)
|
43
|
+
concurrent-ruby (~> 1.0)
|
44
|
+
json-schema (2.8.1)
|
45
|
+
addressable (>= 2.4)
|
46
|
+
loofah (2.15.0)
|
47
|
+
crass (~> 1.0.2)
|
48
|
+
nokogiri (>= 1.5.9)
|
49
|
+
maruku (0.7.3)
|
50
|
+
mime-types (2.99.3)
|
51
|
+
mini_portile2 (2.8.0)
|
52
|
+
minitest (5.15.0)
|
53
|
+
nokogiri (1.13.3)
|
54
|
+
mini_portile2 (~> 2.8.0)
|
55
|
+
racc (~> 1.4)
|
56
|
+
psych (4.0.3)
|
57
|
+
stringio
|
58
|
+
public_suffix (4.0.6)
|
59
|
+
racc (1.6.0)
|
60
|
+
rack (1.6.13)
|
61
|
+
rack-test (0.6.3)
|
62
|
+
rack (>= 1.0)
|
63
|
+
rails-deprecated_sanitizer (1.0.4)
|
64
|
+
activesupport (>= 4.2.0.alpha)
|
65
|
+
rails-dom-testing (1.0.9)
|
66
|
+
activesupport (>= 4.2.0, < 5.0)
|
67
|
+
nokogiri (~> 1.6)
|
68
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
69
|
+
rails-html-sanitizer (1.4.2)
|
70
|
+
loofah (~> 2.3)
|
71
|
+
railties (4.2.11.3)
|
72
|
+
actionpack (= 4.2.11.3)
|
73
|
+
activesupport (= 4.2.11.3)
|
74
|
+
rake (>= 0.8.7)
|
75
|
+
thor (>= 0.18.1, < 2.0)
|
76
|
+
rake (13.0.6)
|
77
|
+
rdoc (6.4.0)
|
78
|
+
psych (>= 4.0.0)
|
79
|
+
rspec-core (3.9.3)
|
80
|
+
rspec-support (~> 3.9.3)
|
81
|
+
rspec-expectations (3.9.4)
|
82
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
+
rspec-support (~> 3.9.0)
|
84
|
+
rspec-mocks (3.9.1)
|
85
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
+
rspec-support (~> 3.9.0)
|
87
|
+
rspec-rails (3.9.1)
|
88
|
+
actionpack (>= 3.0)
|
89
|
+
activesupport (>= 3.0)
|
90
|
+
railties (>= 3.0)
|
91
|
+
rspec-core (~> 3.9.0)
|
92
|
+
rspec-expectations (~> 3.9.0)
|
93
|
+
rspec-mocks (~> 3.9.0)
|
94
|
+
rspec-support (~> 3.9.0)
|
95
|
+
rspec-support (3.9.4)
|
96
|
+
sqlite3 (1.3.13)
|
97
|
+
stringio (3.0.1)
|
98
|
+
thor (1.2.1)
|
99
|
+
thread_safe (0.3.6)
|
100
|
+
tzinfo (1.2.9)
|
101
|
+
thread_safe (~> 0.1)
|
102
|
+
|
103
|
+
PLATFORMS
|
104
|
+
ruby
|
105
|
+
|
106
|
+
DEPENDENCIES
|
107
|
+
RedCloth
|
108
|
+
actionpack (~> 4.2.5)
|
109
|
+
activesupport (~> 4.2.5)
|
110
|
+
apipie-rails!
|
111
|
+
json-schema (~> 2.8)
|
112
|
+
maruku
|
113
|
+
mime-types (~> 2.99.3)
|
114
|
+
minitest
|
115
|
+
rake
|
116
|
+
rdoc
|
117
|
+
rspec-rails (~> 3.0)
|
118
|
+
sqlite3 (~> 1.3.6)
|
119
|
+
test_engine!
|
120
|
+
|
121
|
+
BUNDLED WITH
|
122
|
+
1.17.3
|
@@ -0,0 +1,10 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: '..'
|
4
|
+
|
5
|
+
gem 'actionpack', '~> 5.2.6'
|
6
|
+
gem 'activesupport', '~> 5.2.6'
|
7
|
+
gem 'mime-types', '~> 2.99.3'
|
8
|
+
gem 'rails-controller-testing'
|
9
|
+
|
10
|
+
gem 'test_engine', path: '../spec/dummy/components/test_engine', group: :test
|
@@ -0,0 +1,17 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: '..'
|
4
|
+
|
5
|
+
gem 'actionpack', '~> 6.0.4'
|
6
|
+
gem 'activesupport', '~> 6.0.4'
|
7
|
+
gem 'mime-types', '~> 3.0'
|
8
|
+
gem 'rails-controller-testing'
|
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
|
16
|
+
|
17
|
+
gem 'test_engine', path: '../spec/dummy/components/test_engine', group: :test
|
@@ -0,0 +1,17 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: '..'
|
4
|
+
|
5
|
+
gem 'actionpack', '~> 6.1.5'
|
6
|
+
gem 'activesupport', '~> 6.1.5'
|
7
|
+
gem 'mime-types', '~> 3.0'
|
8
|
+
gem 'rails-controller-testing'
|
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
|
16
|
+
|
17
|
+
gem 'test_engine', path: '../spec/dummy/components/test_engine', group: :test
|
@@ -150,8 +150,8 @@ module Apipie
|
|
150
150
|
end
|
151
151
|
|
152
152
|
module FunctionalTestRecording
|
153
|
-
def process(
|
154
|
-
ret = super
|
153
|
+
def process(*, **) # action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
|
154
|
+
ret = super
|
155
155
|
if Apipie.configuration.record
|
156
156
|
Apipie::Extractor.call_recorder.analyze_functional_test(self)
|
157
157
|
Apipie::Extractor.call_finished
|
@@ -160,6 +160,7 @@ module Apipie
|
|
160
160
|
ensure
|
161
161
|
Apipie::Extractor.clean_call_recorder
|
162
162
|
end
|
163
|
+
ruby2_keywords :process if respond_to?(:ruby2_keywords, true)
|
163
164
|
end
|
164
165
|
end
|
165
166
|
end
|
data/lib/apipie/validator.rb
CHANGED
data/lib/apipie/version.rb
CHANGED
data/lib/apipie-rails.rb
CHANGED
data/rel-eng/gem_release.ipynb
CHANGED
@@ -10,7 +10,8 @@
|
|
10
10
|
"- push access to https://github.com/Apipie/apipie-rails\n",
|
11
11
|
"- push access to rubygems.org for apipie-rails\n",
|
12
12
|
"- sudo yum install python-slugify asciidoc\n",
|
13
|
-
"- ensure neither the `git push` or `gem push` don't require interractive auth. If you can't use api key or ssh key to auth skip these steps and run them form the shell manually
|
13
|
+
"- ensure neither the `git push` or `gem push` don't require interractive auth. If you can't use api key or ssh key to auth skip these steps and run them form the shell manually\n",
|
14
|
+
"- ensure all checks have passed on the branch you're about to release\n",
|
14
15
|
"\n",
|
15
16
|
"### Release process\n",
|
16
17
|
"- Follow the steps with `<Shift>+<Enter>` or `<Ctrl>+<Enter>,<Down>`\n",
|
@@ -19,6 +20,15 @@
|
|
19
20
|
"### Release settings"
|
20
21
|
]
|
21
22
|
},
|
23
|
+
{
|
24
|
+
"cell_type": "code",
|
25
|
+
"execution_count": null,
|
26
|
+
"metadata": {},
|
27
|
+
"outputs": [],
|
28
|
+
"source": [
|
29
|
+
"%autosave 0"
|
30
|
+
]
|
31
|
+
},
|
22
32
|
{
|
23
33
|
"cell_type": "code",
|
24
34
|
"execution_count": null,
|
@@ -41,10 +51,14 @@
|
|
41
51
|
"metadata": {},
|
42
52
|
"outputs": [],
|
43
53
|
"source": [
|
44
|
-
"NEW_VERSION = '0.5.
|
45
|
-
"LAST_VERSION = '0.5.
|
54
|
+
"NEW_VERSION = '0.5.20'\n",
|
55
|
+
"LAST_VERSION = '0.5.19'\n",
|
46
56
|
"GIT_REMOTE_UPSTREAM = 'origin'\n",
|
47
|
-
"
|
57
|
+
"STABLE_RELEASE = False\n",
|
58
|
+
"WORK_BRANCH = 'stable' if STABLE_RELEASE else 'master'\n",
|
59
|
+
"# Array of strings, e.g. [\"21cbsc214g3\", \"21casc214g3\"]\n",
|
60
|
+
"CHERRY_PICKS = []\n",
|
61
|
+
"GEMFILE='Gemfile.rails61'"
|
48
62
|
]
|
49
63
|
},
|
50
64
|
{
|
@@ -85,7 +99,25 @@
|
|
85
99
|
"cell_type": "markdown",
|
86
100
|
"metadata": {},
|
87
101
|
"source": [
|
88
|
-
"###
|
102
|
+
"### Cherry picks for stable release"
|
103
|
+
]
|
104
|
+
},
|
105
|
+
{
|
106
|
+
"cell_type": "code",
|
107
|
+
"execution_count": null,
|
108
|
+
"metadata": {},
|
109
|
+
"outputs": [],
|
110
|
+
"source": [
|
111
|
+
"if STABLE_RELEASE:\n",
|
112
|
+
" for cp in CHERRY_PICKS:\n",
|
113
|
+
" ! git cherry-pick -x {cp}"
|
114
|
+
]
|
115
|
+
},
|
116
|
+
{
|
117
|
+
"cell_type": "markdown",
|
118
|
+
"metadata": {},
|
119
|
+
"source": [
|
120
|
+
"### Run tests localy if your setup allows, otherwise ensure the HEAD is green"
|
89
121
|
]
|
90
122
|
},
|
91
123
|
{
|
@@ -94,7 +126,7 @@
|
|
94
126
|
"metadata": {},
|
95
127
|
"outputs": [],
|
96
128
|
"source": [
|
97
|
-
"! bundle update"
|
129
|
+
"! BUNDLE_GEMFILE=gemfiles/{GEMFILE} bundle update"
|
98
130
|
]
|
99
131
|
},
|
100
132
|
{
|
@@ -105,7 +137,7 @@
|
|
105
137
|
},
|
106
138
|
"outputs": [],
|
107
139
|
"source": [
|
108
|
-
"! bundle exec
|
140
|
+
"! BUNDLE_GEMFILE=gemfiles/{GEMFILE} bundle exec rspec"
|
109
141
|
]
|
110
142
|
},
|
111
143
|
{
|
@@ -249,7 +281,7 @@
|
|
249
281
|
"metadata": {},
|
250
282
|
"outputs": [],
|
251
283
|
"source": [
|
252
|
-
"! git tag
|
284
|
+
"! git tag {NEW_VERSION}"
|
253
285
|
]
|
254
286
|
},
|
255
287
|
{
|
@@ -265,7 +297,7 @@
|
|
265
297
|
"metadata": {},
|
266
298
|
"outputs": [],
|
267
299
|
"source": [
|
268
|
-
"! rake build"
|
300
|
+
"! BUNDLE_GEMFILE=gemfiles/{GEMFILE} bundle exec rake build"
|
269
301
|
]
|
270
302
|
},
|
271
303
|
{
|
@@ -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 = {})
|
@@ -0,0 +1,15 @@
|
|
1
|
+
if RUBY_VERSION >= '2.6.0'
|
2
|
+
if Rails.version < '5'
|
3
|
+
# rubocop:disable Style/CommentAnnotation
|
4
|
+
class ActionController::TestResponse < ActionDispatch::TestResponse
|
5
|
+
def recycle!
|
6
|
+
# hack to avoid MonitorMixin double-initialize error:
|
7
|
+
@mon_mutex_owner_object_id = nil
|
8
|
+
@mon_mutex = nil
|
9
|
+
initialize
|
10
|
+
end
|
11
|
+
end
|
12
|
+
# rubocop:enable Style/CommentAnnotation
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Pokorny
|
@@ -9,10 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
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
|
- - ">="
|
@@ -145,18 +159,12 @@ executables: []
|
|
145
159
|
extensions: []
|
146
160
|
extra_rdoc_files: []
|
147
161
|
files:
|
162
|
+
- ".github/workflows/build.yml"
|
148
163
|
- ".gitignore"
|
149
164
|
- ".rspec"
|
150
|
-
- ".travis.yml"
|
151
165
|
- APACHE-LICENSE-2.0
|
152
166
|
- CHANGELOG.md
|
153
167
|
- Gemfile
|
154
|
-
- Gemfile.rails41
|
155
|
-
- Gemfile.rails42
|
156
|
-
- Gemfile.rails50
|
157
|
-
- Gemfile.rails51
|
158
|
-
- Gemfile.rails60
|
159
|
-
- Gemfile.rails61
|
160
168
|
- MIT-LICENSE
|
161
169
|
- NOTICE
|
162
170
|
- PROPOSAL_FOR_RESPONSE_DESCRIPTIONS.md
|
@@ -203,6 +211,11 @@ files:
|
|
203
211
|
- config/locales/tr.yml
|
204
212
|
- config/locales/zh-CN.yml
|
205
213
|
- config/locales/zh-TW.yml
|
214
|
+
- gemfiles/Gemfile.rails42
|
215
|
+
- gemfiles/Gemfile.rails42.lock
|
216
|
+
- gemfiles/Gemfile.rails52
|
217
|
+
- gemfiles/Gemfile.rails60
|
218
|
+
- gemfiles/Gemfile.rails61
|
206
219
|
- images/screenshot-1.png
|
207
220
|
- images/screenshot-2.png
|
208
221
|
- lib/apipie-rails.rb
|
@@ -324,6 +337,7 @@ files:
|
|
324
337
|
- spec/lib/validator_spec.rb
|
325
338
|
- spec/lib/validators/array_validator_spec.rb
|
326
339
|
- spec/spec_helper.rb
|
340
|
+
- spec/support/rails-42-ruby-26.rb
|
327
341
|
- spec/support/rake.rb
|
328
342
|
homepage: http://github.com/Apipie/apipie-rails
|
329
343
|
licenses: []
|
@@ -343,89 +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.
|
360
|
+
rubygems_version: 3.2.32
|
347
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/rake.rb
|
364
|
+
test_files: []
|
data/.travis.yml
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
before_install: >-
|
4
|
-
if ruby -v | grep 'ruby 2.2'; then
|
5
|
-
gem install bundler -v '~> 1.17'
|
6
|
-
fi
|
7
|
-
rvm:
|
8
|
-
- 2.2.10
|
9
|
-
- 2.3.8
|
10
|
-
- 2.4.5
|
11
|
-
- 2.5.3
|
12
|
-
- 2.6.5
|
13
|
-
- 2.7.0
|
14
|
-
gemfile:
|
15
|
-
- Gemfile.rails42
|
16
|
-
- Gemfile.rails51 # Min ruby 2.2.2
|
17
|
-
- Gemfile.rails60 # Min ruby 2.5.0
|
18
|
-
- Gemfile.rails61 # Min ruby 2.5.0
|
19
|
-
|
20
|
-
matrix:
|
21
|
-
exclude:
|
22
|
-
- rvm: 2.5.3
|
23
|
-
gemfile: Gemfile.rails42
|
24
|
-
- rvm: 2.6.5
|
25
|
-
gemfile: Gemfile.rails42
|
26
|
-
- rvm: 2.7.0
|
27
|
-
gemfile: Gemfile.rails42
|
28
|
-
- rvm: 2.7.0
|
29
|
-
gemfile: Gemfile.rails51
|
30
|
-
- rvm: 2.2.10
|
31
|
-
gemfile: Gemfile.rails60
|
32
|
-
- rvm: 2.3.8
|
33
|
-
gemfile: Gemfile.rails60
|
34
|
-
- rvm: 2.4.5
|
35
|
-
gemfile: Gemfile.rails60
|
36
|
-
- rvm: 2.2.10
|
37
|
-
gemfile: Gemfile.rails61
|
38
|
-
- rvm: 2.3.8
|
39
|
-
gemfile: Gemfile.rails61
|
40
|
-
- rvm: 2.4.5
|
41
|
-
gemfile: Gemfile.rails61
|
data/Gemfile.rails41
DELETED
data/Gemfile.rails50
DELETED
data/Gemfile.rails51
DELETED
data/Gemfile.rails60
DELETED
data/Gemfile.rails61
DELETED