apipie-rails 1.4.2 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c72cb8c9744d64b6d940b81e8e692f7794ebce0e4c8438cced6e5e844e7690cb
4
- data.tar.gz: 68ffc84b4faf041018bacd00519b071702726035466b6fc44c380bd66de98bcb
3
+ metadata.gz: baf45fb6178ea4ae804300d54415680c2b7d86c465f5147f5b4091202d585c53
4
+ data.tar.gz: 9af8578adfde5145b007bc648b0d7c997d04da6de8a709ce28e3bfeaa605fd5f
5
5
  SHA512:
6
- metadata.gz: 1de4f529cc90ccf084c4f567576a0db46e51f1aebb470f01818f59479e04847371709ef5e6e05377d9acdd20d39950f27a75b517650f65c29a7d7d460e651884
7
- data.tar.gz: 8841db6ef76b1696cbee3f0cafdabbdf3eaca5e94c185604490f7771bbd38bdf6a55c4f720e998558996cca83f70e512dd7e8f9f80c74721d6c11e3dd554c931
6
+ metadata.gz: febcfbe9d521c0b45fd4895acf1b649b2b6e5f1bb4dc1e8624cd950f4ed05b665b5e60daa79b70749601ba5d0e1573dcffa601c35ece37814ce55ec36f3d7514
7
+ data.tar.gz: 23c8d22754237c3ed79a3b92cbc9d9a7e3a8d11715985cdd9bfbe1fa39f98d82001a7e0b28b63d19c37558b3f78d75f0987b2f3f4459fca8be9bd53f56b7c0cb
@@ -4,21 +4,36 @@ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  test:
7
- runs-on: ubuntu-20.04
7
+ runs-on: ubuntu-24.04
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- rails: ["7.1", "7.0", "6.1", "6.0"]
12
- ruby: ["3.3", "3.2", "3.1", "3.0", "2.7"]
11
+ rails: ["8.0", "7.2", "7.1", "7.0", "6.1", "6.0"]
12
+ ruby: ["3.4", "3.3", "3.2", "3.1", "3.0", "2.7"]
13
13
  include:
14
- - rails: "7.1"
15
- ruby: "3.4.0-preview1"
16
14
  - rails: "5.2"
17
15
  ruby: "2.7.8"
18
16
  - rails: "5.1"
19
17
  ruby: "2.6.10"
20
18
  - rails: "5.0"
21
19
  ruby: "2.6.10"
20
+ exclude:
21
+ - rails: "6.0"
22
+ ruby: "3.4"
23
+ - rails: "6.1"
24
+ ruby: "3.4"
25
+ - rails: "7.0"
26
+ ruby: "3.4"
27
+ - rails: "7.2"
28
+ ruby: "2.7"
29
+ - rails: "7.2"
30
+ ruby: "3.0"
31
+ - rails: "8.0"
32
+ ruby: "2.7"
33
+ - rails: "8.0"
34
+ ruby: "3.0"
35
+ - rails: "8.0"
36
+ ruby: "3.1"
22
37
 
23
38
  env:
24
39
  RAILS_VERSION: ${{ matrix.rails }}
data/.rubocop.yml CHANGED
@@ -1,4 +1,4 @@
1
- require:
1
+ plugins:
2
2
  - rubocop-rails
3
3
  - rubocop-rspec
4
4
  - rubocop-rspec_rails
@@ -58,7 +58,7 @@ Metrics/BlockLength:
58
58
  - lib/tasks/apipie.rake
59
59
  - lib/apipie/swagger_generator.rb
60
60
 
61
- Naming/PredicateName:
61
+ Naming/PredicatePrefix:
62
62
  AllowedMethods:
63
63
  - have_field?
64
64
 
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 2024-07-10 23:53:15 UTC using RuboCop version 1.65.0.
3
+ # on 2026-04-14 07:12:28 UTC using RuboCop version 1.86.1.
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
@@ -8,47 +8,37 @@
8
8
 
9
9
  # Offense count: 1
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: Severity, Include.
12
- # Include: **/*.gemspec
13
11
  Gemspec/DeprecatedAttributeAssignment:
14
12
  Exclude:
15
13
  - 'apipie-rails.gemspec'
16
14
 
17
15
  # Offense count: 12
18
- # Configuration parameters: EnforcedStyle, AllowedGems, Include.
16
+ # Configuration parameters: EnforcedStyle, AllowedGems.
19
17
  # SupportedStyles: Gemfile, gems.rb, gemspec
20
- # Include: **/*.gemspec, **/Gemfile, **/gems.rb
21
18
  Gemspec/DevelopmentDependencies:
22
19
  Exclude:
23
20
  - 'apipie-rails.gemspec'
24
21
 
25
22
  # Offense count: 2
26
23
  # This cop supports safe autocorrection (--autocorrect).
27
- # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
28
- # Include: **/*.gemspec
24
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
29
25
  Gemspec/OrderedDependencies:
30
26
  Exclude:
31
27
  - 'apipie-rails.gemspec'
32
28
 
33
29
  # Offense count: 2
34
30
  # This cop supports safe autocorrection (--autocorrect).
35
- # Configuration parameters: Severity, Include.
36
- # Include: **/*.gemspec
37
31
  Gemspec/RequireMFA:
38
32
  Exclude:
39
33
  - 'apipie-rails.gemspec'
40
34
  - 'spec/dummy/components/test_engine/test_engine.gemspec'
41
35
 
42
36
  # Offense count: 1
43
- # Configuration parameters: Severity, Include.
44
- # Include: **/*.gemspec
45
37
  Gemspec/RequiredRubyVersion:
46
38
  Exclude:
47
39
  - 'spec/dummy/components/test_engine/test_engine.gemspec'
48
40
 
49
41
  # Offense count: 1
50
- # Configuration parameters: Severity, Include.
51
- # Include: **/*.gemspec
52
42
  Gemspec/RubyVersionGlobalsUsage:
53
43
  Exclude:
54
44
  - 'apipie-rails.gemspec'
@@ -94,7 +84,7 @@ Layout/CommentIndentation:
94
84
 
95
85
  # Offense count: 1
96
86
  # This cop supports safe autocorrection (--autocorrect).
97
- # Configuration parameters: EnforcedStyleAlignWith, Severity.
87
+ # Configuration parameters: EnforcedStyleAlignWith.
98
88
  # SupportedStylesAlignWith: start_of_line, def
99
89
  Layout/DefEndAlignment:
100
90
  Exclude:
@@ -125,7 +115,7 @@ Layout/ElseAlignment:
125
115
  - 'lib/apipie/param_description.rb'
126
116
  - 'lib/apipie/resource_description.rb'
127
117
 
128
- # Offense count: 59
118
+ # Offense count: 60
129
119
  # This cop supports safe autocorrection (--autocorrect).
130
120
  Layout/EmptyLineAfterGuardClause:
131
121
  Exclude:
@@ -161,7 +151,7 @@ Layout/EmptyLineBetweenDefs:
161
151
  - 'spec/dummy/app/controllers/pets_using_auto_views_controller.rb'
162
152
  - 'spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb'
163
153
 
