apipie-rails 0.9.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rubocop.yml +2 -2
  3. data/.rubocop.yml +23 -14
  4. data/.rubocop_todo.yml +103 -487
  5. data/CHANGELOG.md +20 -3
  6. data/README.rst +12 -12
  7. data/app/controllers/apipie/apipies_controller.rb +6 -6
  8. data/app/helpers/apipie_helper.rb +1 -1
  9. data/lib/apipie/apipie_module.rb +5 -5
  10. data/lib/apipie/application.rb +81 -55
  11. data/lib/apipie/configuration.rb +19 -26
  12. data/lib/apipie/dsl_definition.rb +8 -9
  13. data/lib/apipie/error_description.rb +1 -1
  14. data/lib/apipie/errors.rb +2 -16
  15. data/lib/apipie/extractor/collector.rb +3 -3
  16. data/lib/apipie/extractor/recorder.rb +1 -1
  17. data/lib/apipie/extractor.rb +2 -2
  18. data/lib/apipie/generator/config.rb +12 -0
  19. data/lib/apipie/generator/swagger/computed_interface_id.rb +23 -0
  20. data/lib/apipie/generator/swagger/config.rb +78 -0
  21. data/lib/apipie/generator/swagger/context.rb +12 -1
  22. data/lib/apipie/generator/swagger/method_description/api_decorator.rb +20 -0
  23. data/lib/apipie/generator/swagger/method_description/api_schema_service.rb +86 -0
  24. data/lib/apipie/generator/swagger/method_description/decorator.rb +22 -0
  25. data/lib/apipie/generator/swagger/method_description/parameters_service.rb +139 -0
  26. data/lib/apipie/generator/swagger/method_description/response_schema_service.rb +46 -0
  27. data/lib/apipie/generator/swagger/method_description/response_service.rb +58 -0
  28. data/lib/apipie/generator/swagger/method_description.rb +2 -0
  29. data/lib/apipie/generator/swagger/operation_id.rb +2 -2
  30. data/lib/apipie/generator/swagger/param_description/builder.rb +4 -4
  31. data/lib/apipie/generator/swagger/param_description/composite.rb +9 -1
  32. data/lib/apipie/generator/swagger/param_description/in.rb +1 -1
  33. data/lib/apipie/generator/swagger/param_description/path_params_composite.rb +61 -0
  34. data/lib/apipie/generator/swagger/param_description/referenced_composite.rb +36 -0
  35. data/lib/apipie/generator/swagger/param_description/type.rb +9 -2
  36. data/lib/apipie/generator/swagger/path_decorator.rb +36 -0
  37. data/lib/apipie/generator/swagger/referenced_definitions.rb +17 -0
  38. data/lib/apipie/generator/swagger/resource_description_collection.rb +30 -0
  39. data/lib/apipie/generator/swagger/resource_description_composite.rb +56 -0
  40. data/lib/apipie/generator/swagger/schema.rb +63 -0
  41. data/lib/apipie/generator/swagger/type_extractor.rb +0 -19
  42. data/lib/apipie/generator/swagger/warning.rb +3 -6
  43. data/lib/apipie/generator/swagger/warning_writer.rb +7 -1
  44. data/lib/apipie/helpers.rb +3 -3
  45. data/lib/apipie/method_description.rb +5 -3
  46. data/lib/apipie/param_description.rb +4 -2
  47. data/lib/apipie/resource_description.rb +11 -8
  48. data/lib/apipie/response_description.rb +1 -1
  49. data/lib/apipie/response_description_adapter.rb +3 -3
  50. data/lib/apipie/routing.rb +1 -1
  51. data/lib/apipie/rspec/response_validation_helper.rb +1 -1
  52. data/lib/apipie/swagger_generator.rb +27 -551
  53. data/lib/apipie/validator.rb +9 -5
  54. data/lib/apipie/version.rb +1 -1
  55. data/lib/apipie-rails.rb +17 -0
  56. data/lib/tasks/apipie.rake +25 -20
  57. data/spec/controllers/api/v2/nested/resources_controller_spec.rb +2 -2
  58. data/spec/controllers/pets_controller_spec.rb +10 -16
  59. data/spec/controllers/users_controller_spec.rb +2 -2
  60. data/spec/dummy/app/controllers/pets_controller.rb +4 -4
  61. data/spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb +2 -2
  62. data/spec/dummy/app/controllers/twitter_example_controller.rb +2 -2
  63. data/spec/dummy/app/controllers/users_controller.rb +5 -5
  64. data/spec/dummy/config.ru +1 -1
  65. data/spec/lib/apipie/apipies_controller_spec.rb +4 -0
  66. data/spec/lib/apipie/application_spec.rb +25 -15
  67. data/spec/lib/apipie/configuration_spec.rb +15 -0
  68. data/spec/lib/apipie/generator/swagger/config_spec.rb +19 -0
  69. data/spec/lib/apipie/generator/swagger/context_spec.rb +23 -2
  70. data/spec/lib/apipie/generator/swagger/method_description/api_schema_service_spec.rb +106 -0
  71. data/spec/lib/apipie/generator/swagger/method_description/response_schema_service_spec.rb +105 -0
  72. data/spec/lib/apipie/generator/swagger/param_description/builder_spec.rb +1 -1
  73. data/spec/lib/apipie/generator/swagger/param_description/composite_spec.rb +2 -2
  74. data/spec/lib/apipie/generator/swagger/param_description/type_spec.rb +7 -7
  75. data/spec/lib/apipie/generator/swagger/path_decorator_spec.rb +57 -0
  76. data/spec/lib/apipie/generator/swagger/referenced_definitions_spec.rb +35 -0
  77. data/spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb +37 -0
  78. data/spec/lib/apipie/generator/swagger/resource_descriptions_collection_spec.rb +57 -0
  79. data/spec/lib/apipie/generator/swagger/schema_spec.rb +89 -0
  80. data/spec/lib/apipie/generator/swagger/type_extractor_spec.rb +0 -43
  81. data/spec/lib/apipie/generator/swagger/warning_spec.rb +1 -1
  82. data/spec/lib/apipie/generator/swagger/warning_writer_spec.rb +19 -7
  83. data/spec/lib/apipie/method_description_spec.rb +101 -66
  84. data/spec/lib/apipie/no_documented_method_spec.rb +17 -0
  85. data/spec/lib/apipie/param_description_spec.rb +209 -49
  86. data/spec/lib/apipie/param_group_spec.rb +1 -0
  87. data/spec/lib/apipie/resource_description_spec.rb +71 -28
  88. data/spec/lib/apipie/response_does_not_match_swagger_schema_spec.rb +35 -0
  89. data/spec/lib/apipie/swagger_generator_spec.rb +94 -0
  90. data/spec/lib/apipie/validator_spec.rb +47 -11
  91. data/spec/lib/rake_spec.rb +1 -1
  92. data/spec/lib/swagger/rake_swagger_spec.rb +6 -6
  93. data/spec/lib/swagger/swagger_dsl_spec.rb +17 -11
  94. data/spec/lib/validators/array_validator_spec.rb +1 -1
  95. data/spec/spec_helper.rb +2 -2
  96. metadata +31 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c985a0a0a96f041421d812221f6352f69fb32eb93ec6a6bb4a990b2151a39f8
