apipie-rails 1.1.0 → 1.2.1
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 +12 -48
- data/.github/workflows/rubocop-challenger.yml +2 -2
- data/.github/workflows/rubocop.yml +2 -4
- data/.rubocop.yml +39 -38
- data/.rubocop_todo.yml +55 -65
- data/.vscode/settings.json +3 -0
- data/CHANGELOG.md +19 -2
- data/Gemfile +20 -0
- data/README.rst +12 -9
- data/app/controllers/apipie/apipies_controller.rb +3 -17
- data/gemfiles/Gemfile.tools +9 -0
- data/lib/apipie/application.rb +18 -7
- data/lib/apipie/dsl_definition.rb +6 -5
- data/lib/apipie/errors.rb +14 -0
- data/lib/apipie/extractor/collector.rb +1 -1
- data/lib/apipie/extractor/recorder.rb +1 -1
- data/lib/apipie/extractor.rb +6 -3
- data/lib/apipie/generator/swagger/config.rb +3 -1
- data/lib/apipie/generator/swagger/method_description/api_schema_service.rb +6 -3
- data/lib/apipie/generator/swagger/warning.rb +1 -1
- data/lib/apipie/resource_description.rb +28 -3
- data/lib/apipie/validator.rb +20 -6
- data/lib/apipie/version.rb +1 -1
- data/spec/controllers/api/v2/architectures_controller_spec.rb +10 -3
- data/spec/controllers/api/v2/empty_middle_controller_spec.rb +23 -0
- data/spec/controllers/api/v2/nested/resources_controller_spec.rb +16 -0
- data/spec/controllers/api/v2/sub/footguns_controller_spec.rb +19 -0
- data/spec/controllers/users_controller_spec.rb +10 -0
- data/spec/dummy/app/controllers/api/v2/base_controller.rb +6 -0
- data/spec/dummy/app/controllers/api/v2/empty_middle_controller.rb +14 -0
- data/spec/dummy/app/controllers/api/v2/nested/resources_controller.rb +2 -2
- data/spec/dummy/app/controllers/api/v2/sub/footguns_controller.rb +30 -0
- data/spec/dummy/app/controllers/users_controller.rb +6 -0
- data/spec/dummy/config/routes.rb +1 -0
- data/spec/lib/apipie/apipies_controller_spec.rb +63 -19
- data/spec/lib/apipie/extractor/collector_spec.rb +57 -0
- data/spec/lib/apipie/generator/swagger/method_description/api_schema_service_spec.rb +13 -0
- data/spec/test_engine/memes_controller_spec.rb +1 -1
- metadata +11 -9
- data/gemfiles/Gemfile.rails50 +0 -10
- data/gemfiles/Gemfile.rails51 +0 -10
- data/gemfiles/Gemfile.rails52 +0 -10
- data/gemfiles/Gemfile.rails60 +0 -17
- data/gemfiles/Gemfile.rails61 +0 -17
- data/gemfiles/Gemfile.rails70 +0 -17
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config --exclude-limit 180`
|
3
|
-
# on 2023-
|
3
|
+
# on 2023-06-09 05:29:05 UTC using RuboCop version 1.52.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -14,10 +14,9 @@ Gemspec/DeprecatedAttributeAssignment:
|
|
14
14
|
Exclude:
|
15
15
|
- 'apipie-rails.gemspec'
|
16
16
|
|
17
|
-
# Offense count:
|
17
|
+
# Offense count: 11
|
18
18
|
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
|
19
19
|
# SupportedStyles: Gemfile, gems.rb, gemspec
|
20
|
-
# AllowedGems: bundler
|
21
20
|
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
|
22
21
|
Gemspec/DevelopmentDependencies:
|
23
22
|
Exclude:
|
@@ -108,7 +107,7 @@ Layout/DotPosition:
|
|
108
107
|
- 'spec/lib/apipie/generator/swagger/operation_id_spec.rb'
|
109
108
|
- 'spec/lib/apipie/generator/swagger/param_description/type_spec.rb'
|
110
109
|
|
111
|
-
# Offense count:
|
110
|
+
# Offense count: 8
|
112
111
|
# This cop supports safe autocorrection (--autocorrect).
|
113
112
|
Layout/ElseAlignment:
|
114
113
|
Exclude:
|
@@ -119,7 +118,7 @@ Layout/ElseAlignment:
|
|
119
118
|
- 'lib/apipie/param_description.rb'
|
120
119
|
- 'lib/apipie/resource_description.rb'
|
121
120
|
|
122
|
-
# Offense count:
|
121
|
+
# Offense count: 58
|
123
122
|
# This cop supports safe autocorrection (--autocorrect).
|
124
123
|
Layout/EmptyLineAfterGuardClause:
|
125
124
|
Exclude:
|
@@ -155,7 +154,7 @@ Layout/EmptyLineBetweenDefs:
|
|
155
154
|
- 'spec/dummy/app/controllers/pets_using_auto_views_controller.rb'
|
156
155
|
- 'spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb'
|
157
156
|
|
158
|
-
# Offense count:
|
157
|
+
# Offense count: 56
|
159
158
|
# This cop supports safe autocorrection (--autocorrect).
|
160
159
|
Layout/EmptyLines:
|
161
160
|
Exclude:
|
@@ -193,7 +192,7 @@ Layout/EmptyLinesAroundAttributeAccessor:
|
|
193
192
|
Exclude:
|
194
193
|
- 'lib/apipie/configuration.rb'
|
195
194
|
|
196
|
-
# Offense count:
|
195
|
+
# Offense count: 92
|
197
196
|
# This cop supports safe autocorrection (--autocorrect).
|
198
197
|
# Configuration parameters: EnforcedStyle.
|
199
198
|
# SupportedStyles: empty_lines, no_empty_lines
|
@@ -202,7 +201,6 @@ Layout/EmptyLinesAroundBlockBody:
|
|
202
201
|
- 'app/controllers/apipie/apipies_controller.rb'
|
203
202
|
- 'lib/tasks/apipie.rake'
|
204
203
|
- 'spec/controllers/api/v1/architectures_controller_spec.rb'
|
205
|
-
- 'spec/controllers/api/v2/architectures_controller_spec.rb'
|
206
204
|
- 'spec/controllers/concerns_controller_spec.rb'
|
207
205
|
- 'spec/controllers/extended_controller_spec.rb'
|
208
206
|
- 'spec/controllers/included_param_group_controller_spec.rb'
|
@@ -288,7 +286,7 @@ Layout/EmptyLinesAroundModuleBody:
|
|
288
286
|
- 'lib/apipie/tag_list_description.rb'
|
289
287
|
- 'lib/apipie/validator.rb'
|
290
288
|
|
291
|
-
# Offense count:
|
289
|
+
# Offense count: 8
|
292
290
|
# This cop supports safe autocorrection (--autocorrect).
|
293
291
|
# Configuration parameters: EnforcedStyleAlignWith, Severity.
|
294
292
|
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
@@ -374,9 +372,9 @@ Layout/IndentationConsistency:
|
|
374
372
|
- 'lib/apipie/generator/swagger/param_description/name.rb'
|
375
373
|
- 'spec/lib/apipie/param_group_spec.rb'
|
376
374
|
|
377
|
-
# Offense count:
|
375
|
+
# Offense count: 14
|
378
376
|
# This cop supports safe autocorrection (--autocorrect).
|
379
|
-
# Configuration parameters: Width, AllowedPatterns
|
377
|
+
# Configuration parameters: Width, AllowedPatterns.
|
380
378
|
Layout/IndentationWidth:
|
381
379
|
Exclude:
|
382
380
|
- 'app/controllers/apipie/apipies_controller.rb'
|
@@ -440,13 +438,12 @@ Layout/MultilineMethodCallIndentation:
|
|
440
438
|
- 'lib/apipie/generator/swagger/param_description/composite.rb'
|
441
439
|
- 'lib/apipie/generator/swagger/param_description/type.rb'
|
442
440
|
|
443
|
-
# Offense count:
|
441
|
+
# Offense count: 4
|
444
442
|
# This cop supports safe autocorrection (--autocorrect).
|
445
443
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
446
444
|
# SupportedStyles: aligned, indented
|
447
445
|
Layout/MultilineOperationIndentation:
|
448
446
|
Exclude:
|
449
|
-
- 'lib/apipie/application.rb'
|
450
447
|
- 'lib/apipie/generator/swagger/param_description/composite.rb'
|
451
448
|
- 'lib/apipie/param_description.rb'
|
452
449
|
- 'lib/tasks/apipie.rake'
|
@@ -622,18 +619,17 @@ Layout/TrailingEmptyLines:
|
|
622
619
|
- 'spec/lib/apipie/generator/swagger/param_description_spec.rb'
|
623
620
|
- 'spec/lib/apipie/param_group_spec.rb'
|
624
621
|
|
625
|
-
# Offense count:
|
622
|
+
# Offense count: 15
|
626
623
|
# This cop supports safe autocorrection (--autocorrect).
|
627
624
|
# Configuration parameters: AllowInHeredoc.
|
628
625
|
Layout/TrailingWhitespace:
|
629
626
|
Exclude:
|
630
627
|
- 'lib/apipie/error_description.rb'
|
631
|
-
- 'spec/dummy/app/controllers/api/v2/nested/resources_controller.rb'
|
632
628
|
- 'spec/dummy/app/controllers/application_controller.rb'
|
633
629
|
- 'spec/dummy/app/controllers/twitter_example_controller.rb'
|
634
630
|
|
635
631
|
# Offense count: 10
|
636
|
-
# This cop supports
|
632
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
637
633
|
# Configuration parameters: AllowSafeAssignment.
|
638
634
|
Lint/AssignmentInCondition:
|
639
635
|
Exclude:
|
@@ -749,12 +745,11 @@ Lint/UnusedBlockArgument:
|
|
749
745
|
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
750
746
|
- 'spec/spec_helper.rb'
|
751
747
|
|
752
|
-
# Offense count:
|
748
|
+
# Offense count: 24
|
753
749
|
# This cop supports safe autocorrection (--autocorrect).
|
754
750
|
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
755
751
|
Lint/UnusedMethodArgument:
|
756
752
|
Exclude:
|
757
|
-
- 'lib/apipie/application.rb'
|
758
753
|
- 'lib/apipie/dsl_definition.rb'
|
759
754
|
- 'lib/apipie/response_description_adapter.rb'
|
760
755
|
- 'lib/apipie/validator.rb'
|
@@ -762,6 +757,7 @@ Lint/UnusedMethodArgument:
|
|
762
757
|
- 'spec/support/custom_bool_validator.rb'
|
763
758
|
|
764
759
|
# Offense count: 5
|
760
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
765
761
|
Lint/UselessAssignment:
|
766
762
|
Exclude:
|
767
763
|
- 'lib/apipie/application.rb'
|
@@ -776,35 +772,42 @@ Lint/UselessMethodDefinition:
|
|
776
772
|
- 'spec/dummy/app/controllers/overridden_concerns_controller.rb'
|
777
773
|
|
778
774
|
# Offense count: 3
|
775
|
+
# This cop supports safe autocorrection (--autocorrect).
|
779
776
|
# Configuration parameters: CheckForMethodsWithNoSideEffects.
|
780
777
|
Lint/Void:
|
781
778
|
Exclude:
|
782
779
|
- 'spec/controllers/users_controller_spec.rb'
|
783
780
|
|
784
781
|
# Offense count: 58
|
785
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns,
|
782
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
786
783
|
Metrics/AbcSize:
|
787
784
|
Max: 96
|
788
785
|
|
786
|
+
# Offense count: 1
|
787
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
|
788
|
+
# AllowedMethods: refine
|
789
|
+
Metrics/BlockLength:
|
790
|
+
Max: 26
|
791
|
+
|
789
792
|
# Offense count: 4
|
790
793
|
# Configuration parameters: CountBlocks.
|
791
794
|
Metrics/BlockNesting:
|
792
795
|
Max: 4
|
793
796
|
|
794
|
-
# Offense count:
|
795
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns
|
797
|
+
# Offense count: 24
|
798
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
796
799
|
Metrics/CyclomaticComplexity:
|
797
800
|
Max: 24
|
798
801
|
|
799
|
-
# Offense count:
|
800
|
-
# Configuration parameters: CountComments, CountAsOne,
|
802
|
+
# Offense count: 79
|
803
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
801
804
|
Metrics/MethodLength:
|
802
805
|
Max: 58
|
803
806
|
|
804
807
|
# Offense count: 1
|
805
808
|
# Configuration parameters: CountComments, CountAsOne.
|
806
809
|
Metrics/ModuleLength:
|
807
|
-
Max:
|
810
|
+
Max: 101
|
808
811
|
|
809
812
|
# Offense count: 4
|
810
813
|
# Configuration parameters: CountKeywordArgs.
|
@@ -812,8 +815,8 @@ Metrics/ParameterLists:
|
|
812
815
|
MaxOptionalParameters: 5
|
813
816
|
Max: 6
|
814
817
|
|
815
|
-
# Offense count:
|
816
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns
|
818
|
+
# Offense count: 20
|
819
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
817
820
|
Metrics/PerceivedComplexity:
|
818
821
|
Max: 25
|
819
822
|
|
@@ -840,15 +843,16 @@ Naming/HeredocDelimiterCase:
|
|
840
843
|
Exclude:
|
841
844
|
- 'spec/dummy/app/controllers/users_controller.rb'
|
842
845
|
|
843
|
-
# Offense count:
|
846
|
+
# Offense count: 7
|
844
847
|
# Configuration parameters: ForbiddenDelimiters.
|
845
|
-
# ForbiddenDelimiters: (
|
848
|
+
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
846
849
|
Naming/HeredocDelimiterNaming:
|
847
850
|
Exclude:
|
848
851
|
- 'spec/dummy/app/controllers/twitter_example_controller.rb'
|
849
852
|
- 'spec/dummy/app/controllers/users_controller.rb'
|
850
853
|
|
851
854
|
# Offense count: 3
|
855
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
852
856
|
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
853
857
|
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
854
858
|
Naming/MemoizedInstanceVariableName:
|
@@ -880,7 +884,7 @@ Naming/PredicateName:
|
|
880
884
|
# Offense count: 1
|
881
885
|
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
882
886
|
# SupportedStyles: snake_case, normalcase, non_integer
|
883
|
-
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
|
887
|
+
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
|
884
888
|
Naming/VariableNumber:
|
885
889
|
Exclude:
|
886
890
|
- 'spec/dummy/app/controllers/users_controller.rb'
|
@@ -906,12 +910,6 @@ Performance/Detect:
|
|
906
910
|
Exclude:
|
907
911
|
- 'spec/lib/swagger/rake_swagger_spec.rb'
|
908
912
|
|
909
|
-
# Offense count: 1
|
910
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
911
|
-
Performance/InefficientHashSearch:
|
912
|
-
Exclude:
|
913
|
-
- 'lib/apipie/generator/swagger/warning.rb'
|
914
|
-
|
915
913
|
# Offense count: 1
|
916
914
|
# This cop supports safe autocorrection (--autocorrect).
|
917
915
|
Performance/RedundantBlockCall:
|
@@ -940,11 +938,10 @@ Performance/StringIdentifierArgument:
|
|
940
938
|
- 'lib/apipie/extractor/writer.rb'
|
941
939
|
- 'spec/controllers/users_controller_spec.rb'
|
942
940
|
|
943
|
-
# Offense count:
|
941
|
+
# Offense count: 5
|
944
942
|
# This cop supports safe autocorrection (--autocorrect).
|
945
943
|
Performance/StringReplacement:
|
946
944
|
Exclude:
|
947
|
-
- 'app/controllers/apipie/apipies_controller.rb'
|
948
945
|
- 'lib/apipie/application.rb'
|
949
946
|
- 'lib/apipie/extractor/writer.rb'
|
950
947
|
- 'lib/apipie/generator/swagger/operation_id.rb'
|
@@ -984,7 +981,7 @@ RSpec/BeforeAfterAll:
|
|
984
981
|
Exclude:
|
985
982
|
- 'spec/controllers/users_controller_spec.rb'
|
986
983
|
|
987
|
-
# Offense count:
|
984
|
+
# Offense count: 53
|
988
985
|
# Configuration parameters: Prefixes, AllowedPatterns.
|
989
986
|
# Prefixes: when, with, without
|
990
987
|
RSpec/ContextWording:
|
@@ -1012,14 +1009,13 @@ RSpec/DescribeClass:
|
|
1012
1009
|
- 'spec/lib/swagger/rake_swagger_spec.rb'
|
1013
1010
|
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
1014
1011
|
|
1015
|
-
# Offense count:
|
1012
|
+
# Offense count: 75
|
1016
1013
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
1017
1014
|
# Configuration parameters: SkipBlocks, EnforcedStyle.
|
1018
1015
|
# SupportedStyles: described_class, explicit
|
1019
1016
|
RSpec/DescribedClass:
|
1020
1017
|
Exclude:
|
1021
1018
|
- 'spec/controllers/api/v1/architectures_controller_spec.rb'
|
1022
|
-
- 'spec/controllers/api/v2/architectures_controller_spec.rb'
|
1023
1019
|
- 'spec/controllers/api/v2/nested/resources_controller_spec.rb'
|
1024
1020
|
- 'spec/controllers/included_param_group_controller_spec.rb'
|
1025
1021
|
- 'spec/controllers/users_controller_spec.rb'
|
@@ -1070,7 +1066,6 @@ RSpec/ExampleLength:
|
|
1070
1066
|
RSpec/ExampleWording:
|
1071
1067
|
Exclude:
|
1072
1068
|
- 'spec/controllers/api/v1/architectures_controller_spec.rb'
|
1073
|
-
- 'spec/controllers/api/v2/architectures_controller_spec.rb'
|
1074
1069
|
- 'spec/controllers/api/v2/nested/resources_controller_spec.rb'
|
1075
1070
|
- 'spec/controllers/concerns_controller_spec.rb'
|
1076
1071
|
- 'spec/controllers/extended_controller_spec.rb'
|
@@ -1153,18 +1148,17 @@ RSpec/MessageSpies:
|
|
1153
1148
|
RSpec/MultipleExpectations:
|
1154
1149
|
Max: 19
|
1155
1150
|
|
1156
|
-
# Offense count:
|
1151
|
+
# Offense count: 156
|
1157
1152
|
# Configuration parameters: AllowSubject.
|
1158
1153
|
RSpec/MultipleMemoizedHelpers:
|
1159
1154
|
Max: 15
|
1160
1155
|
|
1161
|
-
# Offense count:
|
1156
|
+
# Offense count: 82
|
1162
1157
|
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
|
1163
1158
|
# SupportedStyles: always, named_only
|
1164
1159
|
RSpec/NamedSubject:
|
1165
1160
|
Exclude:
|
1166
1161
|
- 'spec/controllers/api/v1/architectures_controller_spec.rb'
|
1167
|
-
- 'spec/controllers/api/v2/architectures_controller_spec.rb'
|
1168
1162
|
- 'spec/controllers/api/v2/nested/resources_controller_spec.rb'
|
1169
1163
|
- 'spec/controllers/users_controller_spec.rb'
|
1170
1164
|
- 'spec/lib/apipie/generator/swagger/param_description/builder_spec.rb'
|
@@ -1179,18 +1173,17 @@ RSpec/NamedSubject:
|
|
1179
1173
|
- 'spec/lib/swagger/rake_swagger_spec.rb'
|
1180
1174
|
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
1181
1175
|
|
1182
|
-
# Offense count:
|
1176
|
+
# Offense count: 94
|
1183
1177
|
# Configuration parameters: AllowedGroups.
|
1184
1178
|
RSpec/NestedGroups:
|
1185
1179
|
Max: 6
|
1186
1180
|
|
1187
|
-
# Offense count:
|
1181
|
+
# Offense count: 1
|
1188
1182
|
# Configuration parameters: AllowedPatterns.
|
1189
1183
|
# AllowedPatterns: ^expect_, ^assert_
|
1190
1184
|
RSpec/NoExpectationExample:
|
1191
1185
|
Exclude:
|
1192
1186
|
- 'spec/controllers/users_controller_spec.rb'
|
1193
|
-
- 'spec/test_engine/memes_controller_spec.rb'
|
1194
1187
|
|
1195
1188
|
# Offense count: 2
|
1196
1189
|
# This cop supports safe autocorrection (--autocorrect).
|
@@ -1297,13 +1290,12 @@ Rails/HttpStatus:
|
|
1297
1290
|
- 'spec/dummy/app/controllers/pets_controller.rb'
|
1298
1291
|
- 'spec/dummy/app/controllers/users_controller.rb'
|
1299
1292
|
|
1300
|
-
# Offense count:
|
1293
|
+
# Offense count: 3
|
1301
1294
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
1302
1295
|
Rails/NegateInclude:
|
1303
1296
|
Exclude:
|
1304
1297
|
- 'lib/apipie/extractor/collector.rb'
|
1305
1298
|
- 'lib/apipie/extractor/writer.rb'
|
1306
|
-
- 'lib/apipie/generator/swagger/warning.rb'
|
1307
1299
|
- 'spec/spec_helper.rb'
|
1308
1300
|
|
1309
1301
|
# Offense count: 7
|
@@ -1322,7 +1314,7 @@ Rails/OutputSafety:
|
|
1322
1314
|
- 'lib/apipie/helpers.rb'
|
1323
1315
|
|
1324
1316
|
# Offense count: 3
|
1325
|
-
# This cop supports
|
1317
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
1326
1318
|
Rails/Pluck:
|
1327
1319
|
Exclude:
|
1328
1320
|
- 'lib/apipie/extractor/writer.rb'
|
@@ -1384,9 +1376,9 @@ Style/AndOr:
|
|
1384
1376
|
Exclude:
|
1385
1377
|
- 'lib/apipie/param_description.rb'
|
1386
1378
|
|
1387
|
-
# Offense count:
|
1379
|
+
# Offense count: 18
|
1388
1380
|
# This cop supports safe autocorrection (--autocorrect).
|
1389
|
-
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns,
|
1381
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
1390
1382
|
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
1391
1383
|
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
1392
1384
|
# FunctionalMethods: let, let!, subject, watch
|
@@ -1463,7 +1455,7 @@ Style/ClassCheck:
|
|
1463
1455
|
|
1464
1456
|
# Offense count: 2
|
1465
1457
|
# This cop supports safe autocorrection (--autocorrect).
|
1466
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns
|
1458
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
1467
1459
|
# AllowedMethods: ==, equal?, eql?
|
1468
1460
|
Style/ClassEqualityComparison:
|
1469
1461
|
Exclude:
|
@@ -1497,13 +1489,12 @@ Style/CommentedKeyword:
|
|
1497
1489
|
- 'lib/apipie/dsl_definition.rb'
|
1498
1490
|
- 'lib/apipie/extractor/recorder.rb'
|
1499
1491
|
|
1500
|
-
# Offense count:
|
1492
|
+
# Offense count: 8
|
1501
1493
|
# This cop supports safe autocorrection (--autocorrect).
|
1502
1494
|
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
1503
1495
|
# SupportedStyles: assign_to_condition, assign_inside_condition
|
1504
1496
|
Style/ConditionalAssignment:
|
1505
1497
|
Exclude:
|
1506
|
-
- 'app/controllers/apipie/apipies_controller.rb'
|
1507
1498
|
- 'lib/apipie/extractor/writer.rb'
|
1508
1499
|
- 'lib/apipie/param_description.rb'
|
1509
1500
|
- 'lib/apipie/response_description.rb'
|
@@ -1541,7 +1532,7 @@ Style/EmptyElse:
|
|
1541
1532
|
- 'lib/apipie/extractor/recorder.rb'
|
1542
1533
|
- 'lib/apipie/extractor/writer.rb'
|
1543
1534
|
|
1544
|
-
# Offense count:
|
1535
|
+
# Offense count: 27
|
1545
1536
|
# This cop supports safe autocorrection (--autocorrect).
|
1546
1537
|
# Configuration parameters: EnforcedStyle.
|
1547
1538
|
# SupportedStyles: compact, expanded
|
@@ -1594,12 +1585,13 @@ Style/For:
|
|
1594
1585
|
|
1595
1586
|
# Offense count: 7
|
1596
1587
|
# This cop supports safe autocorrection (--autocorrect).
|
1597
|
-
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns
|
1588
|
+
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
|
1598
1589
|
# SupportedStyles: annotated, template, unannotated
|
1590
|
+
# AllowedMethods: redirect
|
1599
1591
|
Style/FormatStringToken:
|
1600
1592
|
EnforcedStyle: template
|
1601
1593
|
|
1602
|
-
# Offense count:
|
1594
|
+
# Offense count: 31
|
1603
1595
|
# This cop supports safe autocorrection (--autocorrect).
|
1604
1596
|
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
|
1605
1597
|
Style/GuardClause:
|
@@ -1664,7 +1656,7 @@ Style/Lambda:
|
|
1664
1656
|
|
1665
1657
|
# Offense count: 2
|
1666
1658
|
# This cop supports safe autocorrection (--autocorrect).
|
1667
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns
|
1659
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
1668
1660
|
Style/MethodCallWithoutArgsParentheses:
|
1669
1661
|
Exclude:
|
1670
1662
|
- 'lib/apipie/extractor/recorder.rb'
|
@@ -1783,7 +1775,6 @@ Style/Proc:
|
|
1783
1775
|
Style/RaiseArgs:
|
1784
1776
|
Exclude:
|
1785
1777
|
- 'lib/apipie/application.rb'
|
1786
|
-
- 'lib/apipie/dsl_definition.rb'
|
1787
1778
|
- 'lib/apipie/extractor/writer.rb'
|
1788
1779
|
- 'lib/apipie/param_description.rb'
|
1789
1780
|
- 'lib/apipie/see_description.rb'
|
@@ -1834,7 +1825,7 @@ Style/RedundantPercentQ:
|
|
1834
1825
|
Exclude:
|
1835
1826
|
- 'apipie-rails.gemspec'
|
1836
1827
|
|
1837
|
-
# Offense count:
|
1828
|
+
# Offense count: 27
|
1838
1829
|
# This cop supports safe autocorrection (--autocorrect).
|
1839
1830
|
# Configuration parameters: AllowMultipleReturnValues.
|
1840
1831
|
Style/RedundantReturn:
|
@@ -1895,12 +1886,11 @@ Style/Semicolon:
|
|
1895
1886
|
Exclude:
|
1896
1887
|
- 'lib/apipie/method_description.rb'
|
1897
1888
|
|
1898
|
-
# Offense count:
|
1889
|
+
# Offense count: 1
|
1899
1890
|
# This cop supports safe autocorrection (--autocorrect).
|
1900
1891
|
# Configuration parameters: AllowIfMethodIsEmpty.
|
1901
1892
|
Style/SingleLineMethods:
|
1902
1893
|
Exclude:
|
1903
|
-
- 'lib/apipie/resource_description.rb'
|
1904
1894
|
- 'lib/apipie/tag_list_description.rb'
|
1905
1895
|
|
1906
1896
|
# Offense count: 6
|
@@ -1936,7 +1926,7 @@ Style/StringConcatenation:
|
|
1936
1926
|
- 'lib/apipie/application.rb'
|
1937
1927
|
- 'lib/apipie/extractor/writer.rb'
|
1938
1928
|
|
1939
|
-
# Offense count:
|
1929
|
+
# Offense count: 1212
|
1940
1930
|
# This cop supports safe autocorrection (--autocorrect).
|
1941
1931
|
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
1942
1932
|
# SupportedStyles: single_quotes, double_quotes
|
@@ -2020,7 +2010,7 @@ Style/StringLiterals:
|
|
2020
2010
|
- 'spec/support/rake.rb'
|
2021
2011
|
- 'spec/test_engine/memes_controller_spec.rb'
|
2022
2012
|
|
2023
|
-
# Offense count:
|
2013
|
+
# Offense count: 34
|
2024
2014
|
# This cop supports safe autocorrection (--autocorrect).
|
2025
2015
|
# Configuration parameters: MinSize.
|
2026
2016
|
# SupportedStyles: percent, brackets
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,25 @@
|
|
1
1
|
Changelog
|
2
2
|
===========
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
## [v1.2.1](https://github.com/Apipie/apipie-rails/tree/v1.2.1) (2023-06-09)
|
5
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.2.0...v1.2.1)
|
6
|
+
* rspec: Fixes deprecated matcher ([#882](https://github.com/Apipie/apipie-rails/pull/882)) (David Wessman)
|
7
|
+
* Fix streaming bug ([#677](https://github.com/Apipie/apipie-rails/pull/677)) (Hunter Braun)
|
8
|
+
* Update README URLs based on HTTP redirects ([#448](https://github.com/Apipie/apipie-rails/pull/448)) (ReadmeCritic)
|
9
|
+
* Swagger: Adds option to skip default tags ([#881](https://github.com/Apipie/apipie-rails/pull/881)) (David Wessman)
|
10
|
+
* Parameter validation: Raises error for all missing ([#886](https://github.com/Apipie/apipie-rails/pull/886)) (David Wessman)
|
11
|
+
|
12
|
+
## [v1.2.0](https://github.com/Apipie/apipie-rails/tree/v1.2.0) (2023-06-03)
|
13
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.1.0...v1.2.0)
|
14
|
+
* Allow resource_name to be inherited ([#872](https://github.com/Apipie/apipie-rails/pull/872)) (Eric Hankins)
|
15
|
+
* Fix cache rendering with namespaced resources ([#874](https://github.com/Apipie/apipie-rails/pull/874)) (Eric Hankins)
|
16
|
+
* Fix deprecated content_type on Rails >= 6 ([#879](https://github.com/Apipie/apipie-rails/pull/879)) (Eric Hankins)
|
17
|
+
* Fix typo in Collector ([#877](https://github.com/Apipie/apipie-rails/pull/877)) (Eric Hankins)
|
18
|
+
* Fix error climbing controller hierarchy ([#875](https://github.com/Apipie/apipie-rails/pull/875)) (Eric Hankins)
|
19
|
+
* Add Gemfile.tools for IDE usage ([#876](https://github.com/Apipie/apipie-rails/pull/876)) (Eric Hankins)
|
20
|
+
* Fix rubocop ([#883](https://github.com/Apipie/apipie-rails/pull/883)) (Mathieu Jobin)
|
21
|
+
* Performance/InefficientHashSearch-20230602233137 ([#884](https://github.com/Apipie/apipie-rails/pull/884)) (RuboCop challenger)
|
22
|
+
* Redo Github action script to not need individual gemfiles ([#885](https://github.com/Apipie/apipie-rails/pull/885)) (Mathieu Jobin)
|
6
23
|
|
7
24
|
## [v1.1.0](https://github.com/Apipie/apipie-rails/tree/v1.1.0) (2023-05-16)
|
8
25
|
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.0.0...v1.1.0)
|
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
@@ -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/
|
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 <
|
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
|
|
@@ -1180,7 +1184,7 @@ Here is an example of how to rescue and process a +ParamMissing+ or
|
|
1180
1184
|
+ParamInvalid+ error from within the ApplicationController.
|
1181
1185
|
|
1182
1186
|
.. code:: ruby
|
1183
|
-
|
1187
|
+
|
1184
1188
|
class ApplicationController < ActionController::Base
|
1185
1189
|
|
1186
1190
|
# ParamError is superclass of ParamMissing, ParamInvalid
|
@@ -1726,6 +1730,9 @@ There are several configuration parameters that determine the structure of the g
|
|
1726
1730
|
See [https://swagger.io/docs/specification/2-0/authentication/] for details of what values can be specified
|
1727
1731
|
By default, no security is defined.
|
1728
1732
|
|
1733
|
+
``config.generator.swagger.skip_default_tags``
|
1734
|
+
By setting ``false`` (default): The resource name for e.g. ``/pets/{petId}`` will automatically be added as a tag ``pets``.
|
1735
|
+
By setting ``true``: The tags needs to be explicitly added to the resource using the DSL.
|
1729
1736
|
|
1730
1737
|
Known limitations of the current implementation
|
1731
1738
|
-------------------------------------------------
|
@@ -1925,14 +1932,10 @@ And if you write one on your own, don't hesitate to share it with us!
|
|
1925
1932
|
Contributing
|
1926
1933
|
====================
|
1927
1934
|
|
1928
|
-
Since this gem does not have a Gemfile, you need to specify it in your shell with:
|
1929
|
-
|
1930
|
-
.. code:: shell
|
1931
|
-
BUNDLE_GEMFILE='gemfiles/Gemfile.rails61'
|
1932
|
-
|
1933
1935
|
Then, you can install dependencies and run the test suite:
|
1934
1936
|
|
1935
1937
|
.. code:: shell
|
1938
|
+
|
1936
1939
|
> bundle install
|
1937
1940
|
> bundle exec rspec
|
1938
1941
|
|
@@ -1940,7 +1943,7 @@ Then, you can install dependencies and run the test suite:
|
|
1940
1943
|
Disqus Integration
|
1941
1944
|
====================
|
1942
1945
|
|
1943
|
-
You can setup `Disqus <
|
1946
|
+
You can setup `Disqus <https://disqus.com/>`_ discussion within
|
1944
1947
|
your documentation. Just set the credentials in the Apipie
|
1945
1948
|
configuration:
|
1946
1949
|
|
@@ -154,26 +154,12 @@ module Apipie
|
|
154
154
|
|
155
155
|
def render_from_cache
|
156
156
|
path = Apipie.configuration.doc_base_url.dup
|
157
|
-
# some params can contain dot, but only one in row
|
158
|
-
if [:resource, :method, :format, :version].any? { |p| params[p].to_s.gsub(".", "") =~ /\W/ || params[p].to_s.include?('..') }
|
159
|
-
head :bad_request and return
|
160
|
-
end
|
161
|
-
|
162
157
|
path << "/" << params[:version] if params[:version].present?
|
163
158
|
path << "/" << params[:resource] if params[:resource].present?
|
164
159
|
path << "/" << params[:method] if params[:method].present?
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
path << ".html"
|
169
|
-
end
|
170
|
-
|
171
|
-
# we sanitize the params before so in ideal case, this condition
|
172
|
-
# will be never satisfied. It's here for cases somebody adds new
|
173
|
-
# param into the path later and forgets about sanitation.
|
174
|
-
if path.include?('..')
|
175
|
-
head :bad_request and return
|
176
|
-
end
|
160
|
+
# Sanitize path against directory traversal attacks (e.g. ../../foo)
|
161
|
+
# by turning path into an absolute path before appending it to the cache dir
|
162
|
+
path = File.expand_path("#{path}.#{request.format.symbol}", '/')
|
177
163
|
|
178
164
|
cache_file = File.join(Apipie.configuration.cache_dir, path)
|
179
165
|
if File.exist?(cache_file)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# This Gemfile is used for IDEs like VS Code that need specific gems installed
|
2
|
+
# for their tools to work properly. It is not used for the application itself.
|
3
|
+
|
4
|
+
source 'https://rubygems.org'
|
5
|
+
|
6
|
+
gem 'rubocop-rails'
|
7
|
+
gem 'rubocop-rspec'
|
8
|
+
gem 'rubocop-performance'
|
9
|
+
gem 'ruby-lsp', '~> 0.5.1'
|
data/lib/apipie/application.rb
CHANGED
@@ -122,15 +122,26 @@ module Apipie
|
|
122
122
|
# resource_description? It's used to derivate the default value of
|
123
123
|
# versions for methods.
|
124
124
|
def controller_versions(controller)
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
return [Apipie.configuration.default_version]
|
129
|
-
else
|
130
|
-
return controller_versions(controller.to_s.constantize.superclass)
|
125
|
+
value_from_parents(controller, default: [Apipie.configuration.default_version]) do |c|
|
126
|
+
ret = @controller_versions[c.to_s]
|
127
|
+
ret unless ret.empty?
|
131
128
|
end
|
132
129
|
end
|
133
130
|
|
131
|
+
# Recursively walks up the controller hierarchy looking for a value
|
132
|
+
# from the block.
|
133
|
+
# Stops at ActionController::Base.
|
134
|
+
# @param [Class] controller controller to start from
|
135
|
+
# @param [Array] args arguments passed to the block
|
136
|
+
# @param [Object] default default value to return if no value is found
|
137
|
+
# @param [Proc] block block to call with controller and args
|
138
|
+
def value_from_parents(controller, *args, default: nil, &block)
|
139
|
+
return default if controller == ActionController::Base || controller == AbstractController::Base || controller.nil?
|
140
|
+
|
141
|
+
thing = yield(controller, *args)
|
142
|
+
thing || value_from_parents(controller.superclass, *args, default: default, &block)
|
143
|
+
end
|
144
|
+
|
134
145
|
def set_controller_versions(controller, versions)
|
135
146
|
@controller_versions[controller.to_s] = versions
|
136
147
|
end
|
@@ -443,7 +454,7 @@ module Apipie
|
|
443
454
|
end
|
444
455
|
|
445
456
|
def version_prefix(klass)
|
446
|
-
version = controller_versions(klass
|
457
|
+
version = controller_versions(klass).first
|
447
458
|
base_url = get_base_url(version)
|
448
459
|
return "/" if base_url.blank?
|
449
460
|
base_url[1..-1] + "/"
|