164
- # Offense count: 54
154
+ # Offense count: 55
165
155
  # This cop supports safe autocorrection (--autocorrect).
166
156
  Layout/EmptyLines:
167
157
  Exclude:
@@ -258,7 +248,7 @@ Layout/EmptyLinesAroundClassBody:
258
248
  - 'spec/dummy/app/controllers/users_controller.rb'
259
249
  - 'spec/dummy/config/initializers/apipie.rb'
260
250
 
261
- # Offense count: 6
251
+ # Offense count: 7
262
252
  # This cop supports safe autocorrection (--autocorrect).
263
253
  Layout/EmptyLinesAroundMethodBody:
264
254
  Exclude:
@@ -293,7 +283,7 @@ Layout/EmptyLinesAroundModuleBody:
293
283
 
294
284
  # Offense count: 8
295
285
  # This cop supports safe autocorrection (--autocorrect).
296
- # Configuration parameters: EnforcedStyleAlignWith, Severity.
286
+ # Configuration parameters: EnforcedStyleAlignWith.
297
287
  # SupportedStylesAlignWith: keyword, variable, start_of_line
298
288
  Layout/EndAlignment:
299
289
  Exclude:
@@ -370,7 +360,8 @@ Layout/IndentationConsistency:
370
360
 
371
361
  # Offense count: 14
372
362
  # This cop supports safe autocorrection (--autocorrect).
373
- # Configuration parameters: Width, AllowedPatterns.
363
+ # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
364
+ # SupportedStylesAlignWith: start_of_line, relative_to_receiver
374
365
  Layout/IndentationWidth:
375
366
  Exclude:
376
367
  - 'app/controllers/apipie/apipies_controller.rb'
@@ -385,7 +376,7 @@ Layout/IndentationWidth:
385
376
 
386
377
  # Offense count: 15
387
378
  # This cop supports safe autocorrection (--autocorrect).
388
- # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
379
+ # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment, AllowRBSInlineAnnotation, AllowSteepAnnotation.
389
380
  Layout/LeadingCommentSpace:
390
381
  Exclude:
391
382
  - 'lib/apipie/dsl_definition.rb'
@@ -572,7 +563,7 @@ Layout/SpaceInsideParens:
572
563
  - 'spec/lib/apipie/method_description/apis_service_spec.rb'
573
564
  - 'spec/lib/swagger/swagger_dsl_spec.rb'
574
565
 
575
- # Offense count: 14
566
+ # Offense count: 13
576
567
  # This cop supports safe autocorrection (--autocorrect).
577
568
  # Configuration parameters: EnforcedStyle.
578
569
  # SupportedStyles: final_newline, final_blank_line
@@ -586,7 +577,6 @@ Layout/TrailingEmptyLines:
586
577
  - 'spec/dummy/app/controllers/pets_controller.rb'
587
578
  - 'spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb'
588
579
  - 'spec/dummy/app/controllers/tagged_dogs_controller.rb'
589
- - 'spec/dummy/config/boot.rb'
590
580
  - 'spec/dummy/config/environments/development.rb'
591
581
  - 'spec/dummy/config/initializers/secret_token.rb'
592
582
  - 'spec/lib/apipie/generator/swagger/operation_id_spec.rb'
@@ -678,12 +668,6 @@ Lint/SendWithMixinArgument:
678
668
  - 'lib/apipie/routing.rb'
679
669
  - 'spec/dummy/config/application.rb'
680
670
 
681
- # Offense count: 2
682
- Lint/ShadowingOuterLocalVariable:
683
- Exclude:
684
- - 'lib/apipie/extractor/writer.rb'
685
- - 'lib/apipie/swagger_generator.rb'
686
-
687
671
  # Offense count: 4
688
672
  # This cop supports safe autocorrection (--autocorrect).
689
673
  Lint/ToJSON:
@@ -702,7 +686,7 @@ Lint/UnderscorePrefixedVariableName:
702
686
 
703
687
  # Offense count: 22
704
688
  # This cop supports safe autocorrection (--autocorrect).
705
- # Configuration parameters: AutoCorrect, IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
689
+ # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
706
690
  Lint/UnusedBlockArgument:
707
691
  Exclude:
708
692
  - 'lib/apipie/configuration.rb'
@@ -717,7 +701,8 @@ Lint/UnusedBlockArgument:
717
701
 
718
702
  # Offense count: 24
719
703
  # This cop supports safe autocorrection (--autocorrect).
720
- # Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
704
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
705
+ # NotImplementedExceptions: NotImplementedError
721
706
  Lint/UnusedMethodArgument:
722
707
  Exclude:
723
708
  - 'lib/apipie/dsl_definition.rb'
@@ -727,8 +712,7 @@ Lint/UnusedMethodArgument:
727
712
  - 'spec/support/custom_bool_validator.rb'
728
713
 
729
714
  # Offense count: 5
730
- # This cop supports unsafe autocorrection (--autocorrect-all).
731
- # Configuration parameters: AutoCorrect.
715
+ # This cop supports safe autocorrection (--autocorrect).
732
716
  Lint/UselessAssignment:
733
717
  Exclude:
734
718
  - 'lib/apipie/application.rb'
@@ -736,35 +720,22 @@ Lint/UselessAssignment:
736
720
  - 'lib/apipie/method_description.rb'
737
721
  - 'spec/controllers/api/v1/architectures_controller_spec.rb'
738
722
 
739
- # Offense count: 2
740
- # This cop supports unsafe autocorrection (--autocorrect-all).
741
- # Configuration parameters: AutoCorrect.
742
- Lint/UselessMethodDefinition:
743
- Exclude:
744
- - 'spec/dummy/app/controllers/overridden_concerns_controller.rb'
745
-
746
- # Offense count: 4
723
+ # Offense count: 3
747
724
  # This cop supports safe autocorrection (--autocorrect).
748
- # Configuration parameters: AutoCorrect, CheckForMethodsWithNoSideEffects.
725
+ # Configuration parameters: CheckForMethodsWithNoSideEffects.
749
726
  Lint/Void:
750
727
  Exclude:
751
728
  - 'spec/controllers/users_controller_spec.rb'
752
- - 'spec/lib/swagger/swagger_dsl_spec.rb'
753
729
 
754
730
  # Offense count: 60
755
731
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
756
732
  Metrics/AbcSize:
757
733
  Max: 96
758
734
 
759
- # Offense count: 1
760
- # Configuration parameters: CountBlocks, CountModifierForms.
761
- Metrics/BlockNesting:
762
- Max: 4
763
-
764
735
  # Offense count: 25
765
736
  # Configuration parameters: AllowedMethods, AllowedPatterns.
766
737
  Metrics/CyclomaticComplexity:
767
- Max: 24
738
+ Max: 22
768
739
 
769
740
  # Offense count: 79
770
741
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
@@ -774,7 +745,7 @@ Metrics/MethodLength:
774
745
  # Offense count: 1
775
746
  # Configuration parameters: CountComments, CountAsOne.
776
747
  Metrics/ModuleLength:
777
- Max: 119
748
+ Max: 117
778
749
 
779
750
  # Offense count: 5
780
751
  # Configuration parameters: CountKeywordArgs.
