apipie-rails 0.5.19 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +31 -0
  3. data/.github/workflows/rubocop-challenger.yml +28 -0
  4. data/.github/workflows/rubocop.yml +18 -0
  5. data/.gitignore +1 -0
  6. data/.rubocop.yml +128 -0
  7. data/.rubocop_todo.yml +2056 -0
  8. data/.vscode/settings.json +3 -0
  9. data/CHANGELOG.md +161 -0
  10. data/Gemfile +20 -0
  11. data/README.rst +117 -23
  12. data/Rakefile +0 -5
  13. data/apipie-rails.gemspec +18 -9
  14. data/app/controllers/apipie/apipies_controller.rb +14 -29
  15. data/app/helpers/apipie_helper.rb +1 -1
  16. data/app/public/apipie/javascripts/bundled/bootstrap-collapse.js +70 -41
  17. data/app/public/apipie/javascripts/bundled/bootstrap.js +1033 -479
  18. data/app/public/apipie/javascripts/bundled/jquery.js +5 -5
  19. data/app/public/apipie/stylesheets/bundled/bootstrap-responsive.min.css +9 -12
  20. data/app/public/apipie/stylesheets/bundled/bootstrap.min.css +9 -689
  21. data/app/views/apipie/apipies/_deprecation.html.erb +16 -0
  22. data/app/views/apipie/apipies/_params.html.erb +7 -1
  23. data/config/locales/en.yml +8 -0
  24. data/config/locales/ko.yml +31 -0
  25. data/gemfiles/Gemfile.tools +9 -0
  26. data/lib/apipie/apipie_module.rb +7 -7
  27. data/lib/apipie/application.rb +132 -97
  28. data/lib/apipie/configuration.rb +43 -33
  29. data/lib/apipie/dsl_definition.rb +44 -33
  30. data/lib/apipie/error_description.rb +3 -3
  31. data/lib/apipie/errors.rb +17 -17
  32. data/lib/apipie/extractor/collector.rb +5 -6
  33. data/lib/apipie/extractor/recorder.rb +35 -8
  34. data/lib/apipie/extractor/writer.rb +15 -15
  35. data/lib/apipie/extractor.rb +6 -9
  36. data/lib/apipie/generator/config.rb +12 -0
  37. data/lib/apipie/generator/generator.rb +2 -0
  38. data/lib/apipie/generator/swagger/computed_interface_id.rb +23 -0
  39. data/lib/apipie/generator/swagger/config.rb +80 -0
  40. data/lib/apipie/generator/swagger/context.rb +38 -0
  41. data/lib/apipie/generator/swagger/method_description/api_decorator.rb +20 -0
  42. data/lib/apipie/generator/swagger/method_description/api_schema_service.rb +89 -0
  43. data/lib/apipie/generator/swagger/method_description/decorator.rb +22 -0
  44. data/lib/apipie/generator/swagger/method_description/parameters_service.rb +139 -0
  45. data/lib/apipie/generator/swagger/method_description/response_schema_service.rb +46 -0
  46. data/lib/apipie/generator/swagger/method_description/response_service.rb +58 -0
  47. data/lib/apipie/generator/swagger/method_description.rb +2 -0
  48. data/lib/apipie/generator/swagger/operation_id.rb +51 -0
  49. data/lib/apipie/generator/swagger/param_description/builder.rb +114 -0
  50. data/lib/apipie/generator/swagger/param_description/composite.rb +119 -0
  51. data/lib/apipie/generator/swagger/param_description/description.rb +15 -0
  52. data/lib/apipie/generator/swagger/param_description/in.rb +37 -0
  53. data/lib/apipie/generator/swagger/param_description/name.rb +18 -0
  54. data/lib/apipie/generator/swagger/param_description/path_params_composite.rb +61 -0
  55. data/lib/apipie/generator/swagger/param_description/referenced_composite.rb +36 -0
  56. data/lib/apipie/generator/swagger/param_description/type.rb +128 -0
  57. data/lib/apipie/generator/swagger/param_description.rb +18 -0
  58. data/lib/apipie/generator/swagger/path_decorator.rb +36 -0
  59. data/lib/apipie/generator/swagger/referenced_definitions.rb +17 -0
  60. data/lib/apipie/generator/swagger/resource_description_collection.rb +30 -0
  61. data/lib/apipie/generator/swagger/resource_description_composite.rb +56 -0
  62. data/lib/apipie/generator/swagger/schema.rb +63 -0
  63. data/lib/apipie/generator/swagger/swagger.rb +2 -0
  64. data/lib/apipie/generator/swagger/type.rb +16 -0
  65. data/lib/apipie/generator/swagger/type_extractor.rb +51 -0
  66. data/lib/apipie/generator/swagger/warning.rb +74 -0
  67. data/lib/apipie/generator/swagger/warning_writer.rb +54 -0
  68. data/lib/apipie/helpers.rb +3 -3
  69. data/lib/apipie/markup.rb +9 -8
  70. data/lib/apipie/method_description/api.rb +12 -0
  71. data/lib/apipie/method_description/apis_service.rb +82 -0
  72. data/lib/apipie/method_description.rb +12 -56
  73. data/lib/apipie/param_description/deprecation.rb +24 -0
  74. data/lib/apipie/param_description.rb +57 -24
  75. data/lib/apipie/resource_description.rb +42 -14
  76. data/lib/apipie/response_description.rb +3 -3
  77. data/lib/apipie/response_description_adapter.rb +12 -10
  78. data/lib/apipie/routing.rb +1 -1
  79. data/lib/apipie/rspec/response_validation_helper.rb +3 -3
  80. data/lib/apipie/static_dispatcher.rb +10 -2
  81. data/lib/apipie/swagger_generator.rb +28 -691
  82. data/lib/apipie/validator.rb +41 -11
  83. data/lib/apipie/version.rb +1 -1
  84. data/lib/apipie-rails.rb +36 -5
  85. data/lib/generators/apipie/install/install_generator.rb +1 -1
  86. data/lib/generators/apipie/views_generator.rb +1 -1
  87. data/lib/tasks/apipie.rake +37 -32
  88. data/rel-eng/gem_release.ipynb +41 -9
  89. data/spec/controllers/api/v2/architectures_controller_spec.rb +10 -3
  90. data/spec/controllers/api/v2/empty_middle_controller_spec.rb +23 -0
  91. data/spec/controllers/api/v2/nested/resources_controller_spec.rb +18 -2
  92. data/spec/controllers/api/v2/sub/footguns_controller_spec.rb +19 -0
  93. data/spec/controllers/included_param_group_controller_spec.rb +13 -0
  94. data/spec/{lib/swagger/response_validation_spec.rb → controllers/pets_controller_spec.rb} +26 -32
  95. data/spec/controllers/users_controller_spec.rb +47 -6
  96. data/spec/dummy/Rakefile +1 -1
  97. data/spec/dummy/app/controllers/api/v2/architectures_controller.rb +2 -1
  98. data/spec/dummy/app/controllers/api/v2/base_controller.rb +6 -0
  99. data/spec/dummy/app/controllers/api/v2/empty_middle_controller.rb +14 -0
  100. data/spec/dummy/app/controllers/api/v2/nested/resources_controller.rb +2 -2
  101. data/spec/dummy/app/controllers/api/v2/sub/footguns_controller.rb +30 -0
  102. data/spec/dummy/app/controllers/concerns_controller.rb +1 -1
  103. data/spec/dummy/app/controllers/{concerns/extending_concern.rb → extending_concern.rb} +0 -2
  104. data/spec/dummy/app/controllers/included_param_group_controller.rb +19 -0
  105. data/spec/dummy/app/controllers/overridden_concerns_controller.rb +2 -2
  106. data/spec/dummy/app/controllers/pets_controller.rb +5 -5
  107. data/spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb +2 -2
  108. data/spec/dummy/app/controllers/{concerns/sample_controller.rb → sample_controller.rb} +0 -2
  109. data/spec/dummy/app/controllers/twitter_example_controller.rb +2 -2
  110. data/spec/dummy/app/controllers/users_controller.rb +17 -5
  111. data/spec/dummy/app/helpers/random_param_group.rb +8 -0
  112. data/spec/dummy/components/test_engine/test_engine.gemspec +1 -1
  113. data/spec/dummy/config/application.rb +2 -5
  114. data/spec/dummy/config/boot.rb +2 -2
  115. data/spec/dummy/config/environment.rb +1 -1
  116. data/spec/dummy/config/environments/development.rb +0 -3
  117. data/spec/dummy/config/environments/production.rb +0 -3
  118. data/spec/dummy/config/environments/test.rb +0 -5
  119. data/spec/dummy/config/initializers/apipie.rb +2 -2
  120. data/spec/dummy/config/routes.rb +8 -0
  121. data/spec/dummy/config.ru +1 -1
  122. data/spec/dummy/script/rails +2 -2
  123. data/spec/{controllers → lib/apipie}/apipies_controller_spec.rb +95 -23
  124. data/spec/lib/apipie/application_spec.rb +62 -0
  125. data/spec/lib/apipie/configuration_spec.rb +38 -0
  126. data/spec/lib/apipie/extractor/collector_spec.rb +57 -0
  127. data/spec/lib/apipie/extractor/recorder_spec.rb +77 -0
  128. data/spec/lib/{extractor → apipie/extractor}/writer_spec.rb +8 -6
  129. data/spec/lib/{extractor → apipie}/extractor_spec.rb +1 -1
  130. data/spec/lib/{file_handler_spec.rb → apipie/file_handler_spec.rb} +7 -0
  131. data/spec/lib/apipie/generator/swagger/config_spec.rb +19 -0
  132. data/spec/lib/apipie/generator/swagger/context_spec.rb +56 -0
  133. data/spec/lib/apipie/generator/swagger/method_description/api_schema_service_spec.rb +119 -0
  134. data/spec/lib/apipie/generator/swagger/method_description/response_schema_service_spec.rb +105 -0
  135. data/spec/lib/apipie/generator/swagger/operation_id_spec.rb +63 -0
  136. data/spec/lib/apipie/generator/swagger/param_description/builder_spec.rb +215 -0
  137. data/spec/lib/apipie/generator/swagger/param_description/composite_spec.rb +95 -0
  138. data/spec/lib/apipie/generator/swagger/param_description/description_spec.rb +79 -0
  139. data/spec/lib/apipie/generator/swagger/param_description/in_spec.rb +86 -0
  140. data/spec/lib/apipie/generator/swagger/param_description/name_spec.rb +81 -0
  141. data/spec/lib/apipie/generator/swagger/param_description/type_spec.rb +183 -0
  142. data/spec/lib/apipie/generator/swagger/param_description_spec.rb +28 -0
  143. data/spec/lib/apipie/generator/swagger/path_decorator_spec.rb +57 -0
  144. data/spec/lib/apipie/generator/swagger/referenced_definitions_spec.rb +35 -0
  145. data/spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb +37 -0
  146. data/spec/lib/apipie/generator/swagger/resource_descriptions_collection_spec.rb +57 -0
  147. data/spec/lib/apipie/generator/swagger/schema_spec.rb +89 -0
  148. data/spec/lib/apipie/generator/swagger/type_extractor_spec.rb +38 -0
  149. data/spec/lib/apipie/generator/swagger/warning_spec.rb +51 -0
  150. data/spec/lib/apipie/generator/swagger/warning_writer_spec.rb +71 -0
  151. data/spec/lib/apipie/method_description/apis_service_spec.rb +60 -0
  152. data/spec/lib/apipie/method_description_spec.rb +133 -0
  153. data/spec/lib/apipie/no_documented_method_spec.rb +17 -0
  154. data/spec/lib/apipie/param_description/deprecation_spec.rb +31 -0
  155. data/spec/lib/{param_description_spec.rb → apipie/param_description_spec.rb} +332 -6
  156. data/spec/lib/{param_group_spec.rb → apipie/param_group_spec.rb} +6 -5
  157. data/spec/lib/apipie/resource_description_spec.rb +91 -0
  158. data/spec/lib/apipie/response_does_not_match_swagger_schema_spec.rb +35 -0
  159. data/spec/lib/apipie/swagger_generator_spec.rb +94 -0
  160. data/spec/lib/{validator_spec.rb → apipie/validator_spec.rb} +48 -12
  161. data/spec/lib/rake_spec.rb +3 -5
  162. data/spec/lib/swagger/openapi_2_0_schema.json +8 -1
  163. data/spec/lib/swagger/rake_swagger_spec.rb +30 -10
  164. data/spec/lib/swagger/swagger_dsl_spec.rb +18 -12
  165. data/spec/lib/validators/array_validator_spec.rb +1 -1
  166. data/spec/spec_helper.rb +10 -32
  167. data/spec/support/custom_bool_validator.rb +17 -0
  168. data/spec/{controllers → test_engine}/memes_controller_spec.rb +1 -1
  169. metadata +173 -125
  170. data/.travis.yml +0 -41
  171. data/Gemfile +0 -1
  172. data/Gemfile.rails41 +0 -7
  173. data/Gemfile.rails42 +0 -14
  174. data/Gemfile.rails50 +0 -9
  175. data/Gemfile.rails51 +0 -9
  176. data/Gemfile.rails60 +0 -10
  177. data/Gemfile.rails61 +0 -10
  178. data/spec/lib/application_spec.rb +0 -49
  179. data/spec/lib/method_description_spec.rb +0 -98
  180. data/spec/lib/resource_description_spec.rb +0 -48
  181. /data/spec/lib/{extractor → apipie/extractor/recorder}/middleware_spec.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 444b1aeccaa322d75d64131d2539ae5ecb9ceb3ea984e02c9cfd17a2c80d1190
