apipie-rails 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +22 -99
- data/CHANGELOG.md +11 -0
- data/apipie-rails.gemspec +1 -0
- data/lib/apipie/error_description.rb +7 -5
- data/lib/apipie/extractor/recorder.rb +3 -3
- data/lib/apipie/extractor/writer.rb +6 -6
- data/lib/apipie/generator/swagger/param_description/in.rb +1 -1
- data/lib/apipie/generator/swagger/type_extractor.rb +1 -1
- data/lib/apipie/generator/swagger/warning.rb +2 -2
- data/lib/apipie/helpers.rb +1 -1
- data/lib/apipie/response_description.rb +10 -5
- data/lib/apipie/routes_formatter.rb +1 -1
- data/lib/apipie/version.rb +1 -1
- data/lib/tasks/apipie.rake +4 -4
- data/spec/controllers/api/v1/architectures_controller_spec.rb +3 -3
- data/spec/controllers/api/v2/nested/resources_controller_spec.rb +1 -1
- data/spec/controllers/concerns_controller_spec.rb +2 -2
- data/spec/controllers/extended_controller_spec.rb +2 -2
- data/spec/controllers/included_param_group_controller_spec.rb +1 -1
- data/spec/controllers/users_controller_spec.rb +64 -63
- data/spec/dummy/app/controllers/extending_concern.rb +7 -7
- data/spec/dummy/app/controllers/pets_controller.rb +4 -4
- data/spec/dummy/app/controllers/pets_using_auto_views_controller.rb +2 -2
- data/spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb +16 -16
- data/spec/dummy/app/controllers/sample_controller.rb +31 -31
- data/spec/lib/apipie/application_spec.rb +2 -2
- data/spec/lib/apipie/extractor/writer_spec.rb +8 -8
- data/spec/lib/apipie/method_description_spec.rb +2 -2
- data/spec/lib/apipie/param_description_spec.rb +47 -47
- data/spec/lib/apipie/param_group_spec.rb +4 -4
- data/spec/lib/apipie/resource_description_spec.rb +2 -2
- data/spec/lib/apipie/validator_spec.rb +12 -12
- data/spec/lib/swagger/swagger_dsl_spec.rb +40 -40
- data/spec/test_engine/memes_controller_spec.rb +1 -1
- metadata +138 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4cb2ed68221a7fd10e07cf119bf3084189ef41b3609530827e026896d0ebee7
|
4
|
+
data.tar.gz: f225bc005c87046b5a2018f7294e9a3c1f387ac60bb9a73d295bb2c97b96b6b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b25a40e9f115f20a9c9faf2e5fbf13322b1960bef8182d6b797f67cf8ec3bbefa1afe17fc3b91bff520e4b53252837ca44c34740743002a02b7e75a3aaf793c
|
7
|
+
data.tar.gz: a20b72f7e53d2051d2a6bcad867c13ddad70256d4be012f5bbf711c177eb4ab5b0de930c23f0af2ace3c317d49d32dbef06e4c3c9d754c3a5d462031c9986e8d
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config --exclude-limit
|
3
|
-
# on
|
2
|
+
# `rubocop --auto-gen-config --exclude-limit 180`
|
3
|
+
# on 2024-02-19 23:31:58 UTC using RuboCop version 1.60.2.
|
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
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
+
RubyVersionGlobalsUsage:
|
10
|
+
Exclude:
|
11
|
+
- apipie-rails.gemspec
|
12
|
+
|
9
13
|
# Offense count: 1
|
10
14
|
# This cop supports safe autocorrection (--autocorrect).
|
11
15
|
# Configuration parameters: Severity, Include.
|
@@ -154,7 +158,7 @@ Layout/EmptyLineBetweenDefs:
|
|
154
158
|
- 'spec/dummy/app/controllers/pets_using_auto_views_controller.rb'
|
155
159
|
- 'spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb'
|
156
160
|
|
157
|
-
# Offense count:
|
161
|
+
# Offense count: 55
|
158
162
|
# This cop supports safe autocorrection (--autocorrect).
|
159
163
|
Layout/EmptyLines:
|
160
164
|
Exclude:
|
@@ -192,7 +196,7 @@ Layout/EmptyLinesAroundAttributeAccessor:
|
|
192
196
|
Exclude:
|
193
197
|
- 'lib/apipie/configuration.rb'
|
194
198
|
|
195
|
-
# Offense count:
|
199
|
+
# Offense count: 91
|
196
200
|
# This cop supports safe autocorrection (--autocorrect).
|
197
201
|
# Configuration parameters: EnforcedStyle.
|
198
202
|
# SupportedStyles: empty_lines, no_empty_lines
|
@@ -213,7 +217,6 @@ Layout/EmptyLinesAroundBlockBody:
|
|
213
217
|
- 'spec/lib/apipie/extractor/writer_spec.rb'
|
214
218
|
- 'spec/lib/apipie/file_handler_spec.rb'
|
215
219
|
- 'spec/lib/apipie/generator/swagger/param_description/composite_spec.rb'
|
216
|
-
- 'spec/lib/apipie/generator/swagger/param_description/type_spec.rb'
|
217
220
|
- 'spec/lib/apipie/param_description_spec.rb'
|
218
221
|
- 'spec/lib/apipie/param_group_spec.rb'
|
219
222
|
- 'spec/lib/apipie/validator_spec.rb'
|
@@ -314,15 +317,6 @@ Layout/ExtraSpacing:
|
|
314
317
|
- 'spec/lib/apipie/generator/swagger/param_description/type_spec.rb'
|
315
318
|
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
316
319
|
|
317
|
-
# Offense count: 9
|
318
|
-
# This cop supports safe autocorrection (--autocorrect).
|
319
|
-
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
320
|
-
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
|
321
|
-
Layout/FirstArrayElementIndentation:
|
322
|
-
Exclude:
|
323
|
-
- 'spec/dummy/app/controllers/pets_controller.rb'
|
324
|
-
- 'spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb'
|
325
|
-
|
326
320
|
# Offense count: 38
|
327
321
|
# This cop supports safe autocorrection (--autocorrect).
|
328
322
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
@@ -387,13 +381,6 @@ Layout/IndentationWidth:
|
|
387
381
|
- 'lib/apipie/resource_description.rb'
|
388
382
|
- 'lib/tasks/apipie.rake'
|
389
383
|
|
390
|
-
# Offense count: 2
|
391
|
-
# This cop supports safe autocorrection (--autocorrect).
|
392
|
-
Layout/InitialIndentation:
|
393
|
-
Exclude:
|
394
|
-
- 'spec/dummy/app/controllers/extending_concern.rb'
|
395
|
-
- 'spec/dummy/app/controllers/sample_controller.rb'
|
396
|
-
|
397
384
|
# Offense count: 15
|
398
385
|
# This cop supports safe autocorrection (--autocorrect).
|
399
386
|
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
|
@@ -454,7 +441,7 @@ Layout/SpaceAfterColon:
|
|
454
441
|
Exclude:
|
455
442
|
- 'spec/dummy/app/controllers/included_param_group_controller.rb'
|
456
443
|
|
457
|
-
# Offense count:
|
444
|
+
# Offense count: 41
|
458
445
|
# This cop supports safe autocorrection (--autocorrect).
|
459
446
|
Layout/SpaceAfterComma:
|
460
447
|
Exclude:
|
@@ -490,8 +477,9 @@ Layout/SpaceAfterNot:
|
|
490
477
|
|
491
478
|
# Offense count: 142
|
492
479
|
# This cop supports safe autocorrection (--autocorrect).
|
493
|
-
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
480
|
+
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals.
|
494
481
|
# SupportedStylesForExponentOperator: space, no_space
|
482
|
+
# SupportedStylesForRationalLiterals: space, no_space
|
495
483
|
Layout/SpaceAroundOperators:
|
496
484
|
Exclude:
|
497
485
|
- 'app/controllers/apipie/apipies_controller.rb'
|
@@ -505,7 +493,7 @@ Layout/SpaceAroundOperators:
|
|
505
493
|
- 'spec/lib/swagger/rake_swagger_spec.rb'
|
506
494
|
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
507
495
|
|
508
|
-
# Offense count:
|
496
|
+
# Offense count: 29
|
509
497
|
# This cop supports safe autocorrection (--autocorrect).
|
510
498
|
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
511
499
|
# SupportedStyles: space, no_space
|
@@ -518,9 +506,6 @@ Layout/SpaceBeforeBlockBraces:
|
|
518
506
|
- 'lib/apipie/param_description.rb'
|
519
507
|
- 'lib/apipie/response_description.rb'
|
520
508
|
- 'lib/apipie/routes_formatter.rb'
|
521
|
-
- 'lib/tasks/apipie.rake'
|
522
|
-
- 'spec/controllers/users_controller_spec.rb'
|
523
|
-
- 'spec/dummy/app/controllers/pets_using_auto_views_controller.rb'
|
524
509
|
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
525
510
|
|
526
511
|
# Offense count: 4
|
@@ -540,7 +525,7 @@ Layout/SpaceInsideArrayLiteralBrackets:
|
|
540
525
|
- 'lib/apipie/generator/swagger/param_description/composite.rb'
|
541
526
|
- 'spec/controllers/users_controller_spec.rb'
|
542
527
|
|
543
|
-
# Offense count:
|
528
|
+
# Offense count: 60
|
544
529
|
# This cop supports safe autocorrection (--autocorrect).
|
545
530
|
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
546
531
|
# SupportedStyles: space, no_space
|
@@ -553,9 +538,7 @@ Layout/SpaceInsideBlockBraces:
|
|
553
538
|
- 'lib/apipie/response_description.rb'
|
554
539
|
- 'lib/apipie/routes_formatter.rb'
|
555
540
|
- 'lib/apipie/validator.rb'
|
556
|
-
- 'lib/tasks/apipie.rake'
|
557
541
|
- 'spec/controllers/users_controller_spec.rb'
|
558
|
-
- 'spec/dummy/app/controllers/pets_using_auto_views_controller.rb'
|
559
542
|
- 'spec/lib/apipie/application_spec.rb'
|
560
543
|
- 'spec/lib/apipie/generator/swagger/operation_id_spec.rb'
|
561
544
|
- 'spec/lib/apipie/generator/swagger/warning_spec.rb'
|
@@ -726,21 +709,18 @@ Lint/UnderscorePrefixedVariableName:
|
|
726
709
|
- 'lib/apipie/application.rb'
|
727
710
|
- 'lib/apipie/dsl_definition.rb'
|
728
711
|
|
729
|
-
# Offense count:
|
712
|
+
# Offense count: 22
|
730
713
|
# This cop supports safe autocorrection (--autocorrect).
|
731
714
|
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
732
715
|
Lint/UnusedBlockArgument:
|
733
716
|
Exclude:
|
734
717
|
- 'lib/apipie/configuration.rb'
|
735
|
-
- 'lib/apipie/extractor/collector.rb'
|
736
|
-
- 'lib/apipie/extractor/recorder.rb'
|
737
718
|
- 'lib/apipie/param_description.rb'
|
738
719
|
- 'lib/apipie/resource_description.rb'
|
739
720
|
- 'lib/apipie/rspec/response_validation_helper.rb'
|
740
721
|
- 'lib/tasks/apipie.rake'
|
741
722
|
- 'spec/controllers/users_controller_spec.rb'
|
742
723
|
- 'spec/lib/apipie/apipies_controller_spec.rb'
|
743
|
-
- 'spec/lib/apipie/extractor_spec.rb'
|
744
724
|
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
745
725
|
- 'spec/spec_helper.rb'
|
746
726
|
|
@@ -802,7 +782,7 @@ Metrics/MethodLength:
|
|
802
782
|
Metrics/ModuleLength:
|
803
783
|
Max: 119
|
804
784
|
|
805
|
-
# Offense count:
|
785
|
+
# Offense count: 5
|
806
786
|
# Configuration parameters: CountKeywordArgs.
|
807
787
|
Metrics/ParameterLists:
|
808
788
|
MaxOptionalParameters: 5
|
@@ -917,13 +897,6 @@ Performance/RedundantMerge:
|
|
917
897
|
- 'lib/apipie/generator/swagger/param_description/type.rb'
|
918
898
|
- 'lib/apipie/middleware/checksum_in_headers.rb'
|
919
899
|
|
920
|
-
# Offense count: 7
|
921
|
-
# This cop supports safe autocorrection (--autocorrect).
|
922
|
-
Performance/RegexpMatch:
|
923
|
-
Exclude:
|
924
|
-
- 'lib/apipie/extractor/writer.rb'
|
925
|
-
- 'lib/apipie/helpers.rb'
|
926
|
-
|
927
900
|
# Offense count: 7
|
928
901
|
# This cop supports safe autocorrection (--autocorrect).
|
929
902
|
Performance/StringIdentifierArgument:
|
@@ -974,7 +947,7 @@ RSpec/BeforeAfterAll:
|
|
974
947
|
Exclude:
|
975
948
|
- 'spec/controllers/users_controller_spec.rb'
|
976
949
|
|
977
|
-
# Offense count:
|
950
|
+
# Offense count: 54
|
978
951
|
# Configuration parameters: Prefixes, AllowedPatterns.
|
979
952
|
# Prefixes: when, with, without
|
980
953
|
RSpec/ContextWording:
|
@@ -1052,28 +1025,6 @@ RSpec/EmptyLineAfterHook:
|
|
1052
1025
|
RSpec/ExampleLength:
|
1053
1026
|
Max: 85
|
1054
1027
|
|
1055
|
-
# Offense count: 159
|
1056
|
-
# This cop supports safe autocorrection (--autocorrect).
|
1057
|
-
# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples.
|
1058
|
-
# DisallowedExamples: works
|
1059
|
-
RSpec/ExampleWording:
|
1060
|
-
Exclude:
|
1061
|
-
- 'spec/controllers/api/v1/architectures_controller_spec.rb'
|
1062
|
-
- 'spec/controllers/api/v2/nested/resources_controller_spec.rb'
|
1063
|
-
- 'spec/controllers/concerns_controller_spec.rb'
|
1064
|
-
- 'spec/controllers/extended_controller_spec.rb'
|
1065
|
-
- 'spec/controllers/included_param_group_controller_spec.rb'
|
1066
|
-
- 'spec/controllers/users_controller_spec.rb'
|
1067
|
-
- 'spec/lib/apipie/application_spec.rb'
|
1068
|
-
- 'spec/lib/apipie/extractor/writer_spec.rb'
|
1069
|
-
- 'spec/lib/apipie/method_description_spec.rb'
|
1070
|
-
- 'spec/lib/apipie/param_description_spec.rb'
|
1071
|
-
- 'spec/lib/apipie/param_group_spec.rb'
|
1072
|
-
- 'spec/lib/apipie/resource_description_spec.rb'
|
1073
|
-
- 'spec/lib/apipie/validator_spec.rb'
|
1074
|
-
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
1075
|
-
- 'spec/test_engine/memes_controller_spec.rb'
|
1076
|
-
|
1077
1028
|
# Offense count: 1
|
1078
1029
|
# This cop supports safe autocorrection (--autocorrect).
|
1079
1030
|
RSpec/ExcessiveDocstringSpacing:
|
@@ -1141,7 +1092,7 @@ RSpec/MessageSpies:
|
|
1141
1092
|
RSpec/MultipleExpectations:
|
1142
1093
|
Max: 19
|
1143
1094
|
|
1144
|
-
# Offense count:
|
1095
|
+
# Offense count: 163
|
1145
1096
|
# Configuration parameters: AllowSubject.
|
1146
1097
|
RSpec/MultipleMemoizedHelpers:
|
1147
1098
|
Max: 15
|
@@ -1166,7 +1117,7 @@ RSpec/NamedSubject:
|
|
1166
1117
|
- 'spec/lib/swagger/rake_swagger_spec.rb'
|
1167
1118
|
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
1168
1119
|
|
1169
|
-
# Offense count:
|
1120
|
+
# Offense count: 97
|
1170
1121
|
# Configuration parameters: AllowedGroups.
|
1171
1122
|
RSpec/NestedGroups:
|
1172
1123
|
Max: 6
|
@@ -1208,7 +1159,7 @@ RSpec/PredicateMatcher:
|
|
1208
1159
|
# Offense count: 1
|
1209
1160
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
1210
1161
|
# Configuration parameters: Inferences.
|
1211
|
-
|
1162
|
+
RSpecRails/InferredSpecType:
|
1212
1163
|
Exclude:
|
1213
1164
|
- 'spec/controllers/pets_controller_spec.rb'
|
1214
1165
|
|
@@ -1293,7 +1244,7 @@ Rails/NegateInclude:
|
|
1293
1244
|
- 'lib/apipie/extractor/writer.rb'
|
1294
1245
|
- 'spec/spec_helper.rb'
|
1295
1246
|
|
1296
|
-
# Offense count:
|
1247
|
+
# Offense count: 6
|
1297
1248
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
1298
1249
|
# Configuration parameters: Include.
|
1299
1250
|
# Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb
|
@@ -1371,21 +1322,6 @@ Style/AndOr:
|
|
1371
1322
|
Exclude:
|
1372
1323
|
- 'lib/apipie/param_description.rb'
|
1373
1324
|
|
1374
|
-
# Offense count: 18
|
1375
|
-
# This cop supports safe autocorrection (--autocorrect).
|
1376
|
-
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
1377
|
-
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
1378
|
-
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
1379
|
-
# FunctionalMethods: let, let!, subject, watch
|
1380
|
-
# AllowedMethods: lambda, proc, it
|
1381
|
-
Style/BlockDelimiters:
|
1382
|
-
Exclude:
|
1383
|
-
- 'lib/tasks/apipie.rake'
|
1384
|
-
- 'spec/controllers/users_controller_spec.rb'
|
1385
|
-
- 'spec/dummy/app/controllers/pets_using_auto_views_controller.rb'
|
1386
|
-
- 'spec/lib/apipie/extractor/writer_spec.rb'
|
1387
|
-
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
1388
|
-
|
1389
1325
|
# Offense count: 1
|
1390
1326
|
# This cop supports safe autocorrection (--autocorrect).
|
1391
1327
|
# Configuration parameters: AllowOnConstant, AllowOnSelfClass.
|
@@ -1677,19 +1613,6 @@ Style/MultilineBlockChain:
|
|
1677
1613
|
Exclude:
|
1678
1614
|
- 'lib/apipie/param_description.rb'
|
1679
1615
|
|
1680
|
-
# Offense count: 7
|
1681
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
1682
|
-
# Configuration parameters: EnforcedStyle.
|
1683
|
-
# SupportedStyles: literals, strict
|
1684
|
-
Style/MutableConstant:
|
1685
|
-
Exclude:
|
1686
|
-
- 'lib/apipie/extractor/recorder.rb'
|
1687
|
-
- 'lib/apipie/generator/swagger/param_description/in.rb'
|
1688
|
-
- 'lib/apipie/generator/swagger/type_extractor.rb'
|
1689
|
-
- 'lib/apipie/generator/swagger/warning.rb'
|
1690
|
-
- 'lib/apipie/routes_formatter.rb'
|
1691
|
-
- 'lib/apipie/version.rb'
|
1692
|
-
|
1693
1616
|
# Offense count: 8
|
1694
1617
|
# This cop supports safe autocorrection (--autocorrect).
|
1695
1618
|
# Configuration parameters: EnforcedStyle.
|
@@ -1921,7 +1844,7 @@ Style/StringConcatenation:
|
|
1921
1844
|
- 'lib/apipie/application.rb'
|
1922
1845
|
- 'lib/apipie/extractor/writer.rb'
|
1923
1846
|
|
1924
|
-
# Offense count:
|
1847
|
+
# Offense count: 1229
|
1925
1848
|
# This cop supports safe autocorrection (--autocorrect).
|
1926
1849
|
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
1927
1850
|
# SupportedStyles: single_quotes, double_quotes
|
@@ -2021,7 +1944,7 @@ Style/TrailingCommaInArrayLiteral:
|
|
2021
1944
|
- 'spec/controllers/users_controller_spec.rb'
|
2022
1945
|
- 'spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb'
|
2023
1946
|
|
2024
|
-
# Offense count:
|
1947
|
+
# Offense count: 5
|
2025
1948
|
# This cop supports safe autocorrection (--autocorrect).
|
2026
1949
|
# Configuration parameters: EnforcedStyleForMultiline.
|
2027
1950
|
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
Changelog
|
2
2
|
===========
|
3
3
|
|
4
|
+
## [v1.4.1](https://github.com/Apipie/apipie-rails/tree/v1.4.1) (2024-07-09)
|
5
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.4.0...v1.4.1)
|
6
|
+
* Fix multiple rubocop offenses via rubocop_challenger. (Mathieu Jobin)
|
7
|
+
* RSpec/ExampleWording (#913)
|
8
|
+
* Layout/FirstArrayElementIndentation (#914)
|
9
|
+
* Style/BlockDelimiters (#917)
|
10
|
+
* Style/MutableConstant (#916)
|
11
|
+
* Layout/InitialIndentation (#915)
|
12
|
+
* Performance/RegexpMatch (#918)
|
13
|
+
* Fix CI: build green for modern ruby, rack, and rubocop-rspec (#939) (Murray Steele)
|
14
|
+
|
4
15
|
## [v1.4.0](https://github.com/Apipie/apipie-rails/tree/v1.4.0) (2024-05-30)
|
5
16
|
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.3.0...v1.4.0)
|
6
17
|
* Add Ruby 3.3.0 to CI build matrix (#906) Masato Nakamura
|
data/apipie-rails.gemspec
CHANGED
@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.add_development_dependency 'rubocop-rails'
|
39
39
|
s.add_development_dependency 'rubocop-rspec'
|
40
40
|
s.add_development_dependency 'rubocop-performance'
|
41
|
+
s.add_development_dependency 'rubocop-rspec_rails' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7")
|
41
42
|
s.add_development_dependency "simplecov"
|
42
43
|
s.add_development_dependency "sqlite3"
|
43
44
|
end
|
@@ -5,9 +5,7 @@ module Apipie
|
|
5
5
|
|
6
6
|
def self.from_dsl_data(args)
|
7
7
|
code_or_options, desc, options = args
|
8
|
-
Apipie::ErrorDescription.new(code_or_options,
|
9
|
-
desc,
|
10
|
-
options)
|
8
|
+
Apipie::ErrorDescription.new(code_or_options, desc, options)
|
11
9
|
end
|
12
10
|
|
13
11
|
def initialize(code_or_options, desc = nil, options = {})
|
@@ -17,9 +15,13 @@ module Apipie
|
|
17
15
|
@metadata = code_or_options[:meta]
|
18
16
|
@description = code_or_options[:desc] || code_or_options[:description]
|
19
17
|
else
|
20
|
-
@code =
|
18
|
+
@code =
|
21
19
|
if code_or_options.is_a? Symbol
|
22
|
-
|
20
|
+
begin
|
21
|
+
Rack::Utils.status_code(code_or_options)
|
22
|
+
rescue ArgumentError
|
23
|
+
nil
|
24
|
+
end
|
23
25
|
else
|
24
26
|
code_or_options
|
25
27
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Apipie
|
2
2
|
module Extractor
|
3
3
|
class Recorder
|
4
|
-
MULTIPART_BOUNDARY = 'APIPIE_RECORDER_EXAMPLE_BOUNDARY'
|
4
|
+
MULTIPART_BOUNDARY = 'APIPIE_RECORDER_EXAMPLE_BOUNDARY'.freeze
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@ignored_params = [:controller, :action]
|
@@ -14,12 +14,12 @@ module Apipie
|
|
14
14
|
@params = Rack::Utils.parse_nested_query(@query)
|
15
15
|
@params.merge!(env["action_dispatch.request.request_parameters"] || {})
|
16
16
|
rack_input = env["rack.input"]
|
17
|
-
if data = parse_data(rack_input
|
17
|
+
if data = parse_data(rack_input&.read)
|
18
18
|
@request_data = data
|
19
19
|
elsif form_hash = env["rack.request.form_hash"]
|
20
20
|
@request_data = reformat_multipart_data(form_hash)
|
21
21
|
end
|
22
|
-
rack_input
|
22
|
+
rack_input&.rewind
|
23
23
|
end
|
24
24
|
|
25
25
|
def analyse_controller(controller)
|
@@ -324,7 +324,7 @@ module Apipie
|
|
324
324
|
desc ||= case @action.to_s
|
325
325
|
when "show", "create", "update", "destroy"
|
326
326
|
name = name.singularize
|
327
|
-
"#{@action.capitalize} #{
|
327
|
+
"#{@action.capitalize} #{/^[aeiou]/.match?(name) ? 'an' : 'a'} #{name}"
|
328
328
|
when "index"
|
329
329
|
"List #{name}"
|
330
330
|
end
|
@@ -341,7 +341,7 @@ module Apipie
|
|
341
341
|
params.sort_by {|n,_| n }.each do |(name, desc)|
|
342
342
|
desc[:type] = (desc[:type] && desc[:type].first) || Object
|
343
343
|
code << "#{indent}param"
|
344
|
-
if
|
344
|
+
if /\W/.match?(name)
|
345
345
|
code << " :'#{name}'"
|
346
346
|
else
|
347
347
|
code << " :#{name}"
|
@@ -397,7 +397,7 @@ module Apipie
|
|
397
397
|
lines_to_add = []
|
398
398
|
block_level = 0
|
399
399
|
ensure_line_breaks(controller_content.lines).first(action_line).reverse_each do |line|
|
400
|
-
if
|
400
|
+
if /\s*\bend\b\s*/.match?(line)
|
401
401
|
block_level += 1
|
402
402
|
end
|
403
403
|
if block_level > 0
|
@@ -405,10 +405,10 @@ module Apipie
|
|
405
405
|
else
|
406
406
|
added_lines << line
|
407
407
|
end
|
408
|
-
if
|
408
|
+
if /\s*\b(module|class|def)\b /.match?(line)
|
409
409
|
break
|
410
410
|
end
|
411
|
-
next unless
|
411
|
+
next unless /do\s*(\|.*?\|)?\s*$/.match?(line)
|
412
412
|
block_level -= 1
|
413
413
|
if block_level == 0
|
414
414
|
added_lines.concat(lines_to_add)
|
@@ -426,7 +426,7 @@ module Apipie
|
|
426
426
|
# https://github.com/puppetlabs/puppet/blob/0dc44695/lib/puppet/util/monkey_patches.rb
|
427
427
|
def ensure_line_breaks(lines)
|
428
428
|
if lines.to_a.size > 1 && lines.first !~ /\n\Z/
|
429
|
-
lines.map { |l|
|
429
|
+
lines.map { |l| !/\n\Z/.match?(l) ? (l << "\n") : l }.to_enum
|
430
430
|
else
|
431
431
|
lines
|
432
432
|
end
|
@@ -18,7 +18,7 @@ class Apipie::Generator::Swagger::TypeExtractor
|
|
18
18
|
date: Apipie::Generator::Swagger::Type.new('string', 'date'),
|
19
19
|
dateTime: Apipie::Generator::Swagger::Type.new('string', 'date-time'),
|
20
20
|
password: Apipie::Generator::Swagger::Type.new('string', 'password')
|
21
|
-
}
|
21
|
+
}.freeze
|
22
22
|
|
23
23
|
# @param [Apipie::Validator::BaseValidator, ResponseDescriptionAdapter::PropDesc::Validator, nil] validator
|
24
24
|
def initialize(validator)
|
@@ -17,7 +17,7 @@ class Apipie::Generator::Swagger::Warning
|
|
17
17
|
optional_without_default_value: OPTIONAL_WITHOUT_DEFAULT_VALUE_CODE,
|
18
18
|
param_ignored_in_form_data: PARAM_IGNORED_IN_FORM_DATA_CODE,
|
19
19
|
path_param_not_described_code: PATH_PARAM_NOT_DESCRIBED_CODE
|
20
|
-
}
|
20
|
+
}.freeze
|
21
21
|
|
22
22
|
MESSAGES = {
|
23
23
|
MISSING_METHOD_SUMMARY_CODE => "Missing short description for method",
|
@@ -28,7 +28,7 @@ class Apipie::Generator::Swagger::Warning
|
|
28
28
|
OPTIONAL_WITHOUT_DEFAULT_VALUE_CODE => "The parameter :%{parameter} is optional but default value is not specified (use :default_value => ...)",
|
29
29
|
PARAM_IGNORED_IN_FORM_DATA_CODE => "Ignoring param :%{parameter} -- cannot include Hash without fields in a formData specification",
|
30
30
|
PATH_PARAM_NOT_DESCRIBED_CODE => "The parameter :%{name} appears in the path %{path} but is not described"
|
31
|
-
}
|
31
|
+
}.freeze
|
32
32
|
|
33
33
|
attr_reader :code
|
34
34
|
|
data/lib/apipie/helpers.rb
CHANGED
@@ -88,11 +88,16 @@ module Apipie
|
|
88
88
|
|
89
89
|
@method_description = method_description
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
91
|
+
@code =
|
92
|
+
if code.is_a? Symbol
|
93
|
+
begin
|
94
|
+
Rack::Utils.status_code(code)
|
95
|
+
rescue ArgumentError
|
96
|
+
nil
|
97
|
+
end
|
98
|
+
else
|
99
|
+
code
|
100
|
+
end
|
96
101
|
|
97
102
|
@description = options[:desc]
|
98
103
|
if @description.nil?
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Apipie
|
2
2
|
class RoutesFormatter
|
3
|
-
API_METHODS = %w{GET POST PUT PATCH OPTIONS DELETE}
|
3
|
+
API_METHODS = %w{GET POST PUT PATCH OPTIONS DELETE}.freeze
|
4
4
|
|
5
5
|
# The entry method called by Apipie to extract the array
|
6
6
|
# representing the api dsl from the routes definition.
|
data/lib/apipie/version.rb
CHANGED
data/lib/tasks/apipie.rake
CHANGED
@@ -70,17 +70,17 @@ namespace :apipie do
|
|
70
70
|
with_loaded_documentation do
|
71
71
|
out = ENV["OUT_REF"] || File.join(Rails.root, Apipie.configuration.doc_path, 'apidoc_ref')
|
72
72
|
paths = generate_swagger_using_args(args, out)
|
73
|
-
paths.each
|
73
|
+
paths.each do |path|
|
74
74
|
existing_files_in_dir = Pathname(out).children(true)
|
75
75
|
|
76
76
|
make_reference = false
|
77
77
|
|
78
78
|
# reference filenames have the format <basename>.<counter>.swagger_ref
|
79
|
-
reference_files = existing_files_in_dir.select
|
79
|
+
reference_files = existing_files_in_dir.select do |f|
|
80
80
|
f.extname == '.swagger_ref' &&
|
81
81
|
f.basename.sub_ext("").extname.delete('.').to_i > 0 &&
|
82
82
|
f.basename.sub_ext("").sub_ext("") == path.basename.sub_ext("")
|
83
|
-
|
83
|
+
end
|
84
84
|
if reference_files.empty?
|
85
85
|
print "Reference file does not exist for [#{path}]\n"
|
86
86
|
counter = 1
|
@@ -111,7 +111,7 @@ namespace :apipie do
|
|
111
111
|
if reference_files.length > num_refs_to_keep
|
112
112
|
(reference_files - reference_files[-num_refs_to_keep..-1]).each(&:delete)
|
113
113
|
end
|
114
|
-
|
114
|
+
end
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
@@ -4,7 +4,7 @@ describe Api::V1::ArchitecturesController do
|
|
4
4
|
describe "resource description" do
|
5
5
|
subject { Apipie.get_resource_description(Api::V1::ArchitecturesController, "1.0") }
|
6
6
|
|
7
|
-
it "
|
7
|
+
it "is version 1.0" do
|
8
8
|
expect(subject._version).to eq('1.0')
|
9
9
|
|
10
10
|
expect(Apipie.resource_descriptions['1.0'].size).to eq(2)
|
@@ -14,11 +14,11 @@ describe Api::V1::ArchitecturesController do
|
|
14
14
|
context "there is another version" do
|
15
15
|
let(:v2) { archv2 = Apipie.get_resource_description(Api::V2::ArchitecturesController, "2.0") }
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "has unique doc url" do
|
18
18
|
expect(subject.doc_url).not_to eq(v2.doc_url)
|
19
19
|
end
|
20
20
|
|
21
|
-
it "
|
21
|
+
it "has unique methods" do
|
22
22
|
expect(subject._methods.keys).to include(:index)
|
23
23
|
expect(v2._methods.keys).to include(:index)
|
24
24
|
expect(subject._methods[:index]).not_to eq(v2._methods[:index])
|
@@ -20,7 +20,7 @@ describe Api::V2::Nested::ResourcesController do
|
|
20
20
|
describe '.get_resource_id' do
|
21
21
|
subject { Apipie.get_resource_id(Api::V2::Nested::ResourcesController) }
|
22
22
|
|
23
|
-
it "
|
23
|
+
it "has resource_id set" do
|
24
24
|
expect(subject).to eq("resource")
|
25
25
|
end
|
26
26
|
end
|
@@ -7,12 +7,12 @@ describe ConcernsController do
|
|
7
7
|
expect(Apipie["concern_resources#show"]).to be
|
8
8
|
end
|
9
9
|
|
10
|
-
it "
|
10
|
+
it "replies to valid request" do
|
11
11
|
get :show, :params => { :id => '5' }, :session => { :user_id => "secret_hash" }
|
12
12
|
assert_response :success
|
13
13
|
end
|
14
14
|
|
15
|
-
it "
|
15
|
+
it "passes if required parameter is missing" do
|
16
16
|
expect { get :show, :params => { :id => '5' } }.not_to raise_error
|
17
17
|
end
|
18
18
|
|
@@ -2,13 +2,13 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe ExtendedController do
|
4
4
|
|
5
|
-
it '
|
5
|
+
it 'includes params from both original controller and extending concern' do
|
6
6
|
expect(Apipie["extended#create"].params.keys).to eq [:oauth, :user, :admin]
|
7
7
|
user_param = Apipie["extended#create"].params[:user]
|
8
8
|
expect(user_param.validator.params_ordered.map(&:name)).to eq [:name, :password, :from_concern]
|
9
9
|
end
|
10
10
|
|
11
|
-
it '
|
11
|
+
it 'includes updated metadata' do
|
12
12
|
expect(Apipie['extended#create'].metadata).to eq metadata: 'data'
|
13
13
|
end
|
14
14
|
end
|
@@ -5,7 +5,7 @@ describe IncludedParamGroupController do
|
|
5
5
|
|
6
6
|
let(:dsl_data) { ActionController::Base.send(:_apipie_dsl_data_init) }
|
7
7
|
|
8
|
-
it "
|
8
|
+
it "does not error when there is a param_group that is deeply nested in response description" do
|
9
9
|
subject = Apipie.get_resource_description(IncludedParamGroupController, Apipie.configuration.default_version)
|
10
10
|
expect(subject._methods.keys).to include(:show)
|
11
11
|
end
|