@@ -835,13 +806,27 @@ Naming/MethodParameterName:
835
806
  - 'lib/apipie/method_description.rb'
836
807
  - 'spec/controllers/users_controller_spec.rb'
837
808
 
809
+ # Offense count: 15
810
+ # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
811
+ # AllowedMethods: call
812
+ # WaywardPredicates: infinite?, nonzero?
813
+ Naming/PredicateMethod:
814
+ Exclude:
815
+ - 'app/controllers/apipie/apipies_controller.rb'
816
+ - 'lib/apipie/response_description.rb'
817
+ - 'lib/apipie/static_dispatcher.rb'
818
+ - 'lib/apipie/validator.rb'
819
+ - 'spec/dummy/config/initializers/apipie.rb'
820
+ - 'spec/spec_helper.rb'
821
+ - 'spec/support/custom_bool_validator.rb'
822
+
838
823
  # Offense count: 7
839
- # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
840
- # NamePrefix: is_, has_, have_
841
- # ForbiddenPrefixes: is_, has_, have_
824
+ # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
825
+ # NamePrefix: is_, has_, have_, does_
826
+ # ForbiddenPrefixes: is_, has_, have_, does_
842
827
  # AllowedMethods: is_a?
843
828
  # MethodDefinitionMacros: define_method, define_singleton_method
844
- Naming/PredicateName:
829
+ Naming/PredicatePrefix:
845
830
  Exclude:
846
831
  - 'lib/apipie/param_description.rb'
847
832
  - 'lib/apipie/response_description.rb'
@@ -851,7 +836,7 @@ Naming/PredicateName:
851
836
  # Offense count: 1
852
837
  # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
853
838
  # SupportedStyles: snake_case, normalcase, non_integer
854
- # AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
839
+ # AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
855
840
  Naming/VariableNumber:
856
841
  Exclude:
857
842
  - 'spec/dummy/app/controllers/users_controller.rb'
@@ -941,7 +926,7 @@ RSpec/BeforeAfterAll:
941
926
  Exclude:
942
927
  - 'spec/controllers/users_controller_spec.rb'
943
928
 
944
- # Offense count: 54
929
+ # Offense count: 57
945
930
  # Configuration parameters: Prefixes, AllowedPatterns.
946
931
  # Prefixes: when, with, without
947
932
  RSpec/ContextWording:
@@ -991,7 +976,6 @@ RSpec/DescribedClass:
991
976
 
992
977
  # Offense count: 1
993
978
  # This cop supports unsafe autocorrection (--autocorrect-all).
994
- # Configuration parameters: AutoCorrect.
995
979
  RSpec/EmptyExampleGroup:
996
980
  Exclude:
997
981
  - 'spec/lib/apipie/generator/swagger/param_description/composite_spec.rb'
@@ -1015,7 +999,7 @@ RSpec/EmptyLineAfterHook:
1015
999
  Exclude:
1016
1000
  - 'spec/lib/apipie/apipies_controller_spec.rb'
1017
1001
 
1018
- # Offense count: 55
1002
+ # Offense count: 56
1019
1003
  # Configuration parameters: CountAsOne.
1020
1004
  RSpec/ExampleLength:
1021
1005
  Max: 85
@@ -1041,7 +1025,6 @@ RSpec/HookArgument:
1041
1025
 
1042
1026
  # Offense count: 3
1043
1027
  # This cop supports safe autocorrection (--autocorrect).
1044
- # Configuration parameters: AutoCorrect.
1045
1028
  RSpec/HooksBeforeExamples:
1046
1029
  Exclude:
1047
1030
  - 'spec/controllers/users_controller_spec.rb'
@@ -1088,12 +1071,12 @@ RSpec/MessageSpies:
1088
1071
  RSpec/MultipleExpectations:
1089
1072
  Max: 19
1090
1073
 
1091
- # Offense count: 170
1074
+ # Offense count: 176
1092
1075
  # Configuration parameters: AllowSubject.
1093
1076
  RSpec/MultipleMemoizedHelpers:
1094
1077
  Max: 15
1095
1078
 
1096
- # Offense count: 85
1079
+ # Offense count: 89
1097
1080
  # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
1098
1081
  # SupportedStyles: always, named_only
1099
1082
  RSpec/NamedSubject:
@@ -1113,7 +1096,7 @@ RSpec/NamedSubject:
1113
1096
  - 'spec/lib/swagger/rake_swagger_spec.rb'
1114
1097
  - 'spec/lib/swagger/swagger_dsl_spec.rb'
1115
1098
 
1116
- # Offense count: 99
1099
+ # Offense count: 105
1117
1100
  # Configuration parameters: AllowedGroups.
1118
1101
  RSpec/NestedGroups:
1119
1102
  Max: 6
@@ -1133,6 +1116,12 @@ RSpec/NotToNot:
1133
1116
  Exclude:
1134
1117
  - 'spec/lib/apipie/file_handler_spec.rb'
1135
1118
 
1119
+ # Offense count: 17
1120
+ # This cop supports unsafe autocorrection (--autocorrect-all).
1121
+ RSpec/Output:
1122
+ Exclude:
1123
+ - 'spec/lib/swagger/swagger_dsl_spec.rb'
1124
+
1136
1125
  # Offense count: 1
1137
1126
  RSpec/OverwritingSetup:
1138
1127
  Exclude:
@@ -1168,12 +1157,10 @@ RSpec/StubbedMock:
1168
1157
  - 'spec/lib/apipie/extractor/writer_spec.rb'
1169
1158
  - 'spec/lib/apipie/param_description_spec.rb'
1170
1159
 
1171
- # Offense count: 6
1160
+ # Offense count: 2
1172
1161
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
1173
1162
  RSpec/VerifiedDoubles:
1174
1163
  Exclude:
1175
- - 'spec/lib/apipie/apipies_controller_spec.rb'
1176
- - 'spec/lib/apipie/extractor/recorder_spec.rb'
1177
1164
  - 'spec/lib/apipie/extractor/writer_spec.rb'
1178
1165
  - 'spec/lib/validators/array_validator_spec.rb'
1179
1166
 
@@ -1182,6 +1169,24 @@ RSpec/VoidExpect:
1182
1169
  Exclude:
1183
1170
  - 'spec/lib/apipie/extractor/writer_spec.rb'
1184
1171
 
1172
+ # Offense count: 32
1173
+ # This cop supports safe autocorrection (--autocorrect).
1174
+ RSpecRails/MinitestAssertions:
1175
+ Exclude:
1176
+ - 'spec/controllers/concerns_controller_spec.rb'
1177
+ - 'spec/controllers/users_controller_spec.rb'
1178
+ - 'spec/lib/apipie/apipies_controller_spec.rb'
1179
+
1180
+ # Offense count: 3
1181
+ # This cop supports safe autocorrection (--autocorrect).
1182
+ # Configuration parameters: ExpectedOrder.
1183
+ # ExpectedOrder: index, show, new, edit, create, update, destroy
1184
+ Rails/ActionOrder:
1185
+ Exclude:
1186
+ - 'spec/dummy/app/controllers/overridden_concerns_controller.rb'
1187
+ - 'spec/dummy/app/controllers/twitter_example_controller.rb'
1188
+ - 'spec/dummy/app/controllers/users_controller.rb'
1189
+
1185
1190
  # Offense count: 4
