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
@@ -0,0 +1,3 @@
1
+ {
2
+ "rubyLsp.bundleGemfile": "gemfiles/Gemfile.tools"
3
+ }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,166 @@
1
1
  Changelog
2
2
  ===========
3
+
4
+ ## [v1.3.0](https://github.com/Apipie/apipie-rails/tree/v1.3.0) (2023-12-19)
5
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.2.3...v1.3.0)
6
+ * rubocop fixes ([#897](https://github.com/Apipie/apipie-rails/pull/897)) (Mathieu Jobin)
7
+ * Fix usage of deprecated Rack::File in Rack 3.0 ([#896](https://github.com/Apipie/apipie-rails/pull/896)) (James Dean Shepherd)
8
+ * add rails 7.1 to the build matrix ([#898](https://github.com/Apipie/apipie-rails/pull/898)) (Mathieu Jobin)
9
+ * super small typo fix ([#900](https://github.com/Apipie/apipie-rails/pull/900)) (Eric Pugh)
10
+ * support for property example ([#901](https://github.com/Apipie/apipie-rails/pull/901)) (Chien-Wei Huang (Michael))
11
+ * Use array items type from validator ([#904](https://github.com/Apipie/apipie-rails/pull/)) (Panos Dalitsouris)
12
+
13
+ ## [v1.2.3](https://github.com/Apipie/apipie-rails/tree/v1.2.3) (2023-10-11)
14
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.2.2...v1.2.3)
15
+ * Fix param: Consider default_value: nil as valid config ([#894](https://github.com/Apipie/apipie-rails/pull/894)) (davidwessman)
16
+
17
+ ## [v1.2.2](https://github.com/Apipie/apipie-rails/tree/v1.2.2) (2023-07-18)
18
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.2.1...v1.2.2)
19
+ * Fixed Swagger warnings for properties ([#892](https://github.com/Apipie/apipie-rails/pull/892)) (shev-vadim-net)
20
+ * Improved support for multipart/form-data example recording ([#891](https://github.com/Apipie/apipie-rails/pull/891)) (Butiri Cristian & hossenlopp)
21
+ * rubocop (1.54.2) fixes required with latest version ([#893](https://github.com/Apipie/apipie-rails/pull/893)) (Mathieu Jobin)
22
+
23
+ ## [v1.2.1](https://github.com/Apipie/apipie-rails/tree/v1.2.1) (2023-06-09)
24
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.2.0...v1.2.1)
25
+ * rspec: Fixes deprecated matcher ([#882](https://github.com/Apipie/apipie-rails/pull/882)) (David Wessman)
26
+ * Fix streaming bug ([#677](https://github.com/Apipie/apipie-rails/pull/677)) (Hunter Braun)
27
+ * Update README URLs based on HTTP redirects ([#448](https://github.com/Apipie/apipie-rails/pull/448)) (ReadmeCritic)
28
+ * Swagger: Adds option to skip default tags ([#881](https://github.com/Apipie/apipie-rails/pull/881)) (David Wessman)
29
+ * Parameter validation: Raises error for all missing ([#886](https://github.com/Apipie/apipie-rails/pull/886)) (David Wessman)
30
+
31
+ ## [v1.2.0](https://github.com/Apipie/apipie-rails/tree/v1.2.0) (2023-06-03)
32
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.1.0...v1.2.0)
33
+ * Allow resource_name to be inherited ([#872](https://github.com/Apipie/apipie-rails/pull/872)) (Eric Hankins)
34
+ * Fix cache rendering with namespaced resources ([#874](https://github.com/Apipie/apipie-rails/pull/874)) (Eric Hankins)
35
+ * Fix deprecated content_type on Rails >= 6 ([#879](https://github.com/Apipie/apipie-rails/pull/879)) (Eric Hankins)
36
+ * Fix typo in Collector ([#877](https://github.com/Apipie/apipie-rails/pull/877)) (Eric Hankins)
37
+ * Fix error climbing controller hierarchy ([#875](https://github.com/Apipie/apipie-rails/pull/875)) (Eric Hankins)
38
+ * Add Gemfile.tools for IDE usage ([#876](https://github.com/Apipie/apipie-rails/pull/876)) (Eric Hankins)
39
+ * Fix rubocop ([#883](https://github.com/Apipie/apipie-rails/pull/883)) (Mathieu Jobin)
40
+ * Performance/InefficientHashSearch-20230602233137 ([#884](https://github.com/Apipie/apipie-rails/pull/884)) (RuboCop challenger)
41
+ * Redo Github action script to not need individual gemfiles ([#885](https://github.com/Apipie/apipie-rails/pull/885)) (Mathieu Jobin)
42
+
43
+ ## [v1.1.0](https://github.com/Apipie/apipie-rails/tree/v1.1.0) (2023-05-16)
44
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.0.0...v1.1.0)
45
+ * Improve performance of route detection [#870](https://github.com/Apipie/apipie-rails/pull/870) (Eric Hankins)
46
+ * Fix startup crash due to typo [#869](https://github.com/Apipie/apipie-rails/pull/869) (Eric Hankins)
47
+ * Skip parse body for pdf responses [#871](https://github.com/Apipie/apipie-rails/pull/871) (Juan Gomez)
48
+ * add missing 'returns' translation [#868](https://github.com/Apipie/apipie-rails/pull/868) (Anthony Robertson)
49
+
50
+ ## [v1.0.0](https://github.com/Apipie/apipie-rails/tree/v1.0.0) (2023-04-26)
51
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.9.4...v1.0.0)
52
+ * Refactor Swagger generator [#816](https://github.com/Apipie/apipie-rails/pull/816) (Panos Dalitsouris)
53
+ * Take into account validator options for `required` ParamDescription [#863](https://github.com/Apipie/apipie-rails/pull/863) (Panos Dalitsouris)
54
+ * Replace `get_resource_name` with `get_resource_id` [#864](https://github.com/Apipie/apipie-rails/pull/864) (Panos Dalitsouris)
55
+ * Namespace swagger configuration [#862](https://github.com/Apipie/apipie-rails/pull/862) (Panos Dalitsouris)
56
+ * Allow boolean array `[true, false]` to be a valid argument for BooleanValidator [#848](https://github.com/Apipie/apipie-rails/pull/848) (Panos Dalitsouris)
57
+ * Fix swagger warnings [#865](https://github.com/Apipie/apipie-rails/pull/865) (Panos Dalitsouris)
58
+ * Update README - Adds the new Integer option you added recently to the documentation here. [#866](https://github.com/Apipie/apipie-rails/pull/866) (Jeremy Lupoli)
59
+ * [Rubocop] More Rubocop Auto corrections [#859](https://github.com/Apipie/apipie-rails/pull/859)
60
+
61
+ ## [v0.9.4](https://github.com/Apipie/apipie-rails/tree/v0.9.4) (2023-04-11)
62
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.9.3...v0.9.4)
63
+ * [Fix] Separate nested resource name [#855](https://github.com/Apipie/apipie-rails/pull/855), [#455](https://github.com/Apipie/apipie-rails/issues/455) (Panos Dalitsouris)
64
+ * [Rubocop] Disable a few Rubocop Rules, run Rubocop with ruby 3.2 [#851](https://github.com/Apipie/apipie-rails/pull/851), [#853](https://github.com/Apipie/apipie-rails/pull/853), [#840](https://github.com/Apipie/apipie-rails/pull/840), [#841](https://github.com/Apipie/apipie-rails/pull/841) (Panos Dalitsouris)
65
+ * [Rubocop] More Rubocop Auto corrections [#858](https://github.com/Apipie/apipie-rails/pull/858), [#849](https://github.com/Apipie/apipie-rails/pull/849), [#850](https://github.com/Apipie/apipie-rails/pull/850), [#844](https://github.com/Apipie/apipie-rails/pull/844), [#846](https://github.com/Apipie/apipie-rails/pull/846), [#834](https://github.com/Apipie/apipie-rails/pull/834), [#847](https://github.com/Apipie/apipie-rails/pull/847) (Rubocop Challenger)
66
+
67
+ ## [v0.9.3](https://github.com/Apipie/apipie-rails/tree/v0.9.3) (2023-03-08)
68
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.9.2...v0.9.3)
69
+ * [Feature] Allow Apipie::ParamDescription to be marked as deprecated [#819](https://github.com/Apipie/apipie-rails/pull/819), [#811](https://github.com/Apipie/apipie-rails/pull/811) (Panos Dalitsouris)
70
+ * [Fix] Make html markup thread safe ([#822](https://github.com/Apipie/apipie-rails/issues/822)) (Adam Růžička)
71
+ * [Feature] Allow action matcher strategy to be configured [#821](https://github.com/Apipie/apipie-rails/pull/821) (Panos Dalitsouris)
72
+ * [CI] Run Rubocop when opening PR [#826](https://github.com/Apipie/apipie-rails/pull/826) (Panos Dalitsouris)
73
+ * [CI] Green rubocop - Fix after rubocop challenger upgrade [#829](https://github.com/Apipie/apipie-rails/pull/829) (Mathieu Jobin)
74
+ * [Rubocop] More Rubocop Auto corrections [#818](https://github.com/Apipie/apipie-rails/pull/818), [#825](https://github.com/Apipie/apipie-rails/pull/825), [#827](https://github.com/Apipie/apipie-rails/pull/827), [#837](https://github.com/Apipie/apipie-rails/pull/837), [#839](https://github.com/Apipie/apipie-rails/pull/839) (Rubocop Challenger)
75
+
76
+ ## [v0.9.2](https://github.com/Apipie/apipie-rails/tree/v0.9.2) (2023-02-07)
77
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.9.1...v0.9.2)
78
+ * [Rubocop] More Rubocop Auto corrections [#795](https://github.com/Apipie/apipie-rails/pull/795), [#781](https://github.com/Apipie/apipie-rails/pull/781), [#791](https://github.com/Apipie/apipie-rails/pull/791), [#788](https://github.com/Apipie/apipie-rails/pull/788) (Rubocop Challenger)
79
+ * [Fix] Can't include translation in full description ([#446](https://github.com/Apipie/apipie-rails/issues/446)) [#808](https://github.com/Apipie/apipie-rails/pull/808) (Peter Nagy)
80
+ * [Refactor] Move swagger param description creation [#810](https://github.com/Apipie/apipie-rails/pull/810) (Panos Dalitsouris)
81
+ * [Rubocop] Redo rubocop TODOs, set HashSyntax config to most used style [#814](https://github.com/Apipie/apipie-rails/pull/814) (Mathieu Jobin)
82
+ * [Fix] Swagger missing i18n [#815](https://github.com/Apipie/apipie-rails/pull/815) (@jirubio)
83
+
84
+ ## [v0.9.1](https://github.com/Apipie/apipie-rails/tree/v0.9.1) (2023-01-16)
85
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.9.0...v0.9.1)
86
+ * [Refactor] Create test cache files under a not version controlled directory [#809](https://github.com/Apipie/apipie-rails/pull/809) (Panos Dalitsouris)
87
+ * [Ruby] Support for Ruby 3.2 [#807](https://github.com/Apipie/apipie-rails/pull/807) (Mathieu Jobin)
88
+ * [Fix] Reverted conditional assignment operators that caused #559 [#806](https://github.com/Apipie/apipie-rails/pull/806) (Nick L. Deltik)
89
+ * [Rubocop] Autocorrect Style/SymbolProc [#793](https://github.com/Apipie/apipie-rails/pull/793) (Rubocop Challenger)
90
+
91
+ ## [v0.9.0](https://github.com/Apipie/apipie-rails/tree/v0.9.0) (2023-01-03)
92
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.8.2...v0.9.0)
93
+ * [Refactor] Move Swagger types and warnings under `/generator` namespace [#803](https://github.com/Apipie/apipie-rails/pull/803) (Panos Dalitsouris)
94
+ * [Refactor] Creates `Apipie::MethodDescription::ApisService` [#805](https://github.com/Apipie/apipie-rails/pull/805) (Panos Dalitsouris)
95
+ * [Refactor] Change output folder to `spec/dummy/tmp/` [#804](https://github.com/Apipie/apipie-rails/pull/804) (Panos Dalitsouris)
96
+ * Fix tiny typo in docs [#798](https://github.com/Apipie/apipie-rails/pull/798) (Erik-B. Ernst)
97
+ * Fix Generated docs.json output [#787](https://github.com/Apipie/apipie-rails/pull/787) (Jeremy Liberman)
98
+ * Rubocop Fixes [#775](https://github.com/Apipie/apipie-rails/pull/775), [#778](https://github.com/Apipie/apipie-rails/pull/778), [#780](https://github.com/Apipie/apipie-rails/pull/780), [#790](https://github.com/Apipie/apipie-rails/pull/790), [#783](https://github.com/Apipie/apipie-rails/pull/783), [#785](https://github.com/Apipie/apipie-rails/pull/785) (RuboCop)
99
+ * Remove/clean up dev dependencies and unused rake tasks [#777](https://github.com/Apipie/apipie-rails/pull/777) (Mathieu Jobin)
100
+ - remove unused rake task
101
+ * Setup Rubocop Challenger [#776](https://github.com/Apipie/apipie-rails/pull/776) (Mathieu Jobin)
102
+
103
+ ## [v0.8.2](https://github.com/Apipie/apipie-rails/tree/v0.8.2) (2022-09-03)
104
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.8.1...v0.8.2)
105
+ * Allow custom validators to opt out of allow_blank behavior [#762](https://github.com/Apipie/apipie-rails/pull/762). (Stephen Hanson)
106
+ * Enforce test coverage, set current 89% as minimum [#764](https://github.com/Apipie/apipie-rails/pull/764). (Mathieu Jobin)
107
+ * Add contributing instructions to readme [#763](https://github.com/Apipie/apipie-rails/pull/763). (Stephen Hanson)
108
+ * Fix readme formatting [#765](https://github.com/Apipie/apipie-rails/pull/765). (Stephen Hanson)
109
+ * Adds expected_type to IntegerValidator example [#769](https://github.com/Apipie/apipie-rails/pull/769). (Jeremy Liberman)
110
+ * Update readme with error handling example [#768](https://github.com/Apipie/apipie-rails/pull/768). (Jesse Eisenberg)
111
+ * Fix scope incorrectly set to nil when a param_group is used inside an array_of_hash and the param_group is in a different module / controller. [#693](https://github.com/Apipie/apipie-rails/pull/693) [#774](https://github.com/Apipie/apipie-rails/pull/774). (Omkar Joshi / Oliver Iyer)
112
+
113
+ ## [v0.8.1](https://github.com/Apipie/apipie-rails/tree/v0.8.1) (2022-05-26)
114
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.8.0...v0.8.1)
115
+ * Remove warning that came back as of [#752](https://github.com/Apipie/apipie-rails/pull/752). [#761](https://github.com/Apipie/apipie-rails/pull/761) (Jorge Santos / Mathieu Jobin)
116
+
117
+ ## [v0.8.0](https://github.com/Apipie/apipie-rails/tree/v0.8.0) (2022-05-24)
118
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.7.2...v0.8.0)
119
+ * Add support for scheme definition in Swagger docs. [#710](https://github.com/Apipie/apipie-rails/pull/710) (Dan Leyden)
120
+ * Add support for Rails 7 [#760](https://github.com/Apipie/apipie-rails/pull/760) (Mathieu Jobin)
121
+ * Clean up code base, removing all trace of unsupported Rails 4.x [#752](https://github.com/Apipie/apipie-rails/pull/752) (Mathieu Jobin)
122
+ * fix: Controller resource set before version [#744](https://github.com/Apipie/apipie-rails/pull/744) (LuukvH)
123
+ * fix: enable swagger generator to add referenced schema for an array of hashes param [#689](https://github.com/Apipie/apipie-rails/pull/689) (Francis San Juan)
124
+
125
+ ## [v0.7.2](https://github.com/Apipie/apipie-rails/tree/v0.7.2) (2022-04-19)
126
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.7.1...v0.7.2)
127
+ * Added Korean locale. [#480](https://github.com/Apipie/apipie-rails/pull/480) (Jaehyun Shin ) [#757](https://github.com/Apipie/apipie-rails/pull/757) (Jorge Santos)
128
+ * `Security` Upgraded Bootstrap from 2.0.2 to 2.3.2, JQuery from 1.11.3 to 1.12.4 [#708](https://github.com/Apipie/apipie-rails/pull/708) (Nicolas Waissbluth)
129
+ * Fix ruby2 keyword argument warning [#756](https://github.com/Apipie/apipie-rails/pull/756) (Jorge Santos)
130
+
131
+ ## [v0.7.1](https://github.com/Apipie/apipie-rails/tree/v0.7.1) (2022-04-06)
132
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.7.0...v0.7.1)
133
+ * Skip extra parameters while validating the keys. [#690](https://github.com/Apipie/apipie-rails/pull/690) (Omkar Joshi)
134
+ * Support defining security mechanisms for Swagger [#711](https://github.com/Apipie/apipie-rails/pull/711) (Dan Leyden)
135
+ * Update boolean handling of false [#749](https://github.com/Apipie/apipie-rails/pull/749) (Colin Bruce)
136
+
137
+ Note: Up until and including v0.6.x, apipie-rails was silently ignoring allow_blank == false on String validation.
138
+ when allow_blank is not specified, it default to false. to allow blank strings, you must specify it as a parameter.
139
+
140
+ Alternatively, if you want to revert to the previous behavior, you can set this configuration option:
141
+ `Apipie.configuration.ignore_allow_blank_false = true`.
142
+
143
+ ## [v0.7.0](https://github.com/Apipie/apipie-rails/tree/v0.7.0) (2022-03-30)
144
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.6.0...v0.7.0)
145
+ * ArgumentError (invalid byte sequence in UTF-8) [#746](https://github.com/Apipie/apipie-rails/pull/746) (David Milanese)
146
+ * Fix allow_blank does not work [#733](https://github.com/Apipie/apipie-rails/pull/733) (CHEN Song)
147
+ * Fix schema generation for param descriptions using the array validator in option [#732](https://github.com/Apipie/apipie-rails/pull/732) (Frank Hock)
148
+ * Remove support for Rails 4 and Ruby <= 2.5 [#747](https://github.com/Apipie/apipie-rails/pull/747) (Mathieu Jobin)
149
+
150
+ ## [v0.6.0](https://github.com/Apipie/apipie-rails/tree/v0.6.0) (2022-03-29)
151
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.20...v0.6.0)
152
+ * Ruby 3.0 fixes [#716](https://github.com/Apipie/apipie-rails/pull/716) (hank-spokeo)
153
+ * only depends on actionpack and activesupport [#741](https://github.com/Apipie/apipie-rails/pull/741) (Mathieu Jobin)
154
+ * language fix, fallback to default locale [#726](https://github.com/Apipie/apipie-rails/pull/726) (Alex Coomans)
155
+
156
+ ## [v0.5.20](https://github.com/Apipie/apipie-rails/tree/v0.5.20) (2022-03-16)
157
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.19...v0.5.20)
158
+ * Update rel-eng (Oleh Fedorenko)
159
+ * Deprecate travis, run tests on github actions [#740](https://github.com/Apipie/apipie-rails/pull/740) (Mathieu Jobin)
160
+ * Update validator.rb [#739](https://github.com/Apipie/apipie-rails/pull/739) (Dmytro Budnyk)
161
+ * Fix wrong number of arguments for recorder#process [#725](https://github.com/Apipie/apipie-rails/pull/725) (rob mathews)
162
+ * Change "an" to "a" [#723](https://github.com/Apipie/apipie-rails/pull/723) (Naokimi)
163
+
3
164
  ## [v0.5.19](https://github.com/Apipie/apipie-rails/tree/v0.5.19) (2021-07-25)
4
165
  [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.18...v0.5.19)
5
166
  * Add rel-eng notebook (Oleh Fedorenko)
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec path: '.'
6
+
7
+ # use ENV vars, with default value as fallback for local setup
8
+ ruby(ENV['RUBY_VERSION'] || '3.2.2')
9
+ gem 'actionpack', "~> #{ENV['RAILS_VERSION'] || '7.0'}.0"
10
+ gem 'activesupport', "~> #{ENV['RAILS_VERSION'] || '7.0'}.0"
11
+
12
+ gem 'mime-types' # , '~> 3.0'
13
+ gem 'rails-controller-testing'
14
+ gem 'rspec-rails' # , '~> 5.0'
15
+
16
+ # net-smtp not included by default in Ruby 3.1
17
+ # Will be fixed by https://github.com/mikel/mail/pull/1439
18
+ gem 'net-smtp', require: false if Gem.ruby_version >= Gem::Version.new('3.1.0')
19
+
20
+ gem 'test_engine', path: './spec/dummy/components/test_engine', group: :test
data/README.rst CHANGED
@@ -2,8 +2,8 @@
2
2
  API Documentation Tool
3
3
  ========================
4
4
 
5
- .. image:: https://travis-ci.org/Apipie/apipie-rails.svg?branch=master
6
- :target: https://travis-ci.org/Apipie/apipie-rails
5
+ .. image:: https://github.com/Apipie/apipie-rails/actions/workflows/build.yml/badge.svg
6
+ :target: https://github.com/Apipie/apipie-rails/actions/workflows/build.yml
7
7
  .. image:: https://codeclimate.com/github/Apipie/apipie-rails.svg
8
8
  :target: https://codeclimate.com/github/Apipie/apipie-rails
9
9
  .. image:: https://badges.gitter.im/Apipie/apipie-rails.svg
@@ -56,7 +56,7 @@ Run your application and see the result at
56
56
  use ``http://localhost:3000/apipie.json``.
57
57
 
58
58
  For a more comprehensive getting started guide, see
59
- `this demo <https://github.com/iNecas/apipie-demo>`_, which includes
59
+ `this demo <https://github.com/Apipie/apipie-demo>`_, which includes
60
60
  features such as generating documentation from tests, recording examples etc.
61
61
 
62
62
  Screenshots
@@ -78,7 +78,7 @@ See `Contributors page <https://github.com/Apipie/apipie-rails/graphs/contribut
78
78
  License
79
79
  -------
80
80
 
81
- Apipie-rails is released under the `MIT License <http://opensource.org/licenses/MIT>`_
81
+ Apipie-rails is released under the `MIT License <https://opensource.org/licenses/MIT>`_
82
82
 
83
83
  ===============
84
84
  Documentation
@@ -108,6 +108,10 @@ resource_id
108
108
  name
109
109
  Human readable name of resource. By default ``class.name.humanize`` is used.
110
110
 
111
+ - Can be specified as a proc, which will receive the controller class as an argument.
112
+ - Can be a symbol, which will be sent to the controller class to get the name.
113
+ - Can be a string, which will be used as is.
114
+
111
115
  short (also short_description)
112
116
  Short description of the resource (it's shown on both the list of resources, and resource details)
113
117
 
@@ -150,7 +154,7 @@ Example:
150
154
  resource_description do
151
155
  short 'Site members'
152
156
  formats ['json']
153
- param :id, Fixnum, :desc => "User ID", :required => false
157
+ param :id, Integer, :desc => "User ID", :required => false
154
158
  param :resource_param, Hash, :desc => 'Param description for all methods' do
155
159
  param :ausername, String, :desc => "Username for login", :required => true
156
160
  param :apassword, String, :desc => "Password for login", :required => true
@@ -313,6 +317,9 @@ desc
313
317
  required
314
318
  Set this true/false to make it required/optional. Default is optional
315
319
 
320
+ example
321
+ Provide the example for this parameter.
322
+
316
323
  allow_nil
317
324
  Setting this to true means that ``nil`` can be passed.
318
325
 
@@ -345,8 +352,8 @@ Example:
345
352
  .. code:: ruby
346
353
 
347
354
  param :user, Hash, :desc => "User info" do
348
- param :username, String, :desc => "Username for login", :required => true
349
- param :password, String, :desc => "Password for login", :required => true
355
+ param :username, String, :desc => "Username for login", :required => true, :example => 'John'
356
+ param :password, String, :desc => "Password for login", :required => true, :example => '1234567'
350
357
  param :membership, ["standard","premium"], :desc => "User membership"
351
358
  param :admin_override, String, :desc => "Not shown in documentation", :show => false
352
359
  param :ip_address, String, :desc => "IP address", :required => true, :missing_message => lambda { I18n.t("ip_address.required") }
@@ -355,6 +362,22 @@ Example:
355
362
  #...
356
363
  end
357
364
 
365
+ deprecated
366
+ Indicates if the parameter is marked as deprecated.
367
+
368
+ Example
369
+ ~~~~~~~~
370
+
371
+ .. code:: ruby
372
+
373
+ param :pet_name, String, desc: "Name of pet", deprecated: true
374
+ param :pet_name, String, desc: "Name of pet", deprecated: 'Some deprecation info'
375
+ param :pet_name, String, desc: "Name of pet", deprecated: { in: "2.3", info: "Something", sunset: "3.0" }
376
+ def create
377
+ #...
378
+ end
379
+
380
+
358
381
  DRY with param_group
359
382
  --------------------
360
383
 
@@ -387,20 +410,20 @@ Example:
387
410
  end
388
411
  end
389
412
 
390
- api :POST, "/users", "Create an user"
413
+ api :POST, "/users", "Create a user"
391
414
  param_group :user
392
415
  def create
393
416
  # ...
394
417
  end
395
418
 
396
- api :PUT, "/users/:id", "Update an user"
419
+ api :PUT, "/users/:id", "Update a user"
397
420
  param_group :user
398
421
  def update
399
422
  # ...
400
423
  end
401
424
 
402
425
  # v2/users_controller.rb
403
- api :POST, "/users", "Create an user"
426
+ api :POST, "/users", "Create a user"
404
427
  param_group :user, V1::UsersController
405
428
  def create
406
429
  # ...
@@ -434,7 +457,7 @@ Example
434
457
  end
435
458
  end
436
459
 
437
- api :POST, "/users", "Create an user"
460
+ api :POST, "/users", "Create a user"
438
461
  param_group :user
439
462
  def create
440
463
  # ...
@@ -446,7 +469,7 @@ Example
446
469
  # ...
447
470
  end
448
471
 
449
- api :PUT, "/users/:id", "Update an user"
472
+ api :PUT, "/users/:id", "Update a user"
450
473
  param_group :user
451
474
  def update
452
475
  # ...
@@ -966,6 +989,9 @@ validate_presence
966
989
  validate_key
967
990
  Check the received params to ensure they are defined in the API. (false by default)
968
991
 
992
+ action_on_non_validated_keys
993
+ Either `:raise` or `:skip`. If `validate_key` fails, raise error or delete the non-validated key from the params and log the key (`:raise` by default)
994
+
969
995
  process_params
970
996
  Process and extract the parameter defined from the params of the request
971
997
  to the api_params variable
@@ -979,6 +1005,9 @@ reload_controllers
979
1005
  api_controllers_matcher
980
1006
  For reloading to work properly you need to specify where your API controllers are. Can be an array if multiple paths are needed
981
1007
 
1008
+ api_action_matcher
1009
+ Determines the strategy to identity the correct controller action. Needs to be a class that implements a `.call(controller)` method
1010
+
982
1011
  api_routes
983
1012
  Set if your application uses a custom API router, different from the Rails
984
1013
  default
@@ -1004,7 +1033,7 @@ layout
1004
1033
 
1005
1034
  ignored
1006
1035
  An array of controller names (strings) (might include actions as well)
1007
- to be ignored when generationg the documentation
1036
+ to be ignored when generating the documentation
1008
1037
  e.g. ``%w[Api::CommentsController Api::PostsController#post]``
1009
1038
 
1010
1039
  namespaced_resources
@@ -1021,6 +1050,10 @@ authorize
1021
1050
  show_all_examples
1022
1051
  Set this to true to set show_in_doc=1 in all recorded examples
1023
1052
 
1053
+ ignore_allow_blank_false
1054
+ `allow_blank: false` was incorrectly ignored up until version 0.6.0, this bug was fixed in 0.7.0
1055
+ if you need the old behavior, set this to true
1056
+
1024
1057
  link_extension
1025
1058
  The extension to use for API pages ('.html' by default). Link extensions
1026
1059
  in static API docs cannot be changed from '.html'.
@@ -1056,6 +1089,7 @@ Example:
1056
1089
  config.markup = Apipie::Markup::Markdown.new
1057
1090
  config.reload_controllers = Rails.env.development?
1058
1091
  config.api_controllers_matcher = File.join(Rails.root, "app", "controllers", "**","*.rb")
1092
+ config.api_action_matcher = proc { |controller| controller.params[:action] }
1059
1093
  config.api_routes = Rails.application.routes
1060
1094
  config.app_info["1.0"] = "
1061
1095
  This is where you can inform user about your application and API
@@ -1149,6 +1183,21 @@ is raised and can be rescued and processed. It contains a description
1149
1183
  of the parameter value expectations. Validations can be turned off
1150
1184
  in the configuration file.
1151
1185
 
1186
+ Here is an example of how to rescue and process a +ParamMissing+ or
1187
+ +ParamInvalid+ error from within the ApplicationController.
1188
+
1189
+ .. code:: ruby
1190
+
1191
+ class ApplicationController < ActionController::Base
1192
+
1193
+ # ParamError is superclass of ParamMissing, ParamInvalid
1194
+ rescue_from Apipie::ParamError do |e|
1195
+ render text: e.message, status: :unprocessable_entity
1196
+ end
1197
+
1198
+ # ...
1199
+ end
1200
+
1152
1201
  Parameter validation normally happens after before_actions, just before
1153
1202
  your controller method is invoked. If you prefer to control when parameter
1154
1203
  validation occurs, set the configuration parameter ``validate`` to ``:explicitly``.
@@ -1163,7 +1212,7 @@ after the ``apipie_validations`` before_action.
1163
1212
 
1164
1213
  TypeValidator
1165
1214
  -------------
1166
- Check the parameter type. Only String, Hash and Array are supported
1215
+ Check the parameter type. Only String, Integer, Hash and Array are supported
1167
1216
  for the sake of simplicity. Read more to find out how to add
1168
1217
  your own validator.
1169
1218
 
@@ -1353,7 +1402,7 @@ So we create apipie_validators.rb initializer with this content:
1353
1402
  end
1354
1403
 
1355
1404
  def self.build(param_description, argument, options, block)
1356
- if argument == Integer || argument == Fixnum
1405
+ if argument == Integer
1357
1406
  self.new(param_description, argument)
1358
1407
  end
1359
1408
  end
@@ -1361,6 +1410,10 @@ So we create apipie_validators.rb initializer with this content:
1361
1410
  def description
1362
1411
  "Must be #{@type}."
1363
1412
  end
1413
+
1414
+ def expected_type
1415
+ 'numeric'
1416
+ end
1364
1417
  end
1365
1418
 
1366
1419
  Parameters of the build method:
@@ -1378,6 +1431,16 @@ options
1378
1431
  block
1379
1432
  Block converted into Proc, use it as you desire. In this example nil.
1380
1433
 
1434
+ If your validator includes valid values that respond true to `.blank?`, you
1435
+ should also define:
1436
+
1437
+ .. code:: ruby
1438
+
1439
+ def ignore_allow_blank?
1440
+ true
1441
+ end
1442
+
1443
+ so that the validation does not fail for valid values.
1381
1444
 
1382
1445
  ============
1383
1446
  Versioning
@@ -1608,7 +1671,7 @@ Swagger-Specific Configuration Parameters
1608
1671
 
1609
1672
  There are several configuration parameters that determine the structure of the generated swagger file:
1610
1673
 
1611
- ``config.swagger_content_type_input``
1674
+ ``config.generator.swagger.content_type_input``
1612
1675
  If the value is ``:form_data`` - the swagger file will indicate that the server consumes the content types
1613
1676
  ``application/x-www-form-urlencoded`` and ``multipart/form-data``. Non-path parameters will have the
1614
1677
  value ``"in": "formData"``. Note that parameters of type Hash that do not have any fields in them will *be ommitted*
@@ -1621,38 +1684,58 @@ There are several configuration parameters that determine the structure of the g
1621
1684
  You can specify the value of this configuration parameter as an additional input to the rake command (e.g.,
1622
1685
  ``rake apipie:static_swagger_json[2.0,form_data]``).
1623
1686
 
1624
- ``config.swagger_json_input_uses_refs``
1625
- This parameter is only relevant if ``swagger_content_type_input`` is ``:json``.
1687
+ ``config.generator.swagger.json_input_uses_refs``
1688
+ This parameter is only relevant if ``swagger.content_type_input`` is ``:json``.
1626
1689
 
1627
1690
  If ``true``: the schema of the ``"in": "body"`` parameter of each method is given its own entry in the ``definitions``
1628
1691
  section, and is referenced using ``$ref`` from the method definition.
1629
1692
 
1630
1693
  If ``false``: the body parameter definitions are inlined within the method definitions.
1631
1694
 
1632
- ``config.swagger_include_warning_tags``
1695
+ ``config.generator.swagger.include_warning_tags``
1633
1696
  If ``true``: in addition to tagging methods with the name of the resource they belong to, methods for which warnings
1634
1697
  have been issued will be tagged with.
1635
1698
 
1636
- ``config.swagger_suppress_warnings``
1699
+ ``config.generator.swagger.suppress_warnings``
1637
1700
  If ``false``: no warnings will be suppressed
1638
1701
 
1639
1702
  If ``true``: all warnings will be suppressed
1640
1703
 
1641
1704
  If an array of values (e.g., ``[100,102,107]``), only the warnings identified by the numbers in the array will be suppressed.
1642
1705
 
1643
- ``config.swagger_api_host``
1706
+ ``config.generator.swagger.api_host``
1644
1707
  The value to place in the swagger host field.
1645
1708
 
1646
1709
  Default is ``localhost:3000``
1647
1710
 
1648
1711
  If ``nil`` then then host field will not be included.
1649
1712
 
1650
- ``config.swagger_allow_additional_properties_in_response``
1713
+ ``config.generator.swagger.allow_additional_properties_in_response``
1651
1714
  If ``false`` (default): response descriptions in the generated swagger will include an ``additional-properties: false``
1652
1715
  field
1653
1716
 
1654
1717
  If ``true``: the ``additional-properties: false`` field will not be included in response object descriptions
1655
1718
 
1719
+ ``config.generator.swagger.schemes``
1720
+ An array of transport schemes that the API supports.
1721
+ This can include any combination of ``http``, ``https``, ``ws`` and ``wss``.
1722
+ By default to encourage good security practices, ``['https']`` is specified.
1723
+
1724
+
1725
+ ``config:swagger.security_definitions``
1726
+ If the API requires authentication, you can specify details of the authentication mechanisms supported as a (Hash) value here.
1727
+ See [https://swagger.io/docs/specification/2-0/authentication/] for details of what values can be specified
1728
+ By default, no security is defined.
1729
+
1730
+ ``config.generator.swagger.global_security``
1731
+ If the API requires authentication, you can specify which of the authentication mechanisms are supported by all API operations as an Array of hashes here.
1732
+ This should be used in conjunction with the mechanisms defined by ``swagger.security_definitions``.
1733
+ See [https://swagger.io/docs/specification/2-0/authentication/] for details of what values can be specified
1734
+ By default, no security is defined.
1735
+
1736
+ ``config.generator.swagger.skip_default_tags``
1737
+ By setting ``false`` (default): The resource name for e.g. ``/pets/{petId}`` will automatically be added as a tag ``pets``.
1738
+ By setting ``true``: The tags needs to be explicitly added to the resource using the DSL.
1656
1739
 
1657
1740
  Known limitations of the current implementation
1658
1741
  -------------------------------------------------
@@ -1663,6 +1746,7 @@ Known limitations of the current implementation
1663
1746
  * It is not possible to leverage all of the parameter type/format capabilities of swagger
1664
1747
  * Only OpenAPI 2.0 is supported
1665
1748
  * Responses are defined inline and not as a $ref
1749
+ * It is not possible to specify per-operation security requirements (only global)
1666
1750
 
1667
1751
  ====================================
1668
1752
  Dynamic Swagger generation
@@ -1847,12 +1931,22 @@ provided it uses Apipie as a backend.
1847
1931
 
1848
1932
  And if you write one on your own, don't hesitate to share it with us!
1849
1933
 
1934
+ ====================
1935
+ Contributing
1936
+ ====================
1937
+
1938
+ Then, you can install dependencies and run the test suite:
1939
+
1940
+ .. code:: shell
1941
+
1942
+ > bundle install
1943
+ > bundle exec rspec
1850
1944
 
1851
1945
  ====================
1852
1946
  Disqus Integration
1853
1947
  ====================
1854
1948
 
1855
- You can setup `Disqus <http://www.disqus.com>`_ discussion within
1949
+ You can setup `Disqus <https://disqus.com/>`_ discussion within
1856
1950
  your documentation. Just set the credentials in the Apipie
1857
1951
  configuration:
1858
1952
 
data/Rakefile CHANGED
@@ -6,8 +6,3 @@ RSpec::Core::RakeTask.new(:spec)
6
6
  desc 'Default: run specs.'
7
7
  task :default => :spec
8
8
 
9
- desc "Generate code coverage"
10
- RSpec::Core::RakeTask.new(:coverage) do |t|
11
- t.rcov = true
12
- t.rcov_opts = ['--exclude', 'spec']
13
- end
data/apipie-rails.gemspec CHANGED
@@ -1,5 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ $:.push File.expand_path('lib', __dir__)
3
4
  require "apipie/version"
4
5
 
5
6
  Gem::Specification.new do |s|
@@ -10,19 +11,27 @@ Gem::Specification.new do |s|
10
11
  s.homepage = "http://github.com/Apipie/apipie-rails"
11
12
  s.summary = %q{Rails REST API documentation tool}
12
13
  s.description = %q{Rails REST API documentation tool}
13
- s.required_ruby_version = '>= 2.0.0'
14
+ s.required_ruby_version = '>= 2.6.0'
14
15
 
15
16
  s.files = `git ls-files`.split("\n")
16
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
18
  s.require_paths = ["lib"]
18
19
 
19
- s.add_dependency "rails", ">= 4.1"
20
+ s.add_dependency "actionpack", ">= 5.0"
21
+ s.add_dependency "activesupport", ">= 5.0"
22
+
23
+ # Optional dependencies
24
+ s.add_development_dependency "maruku" # for Markdown support
25
+ s.add_development_dependency "RedCloth" # for Textile support
26
+
27
+ # Dev/tests only dependencies
28
+ s.add_development_dependency "json-schema", "~> 2.8"
20
29
  s.add_development_dependency "rspec-rails", "~> 3.0"
21
- s.add_development_dependency "sqlite3"
22
- s.add_development_dependency "minitest"
23
- s.add_development_dependency "maruku"
24
- s.add_development_dependency "RedCloth"
25
30
  s.add_development_dependency "rake"
26
- s.add_development_dependency "rdoc"
27
- s.add_development_dependency "json-schema", "~> 2.8"
31
+ s.add_development_dependency 'rubocop_challenger'
32
+ s.add_development_dependency 'rubocop-rails'
33
+ s.add_development_dependency 'rubocop-rspec'
34
+ s.add_development_dependency 'rubocop-performance'
35
+ s.add_development_dependency "simplecov"
36
+ s.add_development_dependency "sqlite3"
28
37
  end