4
- data.tar.gz: 3d21ade5a4dfb08bc0faaf5c46fa8fe5e7cf294f14d9ee637c3e019b522f5bbf
3
+ metadata.gz: 822d52cddc54c458cc7449d9f881a68ee6766811d740cbc0a6d717f4760b8896
4
+ data.tar.gz: 37a6bd59c3e1fac91dbcb8ef34078caa28c19b9e27bcad872d70796096dfc67f
5
5
  SHA512:
6
- metadata.gz: 907ba718cd32695e13ce42203d639891de031221f90475712b2c7e816b1db7304174922ea796d2a31cdc4050f768871b06c3e9efc968e4db447400531ad0ca45
7
- data.tar.gz: 234ba3b4eab287d9530e09ae28c79821a509c4c57f8b42b1bf2da83d93141d3fb807c88cef97d9a889c4e4b1a70a94d41f92a2f5c6bf0e79f8c9ad3a65aa9f50
6
+ metadata.gz: a16332ce330bd90cc3a12bc57b5904bc7e66cd0f21dd66fd497903a139fb826c7e4e796fbdf440bb17c48427755d3cd66e548660e3e8a4a549dd8b97f5205db4
7
+ data.tar.gz: 1ac7735265214806b2beb8d7414c18915a8de995bf55339c93124f5247833284a30d566517ce71266718da3a237769d48c1a02bc1f6d5b11a893908bcc33f4d8
@@ -10,10 +10,10 @@ jobs:
10
10
  steps:
11
11
  - uses: actions/checkout@v3
12
12
 
13
- - name: Set up Ruby 2.7
13
+ - name: Set up Ruby 3.2.1
14
14
  uses: ruby/setup-ruby@v1
15
15
  with:
16
- ruby-version: 2.7
16
+ ruby-version: 3.2.1
17
17
  bundler-cache: true