1186
1191
  # This cop supports unsafe autocorrection (--autocorrect-all).
1187
1192
  Rails/ApplicationController:
@@ -1198,14 +1203,13 @@ Rails/Delegate:
1198
1203
  Exclude:
1199
1204
  - 'lib/apipie/response_description_adapter.rb'
1200
1205
 
1201
- # Offense count: 25
1206
+ # Offense count: 24
1202
1207
  # This cop supports safe autocorrection (--autocorrect).
1203
1208
  # Configuration parameters: EnforcedStyle.
1204
1209
  # SupportedStyles: slashes, arguments
1205
1210
  Rails/FilePath:
1206
1211
  Exclude:
1207
1212
  - 'lib/apipie/configuration.rb'
1208
- - 'lib/apipie/dsl_definition.rb'
1209
1213
  - 'lib/tasks/apipie.rake'
1210
1214
  - 'spec/dummy/config/initializers/apipie.rb'
1211
1215
  - 'spec/lib/apipie/apipies_controller_spec.rb'
@@ -1233,15 +1237,14 @@ Rails/NegateInclude:
1233
1237
  - 'lib/apipie/extractor/writer.rb'
1234
1238
  - 'spec/spec_helper.rb'
1235
1239
 
1236
- # Offense count: 6
1240
+ # Offense count: 24
1237
1241
  # This cop supports unsafe autocorrection (--autocorrect-all).
1238
- # Configuration parameters: Include.
1239
- # Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb
1240
1242
  Rails/Output:
1241
1243
  Exclude:
1242
1244
  - 'lib/apipie/apipie_module.rb'
1243
1245
  - 'lib/apipie/extractor.rb'
1244
1246
  - 'lib/apipie/rspec/response_validation_helper.rb'
1247
+ - 'spec/lib/swagger/swagger_dsl_spec.rb'
1245
1248
 
1246
1249
  # Offense count: 2
1247
1250
  Rails/OutputSafety:
@@ -1268,8 +1271,6 @@ Rails/Present:
1268
1271
 
1269
1272
  # Offense count: 1
1270
1273
  # This cop supports unsafe autocorrection (--autocorrect-all).
1271
- # Configuration parameters: Include.
1272
- # Include: **/Rakefile, **/*.rake
1273
1274
  Rails/RakeEnvironment:
1274
1275
  Exclude:
1275
1276
  - 'lib/tasks/apipie.rake'
@@ -1318,10 +1319,12 @@ Style/CaseEquality:
1318
1319
  Exclude:
1319
1320
  - 'lib/apipie/validator.rb'
1320
1321
 
1321
- # Offense count: 43
1322
+ # Offense count: 41
1322
1323
  # This cop supports unsafe autocorrection (--autocorrect-all).
1323
- # Configuration parameters: EnforcedStyle.
1324
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForClasses, EnforcedStyleForModules.
1324
1325
  # SupportedStyles: nested, compact
1326
+ # SupportedStylesForClasses: ~, nested, compact
1327
+ # SupportedStylesForModules: ~, nested, compact
1325
1328
  Style/ClassAndModuleChildren:
1326
1329
  Exclude:
1327
1330
  - 'lib/apipie/core_ext/route.rb'
@@ -1359,7 +1362,6 @@ Style/ClassAndModuleChildren:
1359
1362
  - 'lib/apipie/method_description/api.rb'
1360
1363
  - 'lib/apipie/method_description/apis_service.rb'
1361
1364
  - 'lib/apipie/rspec/response_validation_helper.rb'
1362
- - 'spec/dummy/app/controllers/api/v2/nested/resources_controller.rb'
1363
1365
  - 'spec/dummy/config/initializers/apipie.rb'
1364
1366
  - 'spec/lib/validators/array_validator_spec.rb'
1365
1367
 
@@ -1382,6 +1384,13 @@ Style/ClassEqualityComparison:
1382
1384
  - 'lib/apipie/application.rb'
1383
1385
  - 'lib/apipie/validator.rb'
1384
1386
 
1387
+ # Offense count: 2
1388
+ # This cop supports unsafe autocorrection (--autocorrect-all).
1389
+ Style/CollectionQuerying:
1390
+ Exclude:
1391
+ - 'lib/apipie/generator/swagger/warning_writer.rb'
1392
+ - 'lib/apipie/see_description.rb'
1393
+
1385
1394
  # Offense count: 19
1386
1395
  # This cop supports safe autocorrection (--autocorrect).
1387
1396
  Style/ColonMethodCall:
@@ -1402,7 +1411,7 @@ Style/CommentAnnotation:
1402
1411
  - 'spec/lib/swagger/rake_swagger_spec.rb'
1403
1412
  - 'spec/lib/swagger/swagger_dsl_spec.rb'
1404
1413
 
1405
- # Offense count: 17
1414
+ # Offense count: 3
1406
1415
  # This cop supports unsafe autocorrection (--autocorrect-all).
1407
1416
  Style/CommentedKeyword:
1408
1417
  Exclude:
@@ -1444,7 +1453,7 @@ Style/EmptyCaseCondition:
1444
1453
 
1445
1454
  # Offense count: 3
1446
1455
  # This cop supports safe autocorrection (--autocorrect).
1447
- # Configuration parameters: AutoCorrect, EnforcedStyle, AllowComments.
1456
+ # Configuration parameters: EnforcedStyle, AllowComments.
1448
1457
  # SupportedStyles: empty, nil, both
1449
1458
  Style/EmptyElse:
1450
1459
  Exclude:
@@ -1454,7 +1463,7 @@ Style/EmptyElse:
1454
1463
 
1455
1464
  # Offense count: 27
1456
1465
  # This cop supports safe autocorrection (--autocorrect).
1457
- # Configuration parameters: AutoCorrect, EnforcedStyle.
1466
+ # Configuration parameters: EnforcedStyle.
1458
1467
  # SupportedStyles: compact, expanded
1459
1468
  Style/EmptyMethod:
1460
1469
  Exclude:
@@ -1478,11 +1487,16 @@ Style/Encoding:
1478
1487
 
1479
1488
  # Offense count: 1
1480
1489
  # This cop supports safe autocorrection (--autocorrect).
1481
- # Configuration parameters: AllowedVars.
1490
+ # Configuration parameters: AllowedVars, DefaultToNil.
1482
1491
  Style/FetchEnvVar:
1483
1492
  Exclude:
1484
1493
  - 'lib/tasks/apipie.rake'
1485
1494
 
1495
+ # Offense count: 1
1496
+ Style/FileOpen:
1497
+ Exclude:
1498
+ - 'lib/apipie/dsl_definition.rb'
1499
+
1486
1500
  # Offense count: 1
1487
1501
  # This cop supports safe autocorrection (--autocorrect).
1488
1502
  Style/FileRead:
@@ -1505,7 +1519,7 @@ Style/For:
1505
1519
 
1506
1520
  # Offense count: 7
1507
1521
  # This cop supports safe autocorrection (--autocorrect).