4
- data.tar.gz: ddbcdfaee3494a2f35f343a361c9e07b72541b5a75e5e537c0776f8b6c9669e9
3
+ metadata.gz: 51731d3325c2241c36c5cf0e19062525d982c2b98fa0d5e0b76a5ba8625ddacd
4
+ data.tar.gz: 45db678d7324e76064a8d8a632ac5e72048d85ba7d32329168202bd48723219b
5
5
  SHA512:
6
- metadata.gz: 18f5f97fc24bab7aa9c554cd3be305e9bf5eb5266466a79c4484fb0c7f6e4b80912d5ddb224a8ed1dd8d8002c376cd7e30a359ab4f0855d60d404352dc74acb0
7
- data.tar.gz: 1c66c6990ab997d21e727900a4a36648b76aa08357491007821c4a5f1b46b25f8e48fbb9cdeccfd26f20b1ea268c32c6698f73b040226036b0f5f72fc9447060
6
+ metadata.gz: 1dc8a4c009d6dc3daee4ac98d2509d832edbf2dc8d9ec08a9f9205d9ef7614c0480ed60132f33116c6a09dd9a0ec3b056c60fc52e3e6a61b6cf67eb913985619
7
+ data.tar.gz: 4621285ca2c82670ec63c0b5a240b0d6024d37e445c724a243782e492c5c6be65091187ee07ef874ff7d0320d68109577277d885b8ea4a28e2aed8c2a94490cf
@@ -0,0 +1,31 @@
1
+ name: build
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-20.04
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ rails: ["7.1", "7.0", "6.1", "6.0"]
12
+ ruby: ["3.2.2", "3.1.4", "3.0.6", "2.7.8"]
13
+ include:
14
+ - rails: "5.2"
15
+ ruby: "2.7.8"
16
+ - rails: "5.1"
17
+ ruby: "2.6.10"
18
+ - rails: "5.0"
19
+ ruby: "2.6.10"
20
+
21
+ env:
22
+ RUBY_VERSION: ${{ matrix.ruby }}
23
+ RAILS_VERSION: ${{ matrix.rails }}
24
+
25
+ steps:
26
+ - uses: actions/checkout@v2
27
+ - uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby }}
30
+ bundler-cache: true
31
+ - run: bundle exec rspec
@@ -0,0 +1,28 @@
1
+ name: "RuboCop Challenge"
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '30 23 * * 1,3,5' # Monday, Wednesday, Friday at 23:30 UTC
6
+
7
+ jobs:
8
+ create-pr:
9
+ name: Create Pull Request
10
+ runs-on: ubuntu-latest
11
+ env:
12
+ BUNDLE_GEMFILE: gemfiles/Gemfile.rails50
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby 3.2
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: 3.2
19
+ - name: Install bundler
20
+ run: gem install bundler
21
+ - name: Install gems
22
+ run: bundle install --jobs 4 --retry 3
23
+ - name: Set git configuration
24
+ run: git config remote.origin.url "git@github.com:Apipie/apipie-rails.git"
25
+ - name: Create RuboCop challenge pull request
26
+ env:
27
+ GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28
+ run: bundle exec rubocop_challenger go --exclude-limit=180 --base-branch=master --email=rubocop@payrollhero.com --name="Rubocop Challenger" --mode=random
@@ -0,0 +1,18 @@
1
+ name: RuboCop
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v3
10
+
11
+ - name: Set up Ruby 3.2
12
+ uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: 3.2
15
+ bundler-cache: true
16
+
17
+ - name: Run rubocop
18
+ run: bundle exec rubocop --config .rubocop.yml
data/.gitignore CHANGED
@@ -1,6 +1,7 @@
1
1
  .bundle/