18
18
 
19
19
  - name: Run rubocop
data/.rubocop.yml CHANGED
@@ -38,6 +38,7 @@ Metrics/ClassLength:
38
38
  - lib/apipie/extractor/writer.rb
39
39
  - lib/apipie/application.rb
40
40
  - lib/apipie/param_description.rb
41
+ - lib/apipie/method_description.rb
41
42
  - lib/apipie/swagger_generator.rb
42
43
  - spec/dummy/app/controllers/pets_controller.rb
43
44
  - spec/dummy/app/controllers/twitter_example_controller.rb
@@ -48,6 +49,7 @@ Metrics/BlockLength:
48
49
  Exclude:
49
50
  - app/controllers/apipie/apipies_controller.rb
50
51
  - lib/apipie/generator/swagger/param_description/composite.rb
52
+ - lib/apipie/generator/swagger/param_description/path_params_composite.rb
51
53
  - lib/tasks/apipie.rake
52
54
  - lib/apipie/swagger_generator.rb
53
55
 
@@ -55,6 +57,9 @@ Naming/PredicateName:
55
57
  AllowedMethods:
56
58
  - have_field?
57
59
 
60
+ Style/IfUnlessModifier:
61
+ Enabled: false
62
+
58
63
  Style/NumericPredicate:
59
64
  Enabled: false
60
65
 
@@ -62,6 +67,10 @@ Style/HashSyntax:
62
67
  EnforcedStyle: no_mixed_keys
63
68
  EnforcedShorthandSyntax: never # consistent
64
69
 
70
+ Metrics/ParameterLists:
71
+ Exclude:
72
+ - 'lib/apipie/generator/swagger/context.rb'
73
+
65
74
  Style/Documentation:
66
75
  Exclude:
67
76
  - 'app/controllers/apipie/apipies_controller.rb'
@@ -78,20 +87,7 @@ Style/Documentation:
78
87
  - 'lib/apipie/extractor/recorder.rb'
79
88
  - 'lib/apipie/extractor/writer.rb'
80
89
  - 'lib/apipie/generator/generator.rb'
81
- - 'lib/apipie/generator/swagger/context.rb'
82
- - 'lib/apipie/generator/swagger/operation_id.rb'
83
- - 'lib/apipie/generator/swagger/param_description.rb'
84
- - 'lib/apipie/generator/swagger/param_description/builder.rb'
85
- - 'lib/apipie/generator/swagger/param_description/composite.rb'
86
- - 'lib/apipie/generator/swagger/param_description/description.rb'
87
- - 'lib/apipie/generator/swagger/param_description/in.rb'
88
- - 'lib/apipie/generator/swagger/param_description/name.rb'
89
- - 'lib/apipie/generator/swagger/param_description/type.rb'
90
- - 'lib/apipie/generator/swagger/swagger.rb'
91
- - 'lib/apipie/generator/swagger/type.rb'
92
- - 'lib/apipie/generator/swagger/type_extractor.rb'
93
- - 'lib/apipie/generator/swagger/warning.rb'
94
- - 'lib/apipie/generator/swagger/warning_writer.rb'
90
+ - 'lib/apipie/generator/swagger/**/*'
95
91
  - 'lib/apipie/helpers.rb'
96
92
  - 'lib/apipie/markup.rb'
97
93
  - 'lib/apipie/method_description.rb'
@@ -103,6 +99,7 @@ Style/Documentation:
103
99
  - 'lib/apipie/routes_formatter.rb'
104
100
  - 'lib/apipie/routing.rb'
105
101
  - 'lib/apipie/rspec/response_validation_helper.rb'
102
+ - 'lib/apipie/swagger_generator.rb'
106
103
  - 'lib/apipie/see_description.rb'
107
104
  - 'lib/apipie/static_dispatcher.rb'
108
105
  - 'lib/apipie/tag_list_description.rb'
@@ -113,6 +110,18 @@ Style/Documentation:
113
110
  - spec/lib/validators/array_validator_spec.rb
114
111
  - spec/dummy/**/*.rb
115
112
 
113
+ Style/FrozenStringLiteralComment:
114
+ Enabled: false
115
+
116
+ Style/InverseMethods:
117
+ Enabled: false
118
+
116
119
  Naming/BlockForwarding:
117
120
  EnforcedStyle: explicit
118
121
  BlockForwardingName: block
122
+
123
+ Lint/MissingSuper:
124
+ Exclude:
125
+ - 'lib/apipie/errors.rb'
126
+ - 'lib/apipie/response_description_adapter.rb'
127
+ - 'lib/apipie/validator.rb'