1508
- # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
1522
+ # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, Mode, AllowedMethods, AllowedPatterns.
1509
1523
  # SupportedStyles: annotated, template, unannotated
1510
1524
  # AllowedMethods: redirect
1511
1525
  Style/FormatStringToken:
@@ -1556,7 +1570,7 @@ Style/IfInsideElse:
1556
1570
  # Offense count: 4
1557
1571
  # This cop supports unsafe autocorrection (--autocorrect-all).
1558
1572
  # Configuration parameters: AllowedMethods.
1559
- # AllowedMethods: nonzero?
1573
+ # AllowedMethods: infinite?, nonzero?
1560
1574
  Style/IfWithBooleanLiteralBranches:
1561
1575
  Exclude:
1562
1576
  - 'lib/apipie/param_description.rb'
@@ -1597,6 +1611,12 @@ Style/MissingRespondToMissing:
1597
1611
  Exclude:
1598
1612
  - 'lib/apipie/apipie_module.rb'
1599
1613
 
1614
+ # Offense count: 1
1615
+ # This cop supports safe autocorrection (--autocorrect).
1616
+ Style/ModuleMemberExistenceCheck:
1617
+ Exclude:
1618
+ - 'lib/apipie/dsl_definition.rb'
1619
+
1600
1620
  # Offense count: 1
1601
1621
  Style/MultilineBlockChain:
1602
1622
  Exclude:
@@ -1637,6 +1657,16 @@ Style/NestedParenthesizedCalls:
1637
1657
  Style/NumericLiterals:
1638
1658
  MinDigits: 6
1639
1659
 
1660
+ # Offense count: 5
1661
+ # Configuration parameters: AllowedClasses.
1662
+ Style/OneClassPerFile:
1663
+ Exclude:
1664
+ - 'lib/apipie/core_ext/route.rb'
1665
+ - 'lib/apipie/extractor.rb'
1666
+ - 'lib/apipie/rspec/response_validation_helper.rb'
1667
+ - 'spec/dummy/app/controllers/pets_using_auto_views_controller.rb'
1668
+ - 'spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb'
1669
+
1640
1670
  # Offense count: 7
1641
1671
  # Configuration parameters: AllowedMethods.
1642
1672
  # AllowedMethods: respond_to_missing?
@@ -1687,6 +1717,12 @@ Style/RaiseArgs:
1687
1717
  - 'lib/apipie/see_description.rb'
1688
1718
  - 'lib/apipie/validator.rb'
1689
1719
 
1720
+ # Offense count: 3
1721
+ # This cop supports unsafe autocorrection (--autocorrect-all).
1722
+ Style/ReduceToHash:
1723
+ Exclude:
1724
+ - 'lib/apipie/generator/swagger/method_description/response_service.rb'
1725
+
1690
1726
  # Offense count: 1
1691
1727
  # This cop supports unsafe autocorrection (--autocorrect-all).
1692
1728
  # Configuration parameters: Methods.
@@ -1702,6 +1738,8 @@ Style/RedundantAssignment:
1702
1738
 
1703
1739
  # Offense count: 1
1704
1740
  # This cop supports safe autocorrection (--autocorrect).
1741
+ # Configuration parameters: AllowedMethods.
1742
+ # AllowedMethods: infinite?, nonzero?
1705
1743
  Style/RedundantCondition:
1706
1744
  Exclude:
1707
1745
  - 'lib/apipie/response_description.rb'
@@ -1720,11 +1758,14 @@ Style/RedundantInterpolation:
1720
1758
  - 'lib/tasks/apipie.rake'
1721
1759
  - 'spec/lib/swagger/rake_swagger_spec.rb'
1722
1760
 
1723
- # Offense count: 1
1761
+ # Offense count: 4
1724
1762
  # This cop supports safe autocorrection (--autocorrect).
1725
1763
  Style/RedundantParentheses:
1726
1764
  Exclude:
1727
1765
  - 'lib/apipie/extractor/collector.rb'
1766
+ - 'lib/apipie/param_description.rb'
1767
+ - 'lib/tasks/apipie.rake'
1768
+ - 'spec/lib/swagger/rake_swagger_spec.rb'
1728
1769
 
1729
1770
  # Offense count: 2
1730
1771
  # This cop supports safe autocorrection (--autocorrect).
@@ -1927,7 +1968,7 @@ Style/SymbolArray:
1927
1968
  # Offense count: 2
1928
1969
  # This cop supports safe autocorrection (--autocorrect).
1929
1970
  # Configuration parameters: EnforcedStyleForMultiline.
1930
- # SupportedStylesForMultiline: comma, consistent_comma, no_comma
1971
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
1931
1972
  Style/TrailingCommaInArrayLiteral:
1932
1973
  Exclude:
1933
1974
  - 'spec/controllers/users_controller_spec.rb'
@@ -1936,7 +1977,7 @@ Style/TrailingCommaInArrayLiteral:
1936
1977
  # Offense count: 4
1937
1978
  # This cop supports safe autocorrection (--autocorrect).
1938
1979
  # Configuration parameters: EnforcedStyleForMultiline.
1939
- # SupportedStylesForMultiline: comma, consistent_comma, no_comma
1980
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
1940
1981
  Style/TrailingCommaInHashLiteral:
1941
1982
  Exclude:
1942
1983
  - 'lib/apipie/generator/swagger/param_description.rb'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  Changelog
2
2
  ===========