2
2
  log/*.log
3
3
  pkg/
4
+ coverage
4
5
  spec/dummy/db/*.sqlite3
5
6
  spec/dummy/log/*.log
6
7
  spec/dummy/tmp/
data/.rubocop.yml ADDED
@@ -0,0 +1,128 @@
1
+ require:
2
+ - rubocop-rails
3
+ - rubocop-rspec
4
+ - rubocop-performance
5
+
6
+ inherit_from: .rubocop_todo.yml
7
+
8
+ Rails:
9
+ Enabled: true
10
+
11
+ AllCops:
12
+ NewCops: enable
13
+ TargetRubyVersion: 2.6
14
+
15
+ Layout/LineLength:
16
+ Max: 140
17
+ Exclude:
18
+ - app/controllers/apipie/apipies_controller.rb
19
+ - lib/apipie/extractor/writer.rb
20
+ - lib/apipie/param_description.rb
21
+ - lib/apipie/response_description_adapter.rb
22
+ - lib/apipie/swagger_generator.rb
23
+ - lib/apipie/errors.rb
24
+ - lib/apipie/generator/swagger/warning.rb
25
+ - lib/apipie/rspec/response_validation_helper.rb
26
+ - spec/controllers/pets_controller_spec.rb
27
+ - spec/controllers/users_controller_spec.rb
28
+ - spec/dummy/app/controllers/twitter_example_controller.rb
29
+ - spec/dummy/config/initializers/secret_token.rb
30
+ - spec/lib/application_spec.rb
31
+ - spec/lib/param_description_spec.rb
32
+ - spec/lib/param_description_deprecation_spec.rb
33
+ - spec/lib/swagger/response_validation_spec.rb
34
+ - spec/spec_helper.rb
35
+
36
+ Metrics/ClassLength:
37
+ Max: 180
38
+ Exclude:
39
+ - lib/apipie/extractor/writer.rb
40
+ - lib/apipie/application.rb
41
+ - lib/apipie/param_description.rb
42
+ - lib/apipie/method_description.rb
43
+ - lib/apipie/swagger_generator.rb
44
+ - spec/dummy/app/controllers/pets_controller.rb
45
+ - spec/dummy/app/controllers/twitter_example_controller.rb
46
+ - spec/dummy/app/controllers/users_controller.rb
47
+
48
+ Metrics/BlockLength:
49
+ Max: 26 # default
50
+ Exclude:
51
+ - app/controllers/apipie/apipies_controller.rb
52
+ - lib/apipie/generator/swagger/param_description/composite.rb
53
+ - lib/apipie/generator/swagger/param_description/path_params_composite.rb
54
+ - lib/tasks/apipie.rake
55
+ - lib/apipie/swagger_generator.rb
56
+
57
+ Naming/PredicateName:
58
+ AllowedMethods:
59
+ - have_field?
60
+
61
+ Style/IfUnlessModifier:
62
+ Enabled: false
63
+
64
+ Style/NumericPredicate:
65
+ Enabled: false
66
+
67
+ Style/HashSyntax:
68
+ EnforcedStyle: no_mixed_keys
69
+ EnforcedShorthandSyntax: never # consistent
70
+
71
+ Metrics/ParameterLists:
72
+ Exclude:
73
+ - "lib/apipie/generator/swagger/context.rb"
74
+
75
+ Style/Documentation:
76
+ Exclude:
77
+ - "app/controllers/apipie/apipies_controller.rb"
78
+ - "app/helpers/apipie_helper.rb"
79
+ - "lib/apipie/apipie_module.rb"
80
+ - "lib/apipie/application.rb"
81
+ - "lib/apipie/configuration.rb"
82
+ - "lib/apipie/core_ext/route.rb"
83
+ - "lib/apipie/dsl_definition.rb"
84
+ - "lib/apipie/error_description.rb"
85
+ - "lib/apipie/errors.rb"
86
+ - "lib/apipie/extractor.rb"
87
+ - "lib/apipie/extractor/collector.rb"
88
+ - "lib/apipie/extractor/recorder.rb"
89
+ - "lib/apipie/extractor/writer.rb"
90
+ - "lib/apipie/generator/generator.rb"
91
+ - "lib/apipie/generator/swagger/**/*"
92
+ - "lib/apipie/helpers.rb"
93
+ - "lib/apipie/markup.rb"
94
+ - "lib/apipie/method_description.rb"
95
+ - "lib/apipie/method_description/api.rb"
96
+ - "lib/apipie/middleware/checksum_in_headers.rb"
97
+ - "lib/apipie/railtie.rb"
98
+ - "lib/apipie/response_description.rb"
99
+ - "lib/apipie/response_description_adapter.rb"
100
+ - "lib/apipie/routes_formatter.rb"
101
+ - "lib/apipie/routing.rb"
102
+ - "lib/apipie/rspec/response_validation_helper.rb"
103
+ - "lib/apipie/swagger_generator.rb"
104
+ - "lib/apipie/see_description.rb"
105
+ - "lib/apipie/static_dispatcher.rb"
106
+ - "lib/apipie/tag_list_description.rb"
107
+ - "lib/apipie/validator.rb"
108
+ - "lib/generators/apipie/install/install_generator.rb"
109
+ - "lib/generators/apipie/views_generator.rb"
110
+ - spec/support/custom_bool_validator.rb
111
+ - spec/lib/validators/array_validator_spec.rb
112
+ - spec/dummy/**/*.rb
113
+
114
+ Style/FrozenStringLiteralComment:
115
+ Enabled: false
116
+
117
+ Style/InverseMethods:
118
+ Enabled: false
119
+
120
+ Naming/BlockForwarding:
121
+ EnforcedStyle: explicit
122
+ BlockForwardingName: block
123
+
124
+ Lint/MissingSuper:
125
+ Exclude:
126
+ - "lib/apipie/errors.rb"
127
+ - "lib/apipie/response_description_adapter.rb"
128
+ - "lib/apipie/validator.rb"