3
+ ## [v1.5.1](https://github.com/Apipie/apipie-rails/tree/v1.5.1) (2026-06-26)
4
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.5.0...v1.5.1)
5
+ * Make rdoc.to_html compatible with rdoc-8.0 [#971](https://github.com/Apipie/apipie-rails/pull/971) (Oleh Fedorenko)
6
+ * Remove rails 8.2 deprecation warnings in `config/routes.rb`. (Panos Dalitsouris)
7
+ * Update `.rubocop_todo.yml` (Panos Dalitsouris)
8
+
9
+ ## [v1.5.0](https://github.com/Apipie/apipie-rails/tree/v1.5.0) (2025-08-19)
10
+ [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.4.2...v1.5.0)
11
+ * Don't collect records without an action (Evgeni Golov)
12
+ * Update test matrix: rails 7.2, 8.0, ruby 3.4 [#960](https://github.com/Apipie/apipie-rails/pull/960) (Evgeni Golov)
13
+ * Fix activesupport::deprecation.warn deprecation (Jonathan Biolaz)
14
+ * Rubocop autofix (Evgeni Golov)
15
+ * Update ci workflow to run on ubuntu 24.04 (Evgeni Golov)
16
+ * Fix issue with loading rails logger in tests (Eric Helms)
17
+ * Update link for rdoc in readme (Panos Dalitsouris)
18
+ * Fix the decimalvalidator header in readme.md [#945](https://github.com/Apipie/apipie-rails/pull/945) (Ewoud Kohl van Wijngaarden)
19
+ * Rename render_page in apipie.rake to render_apipie_page [#943](https://github.com/Apipie/apipie-rails/pull/943) (Nathan Palmer)
20
+ * Update it.yml following latest en.yml [#942](https://github.com/Apipie/apipie-rails/pull/942) (Claudio Maradonna)
21
+
3
22
 
4
23
  ## [v1.4.2](https://github.com/Apipie/apipie-rails/tree/v1.4.2) (2024-07-20)
5
24
  [Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.4.1...v1.4.2)
data/README.md CHANGED
@@ -1401,7 +1401,7 @@ param :product_id, :number, :desc => "Identifier of the product", :required => t
1401
1401
  param :quantity, :number, :desc => "Number of products to order", :required => true
1402
1402
  ```
1403
1403
 
1404
- DecimalValidator \-\-\-\-\-\-\-\-\-\-\-\-\--
1404
+ ## DecimalValidator
1405
1405
 
1406
1406
  Check if the parameter is a decimal number
1407
1407
 
@@ -1599,7 +1599,7 @@ default version is used instead.
1599
1599
  # Markup
1600
1600
 
1601
1601
  The default markup language is
1602
- [RDoc](https://rdoc.github.io/rdoc/RDoc/Markup.html). It can be changed
1602
+ [RDoc](https://ruby.github.io/rdoc/RDoc/Markup.html). It can be changed
1603
1603
  in the config file (`config.markup=`) to one of these:
1604
1604
 
1605
1605
  Markdown
@@ -15,6 +15,7 @@ it:
15
15
  required: richiesto
16
16
  optional: opzionale
17
17
  nil_allowed: consentito nil
18
+ blank_allowed: consentito vuoto
18
19
  param_name: Nome parametro
19
20
  params: Parametri
20
21
  examples: Esempi
@@ -29,3 +30,12 @@ it:
29
30
  api_documentation: Documentazione API
30
31
  headers: Header
31
32
  header_name: Nome Header
33
+ code: Codice
34
+ returns: Ritorno
35
+ deprecated: Deprecato
36
+ deprecation_details: Dettagli di deprecazione
37
+ deprecation:
38
+ attributes:
39
+ deprecated_in: Deprecato il
40
+ sunset_at: Rimozione il
41
+ info: Informazioni
@@ -271,10 +271,7 @@ module Apipie
271
271
  .json_schema_for_method_response(method, return_code, allow_nulls)
272
272
  end
273
273
 
274
- def json_schema_for_self_describing_class(cls, allow_nulls)
275
- Apipie::SwaggerGenerator
276
- .json_schema_for_self_describing_class(cls, allow_nulls)
277
- end
274
+ delegate :json_schema_for_self_describing_class, to: :'Apipie::SwaggerGenerator'
278
275
 
279
276
  def to_swagger_json(version, resource_id, method_name, language, clear_warnings = false)
280
277
  return unless valid_search_args?(version, resource_id, method_name)
@@ -380,7 +377,7 @@ module Apipie
380
377
 
381
378
  # @deprecated Use {#get_resource_id} instead
382
379
  def get_resource_name(klass)
383
- ActiveSupport::Deprecation.warn(
380
+ ActiveSupport::Deprecation.new('2.0', 'apipie-rails').warn(
384
381
  <<~HEREDOC
385
382
  Apipie::Application.get_resource_name is deprecated.
386
383
  Use `Apipie::Application.get_resource_id instead.
@@ -230,63 +230,61 @@ module Apipie
230
230
  def _apipie_define_validators(description)
231
231
 
232
232
  # [re]define method only if validation is turned on
233
- if description && (Apipie.configuration.validate == true ||
234
- Apipie.configuration.validate == :implicitly ||
235
- Apipie.configuration.validate == :explicitly)
236
-
237
- _apipie_save_method_params(description.method, description.params)
238
-
239
- unless instance_methods.include?(:apipie_validations)
240
- define_method(:apipie_validations) do
241
- method_params = self.class._apipie_get_method_params(action_name)
242
-
243
- if Apipie.configuration.validate_presence?
244
- Validator::BaseValidator.raise_if_missing_params do |missing|
245
- method_params.each_value do |param|
246
- # check if required parameters are present
247
- missing << param if param.required && !params.key?(param.name)
248
- end
249
- end
250
- end
233
+ return unless description && [true, :implicitly, :explicitly].include?(Apipie.configuration.validate)
234
+
235
+ _apipie_save_method_params(description.method, description.params)
251
236
 
252
- if Apipie.configuration.validate_value?
237
+ unless instance_methods.include?(:apipie_validations)
238
+ define_method(:apipie_validations) do
239
+ method_params = self.class._apipie_get_method_params(action_name)
240
+
241
+ if Apipie.configuration.validate_presence?
242
+ Validator::BaseValidator.raise_if_missing_params do |missing|
253
243
  method_params.each_value do |param|
254
- # params validations
255
- param.validate(params[:"#{param.name}"]) if params.key?(param.name)
244
+ # check if required parameters are present
245
+ missing << param if param.required && !params.key?(param.name)
256
246
  end
257
247
  end
248
+ end
258
249
 
259
- # Only allow params passed in that are defined keys in the api
260
- # Auto skip the default params (format, controller, action)
261
- if Apipie.configuration.validate_key?
262
- params.reject{|k,_| %w[format controller action].include?(k.to_s) }.each_pair do |param, _|
263
- # params allowed
264
- if method_params.none? {|_,p| p.name.to_s == param.to_s}
265
- self.class._apipie_handle_validate_key_error params, param
266
- end
267
- end
250
+ if Apipie.configuration.validate_value?
251
+ method_params.each_value do |param|
252
+ # params validations
253
+ param.validate(params[:"#{param.name}"]) if params.key?(param.name)
268
254
  end
255
+ end
269
256
 
270
- return unless Apipie.configuration.process_value?
271
- @api_params ||= {}
272
- method_params.each_value do |param|
273
- # params processing
274
- @api_params[param.as] = param.process_value(params[:"#{param.name}"]) if params.key?(param.name)
257
+ # Only allow params passed in that are defined keys in the api
258
+ # Auto skip the default params (format, controller, action)
259
+ if Apipie.configuration.validate_key?
260
+ params.reject{|k,_| %w[format controller action].include?(k.to_s) }.each_pair do |param, _|
261
+ # params allowed
262
+ if method_params.none? {|_,p| p.name.to_s == param.to_s}
263
+ self.class._apipie_handle_validate_key_error params, param
264
+ end
275
265
  end
276
266
  end
267
+
268
+ return unless Apipie.configuration.process_value?
269
+ @api_params ||= {}
270
+ method_params.each_value do |param|
271
+ # params processing
272
+ @api_params[param.as] = param.process_value(params[:"#{param.name}"]) if params.key?(param.name)
273
+ end
277
274
  end
275
+ end
278
276
 
279
- if Apipie.configuration.validate == :implicitly || Apipie.configuration.validate == true
280
- old_method = instance_method(description.method)
277
+ return unless [:implicitly, true].include?(Apipie.configuration.validate)
278
+ old_method = instance_method(description.method)
281
279
 
282
- define_method(description.method) do |*args|
283
- apipie_validations
280
+ define_method(description.method) do |*args|
281
+ apipie_validations
284
282
 
285
- # run the original method code
286
- old_method.bind(self).call(*args)
287
- end
288
- end
283
+ # run the original method code
284
+ old_method.bind(self).call(*args)
289
285
  end
286
+
287
+
290
288
  end
291
289
 
292
290
  def _apipie_handle_validate_key_error params, param
@@ -18,6 +18,7 @@ module Apipie
18
18
 
19
19
  def ignore_call?(record)
20
20
  return true unless record[:controller]
21
+ return true unless record[:action]
21
22
  return true if @ignored.include?(record[:controller].name)
22
23
  return true if @ignored.include?("#{Apipie.get_resource_id(record[:controller].name)}##{record[:action]}")
23
24
  return true unless @api_controllers_paths.include?(controller_full_path(record[:controller]))
@@ -54,9 +54,7 @@ module Apipie
54
54
  end
55
55
  end
56
56
 
57
- def logger
58
- Rails.logger
59
- end
57
+ delegate :logger, to: :Rails
60
58
 
61
59
  def call_recorder
62
60
  Thread.current[:apipie_call_recorder] ||= Recorder.new
@@ -17,7 +17,7 @@ module Apipie
17
17
  CONFIG_ATTRIBUTES.each do |attribute|
18
18
  old_setter_method = "swagger_#{attribute}="
19
19
  define_method(old_setter_method) do |value|
20
- ActiveSupport::Deprecation.warn(
20
+ ActiveSupport::Deprecation.new('2.0', 'apipie-rails').warn(
21
21
  <<~HEREDOC
22
22
  config.#{old_setter_method}#{value} is deprecated.
23
23
  config.generator.swagger.#{attribute} instead.
@@ -29,7 +29,7 @@ module Apipie
29
29
 
30
30
  old_setter_method = "swagger_#{attribute}"
31
31
  define_method(old_setter_method) do
32
- ActiveSupport::Deprecation.warn(
32
+ ActiveSupport::Deprecation.new('2.0', 'apipie-rails').warn(
33
33
  <<~HEREDOC
34
34
  config.#{old_setter_method} is deprecated.
35
35
  Use config.generator.swagger.#{attribute} instead.
data/lib/apipie/markup.rb CHANGED
@@ -16,10 +16,11 @@ module Apipie
16
16
  private
17
17
 
18
18
  def rdoc
19
- if Gem::Version.new(::RDoc::VERSION) < Gem::Version.new('4.0.0')
20
- ::RDoc::Markup::ToHtml.new()
21
- else
19
+ rdoc_version = Gem::Version.new(::RDoc::VERSION)
20
+ if rdoc_version >= Gem::Version.new('4.0.0') && rdoc_version < Gem::Version.new('8.0.0')
22
21
  ::RDoc::Markup::ToHtml.new(::RDoc::Options.new)
22
+ else
23
+ ::RDoc::Markup::ToHtml.new()
23
24
  end
24
25
  end
25
26
  end
@@ -87,7 +87,7 @@ module Apipie
87
87
  action_awareness
88
88
 
89
89
  if validator
90
- if (validator != Hash) && (validator.is_a? Hash) && (validator[:array_of])
90
+ if (validator != Hash) && (validator.is_a? Hash) && validator[:array_of]
91
91
  @is_array = true
92
92
  validator = validator[:array_of]
93
93
  raise "an ':array_of =>' validator is allowed exclusively on response-only fields" unless @response_only
@@ -119,17 +119,13 @@ module Apipie
119
119
  @is_array_of != false
120
120
  end
121
121
 
122
- def typename
123
- @response_object.typename
124
- end
122
+ delegate :typename, to: :@response_object
125
123
 
126
124
  def param_description
127
125
  nil
128
126
  end
129
127
 
130
- def params_ordered
131
- @response_object.params_ordered
132
- end
128
+ delegate :params_ordered, to: :@response_object
133
129
 
134
130
  def additional_properties
135
131
  !!@response_object.additional_properties
@@ -5,7 +5,7 @@ module Apipie
5
5
  namespace "apipie", :path => Apipie.configuration.doc_base_url do
6
6
  get 'apipie_checksum', :to => "apipies#apipie_checksum", :format => "json"
7
7
  constraints(:version => %r{[^/]+}, :resource => %r{[^/]+}, :method => %r{[^/]+}) do
8
- get(options.reverse_merge("(:version)/(:resource)/(:method)" => "apipies#index", :as => :apipie))
8
+ get "(:version)/(:resource)/(:method)", **options.reverse_merge(to: "apipies#index", as: :apipie)
9
9
  end
10
10
  end
11
11
  end
@@ -30,9 +30,7 @@ module Apipie
30
30
  end
31
31
  end
32
32
 
33
- def call(env)
34
- @file_server.call(env)
35
- end
33
+ delegate :call, to: :@file_server
36
34
 
37
35
  def ext
38
36
  @ext ||= begin
@@ -431,9 +431,7 @@ module Apipie
431
431
 
432
432
  class DecimalValidator < BaseValidator
433
433
 
434
- def validate(value)
435
- self.class.validate(value)
436
- end
434
+ delegate :validate, to: :class
437
435
 
438
436
  def self.build(param_description, argument, options, block)
439
437
  if argument == :decimal
@@ -456,9 +454,7 @@ module Apipie
456
454
 
457
455
  class NumberValidator < BaseValidator
458
456
 
459
- def validate(value)
460
- self.class.validate(value)
461
- end
457
+ delegate :validate, to: :class
462
458
 
463
459
  def self.build(param_description, argument, options, block)
464
460
  if argument == :number
@@ -549,9 +545,7 @@ module Apipie
549
545
  "Must be an Array of nested elements"
550
546
  end
551
547
 
552
- def params_ordered
553
- @validator.params_ordered
554
- end
548
+ delegate :params_ordered, to: :@validator
555
549
  end
556
550
 
557
551
  end
@@ -1,3 +1,3 @@
1
1
  module Apipie
2
- VERSION = "1.4.2".freeze
2
+ VERSION = "1.5.1".freeze
3
3
  end
@@ -182,7 +182,7 @@ namespace :apipie do
182
182
  return @apipie_renderer
183
183
  end
184
184
 
185
- def render_page(file_name, template, variables, layout = 'apipie')
185
+ def render_apipie_page(file_name, template, variables, layout = 'apipie')
186
186
  av = renderer
187
187
  File.open(file_name, "w") do |f|
188
188
  variables.each do |var, val|
@@ -238,21 +238,21 @@ namespace :apipie do
238
238
  def generate_one_page(file_base, doc, lang = nil)
239
239
  FileUtils.mkdir_p(File.dirname(file_base)) unless File.exist?(File.dirname(file_base))
240
240
 
241
- render_page("#{file_base}-onepage#{lang_ext(lang)}.html", "static", {:doc => doc[:docs],
241
+ render_apipie_page("#{file_base}-onepage#{lang_ext(lang)}.html", "static", {:doc => doc[:docs],
242
242
  :language => lang, :languages => Apipie.configuration.languages})
243
243
  end
244
244
 
245
245
  def generate_plain_page(file_base, doc, lang = nil)
246
246
  FileUtils.mkdir_p(File.dirname(file_base)) unless File.exist?(File.dirname(file_base))
247
247
 
248
- render_page("#{file_base}-plain#{lang_ext(lang)}.html", "plain", {:doc => doc[:docs],
248
+ render_apipie_page("#{file_base}-plain#{lang_ext(lang)}.html", "plain", {:doc => doc[:docs],
249
249
  :language => lang, :languages => Apipie.configuration.languages}, nil)
250
250
  end
251
251
 
252
252
  def generate_index_page(file_base, doc, include_json = false, show_versions = false, lang = nil)
253
253
  FileUtils.mkdir_p(File.dirname(file_base)) unless File.exist?(File.dirname(file_base))
254
254
  versions = show_versions && Apipie.available_versions
255
- render_page("#{file_base}#{lang_ext(lang)}.html", "index", {:doc => doc[:docs],
255
+ render_apipie_page("#{file_base}#{lang_ext(lang)}.html", "index", {:doc => doc[:docs],
256
256
  :versions => versions, :language => lang, :languages => Apipie.configuration.languages})
257
257
 
258
258
  File.open("#{file_base}#{lang_ext(lang)}.json", "w") { |f| f << doc.to_json } if include_json
@@ -265,7 +265,7 @@ namespace :apipie do
265
265
 
266
266
  doc = Apipie.to_json(version, resource_id, nil, lang)
267
267
  doc[:docs][:link_extension] = (lang ? ".#{lang}.html" : ".html")
268
- render_page("#{resource_file_base}#{lang_ext(lang)}.html", "resource", {:doc => doc[:docs],
268
+ render_apipie_page("#{resource_file_base}#{lang_ext(lang)}.html", "resource", {:doc => doc[:docs],
269
269
  :resource => doc[:docs][:resources].first, :language => lang, :languages => Apipie.configuration.languages})
270
270
  File.open("#{resource_file_base}#{lang_ext(lang)}.json", "w") { |f| f << doc.to_json } if include_json
271
271
  end
@@ -279,7 +279,7 @@ namespace :apipie do
279
279
 
280
280
  doc = Apipie.to_json(version, resource_id, method[:name], lang)
281
281
  doc[:docs][:link_extension] = (lang ? ".#{lang}.html" : ".html")
282
- render_page("#{method_file_base}#{lang_ext(lang)}.html", "method", {:doc => doc[:docs],
282
+ render_apipie_page("#{method_file_base}#{lang_ext(lang)}.html", "method", {:doc => doc[:docs],
283
283
  :resource => doc[:docs][:resources].first,
284
284
  :method => doc[:docs][:resources].first[:methods].first,
285
285
  :language => lang,
@@ -7,4 +7,6 @@ if File.exist?(gemfile)
7
7
  Bundler.setup
8
8
  end
9
9
 
10
- $:.unshift File.expand_path('../../../lib', __dir__)
10
+ $:.unshift File.expand_path('../../../lib', __dir__)
11
+
12
+ require 'logger' # Fix concurrent-ruby removing logger dependency which Rails itself does not have
@@ -10,7 +10,13 @@ describe Apipie::Extractor::Collector do
10
10
 
11
11
  let(:record) { { controller: controller, action: action } }
12
12
  let(:controller) { ActionController::Base }
13
- let(:action) { nil }
13
+ let(:action) { 'index' }
14
+
15
+ context 'when action is nil' do
16
+ let(:action) { nil }
17
+
18
+ it { is_expected.to be true }
19
+ end
14
20
 
15
21
  context 'when controller is nil' do
16
22
  let(:controller) { nil }
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Apipie::Routing::MapperExtensions do
4
+ let(:routes) { ActionDispatch::Routing::RouteSet.new }
5
+ let(:version) { 'v1' }
6
+ let(:resource) { 'users' }
7
+ let(:api_method) { 'show' }
8
+ let(:path) { "/apidoc/#{version}/#{resource}/#{api_method}" }
9
+
10
+ describe '#apipie' do
11
+ before { routes.draw { apipie } }
12
+
13
+ it 'preserves the default route helper and mapping', :aggregate_failures do
14
+ expect(routes.url_helpers.apipie_apipie_path(version: version, resource: resource, method: api_method)).to eq(path)
15
+
16
+ expect(routes.recognize_path(path, method: :get)).to include(
17
+ controller: 'apipie/apipies',
18
+ action: 'index',
19
+ version: version,
20
+ resource: resource,
21
+ method: api_method
22
+ )
23
+ end
24
+ end
25
+ end
data/spec/spec_helper.rb CHANGED
@@ -38,7 +38,7 @@ RSpec::Matchers.define :have_field do |name, type, opts = {}|
38
38
 
39
39
  match do |unresolved|
40
40
  actual = resolve_refs(unresolved)
41
- return fail("expected schema to have type 'object' (got '#{actual[:type]}')") if (actual[:type]) != 'object'
41
+ return fail("expected schema to have type 'object' (got '#{actual[:type]}')") if actual[:type] != 'object'
42
42
  return fail("expected schema to include param named '#{name}' (got #{actual[:properties].keys})") if (prop = actual[:properties][name]).nil?
43
43
  return fail("expected param '#{name}' to have type '#{type}' (got '#{prop[:type]}')") if prop[:type] != type
44
44
  return fail("expected param '#{name}' to have description '#{opts[:description]}' (got '#{prop[:description]}')") if opts[:description] && prop[:description] != opts[:description]
data/spec/support/rake.rb CHANGED
@@ -6,6 +6,7 @@ shared_context "rake" do
6
6
  let(:task_name) { rake.parse_task_string(self.class.description).first }
7
7
  let(:task_args) { rake.parse_task_string(self.class.description).last }
8
8
  let(:task_path) { "lib/tasks/apipie" }
9
+
9
10
  subject { rake[task_name] }
10
11
 
11
12
  def loaded_files_excluding_current_rake_file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apipie-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Pokorny
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-07-20 00:00:00.000000000 Z
12
+ date: 2026-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -460,6 +460,7 @@ files:
460
460
  - spec/lib/apipie/response_description/response_object_spec.rb
461
461
  - spec/lib/apipie/response_description_spec.rb
462
462
  - spec/lib/apipie/response_does_not_match_swagger_schema_spec.rb
463
+ - spec/lib/apipie/routing/mapper_extensions_spec.rb
463
464
  - spec/lib/apipie/swagger_generator_spec.rb
464
465
  - spec/lib/apipie/validator_spec.rb
465
466
  - spec/lib/rake_spec.rb
@@ -492,7 +493,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
492
493
  - !ruby/object:Gem::Version
493
494
  version: '0'
494
495
  requirements: []
495
- rubygems_version: 3.5.11
496
+ rubygems_version: 3.2.33
496
497
  signing_key:
497
498
  specification_version: 4
498
499
  summary: Rails REST API documentation tool
@@ -606,6 +607,7 @@ test_files:
606
607
  - spec/lib/apipie/response_description/response_object_spec.rb
607
608
  - spec/lib/apipie/response_description_spec.rb
608
609
  - spec/lib/apipie/response_does_not_match_swagger_schema_spec.rb
610
+ - spec/lib/apipie/routing/mapper_extensions_spec.rb
609
611
  - spec/lib/apipie/swagger_generator_spec.rb
610
612
  - spec/lib/apipie/validator_spec.rb
611
613
  - spec/lib/rake_spec.rb