apipie-rails 1.4.1 → 1.5.0
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 +4 -4
- data/.github/workflows/build.yml +20 -5
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +36 -48
- data/CHANGELOG.md +18 -0
- data/README.md +2 -2
- data/config/locales/it.yml +10 -0
- data/lib/apipie/application.rb +8 -11
- data/lib/apipie/dsl_definition.rb +41 -43
- data/lib/apipie/extractor/collector.rb +1 -0
- data/lib/apipie/extractor.rb +1 -3
- data/lib/apipie/generator/swagger/config.rb +2 -2
- data/lib/apipie/generator/swagger/method_description/api_schema_service.rb +2 -2
- data/lib/apipie/generator/swagger/method_description/parameters_service.rb +7 -7
- data/lib/apipie/generator/swagger/param_description/builder.rb +3 -3
- data/lib/apipie/generator/swagger/param_description/path_params_composite.rb +10 -10
- data/lib/apipie/generator/swagger/param_description/type.rb +5 -1
- data/lib/apipie/generator/swagger/resource_description_composite.rb +5 -5
- data/lib/apipie/param_description.rb +1 -1
- data/lib/apipie/response_description.rb +2 -6
- data/lib/apipie/static_dispatcher.rb +3 -5
- data/lib/apipie/validator.rb +3 -9
- data/lib/apipie/version.rb +1 -1
- data/lib/tasks/apipie.rake +6 -6
- data/rel-eng/gem_release.ipynb +79 -20
- data/spec/controllers/pets_controller_spec.rb +1 -1
- data/spec/dummy/config/boot.rb +3 -1
- data/spec/lib/apipie/extractor/collector_spec.rb +7 -1
- data/spec/lib/apipie/generator/swagger/param_description/builder_spec.rb +30 -0
- data/spec/lib/apipie/generator/swagger/param_description/type_spec.rb +29 -2
- data/spec/spec_helper.rb +6 -3
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac4c24841aa8ff06fd2d1b86ee4ab64ff873a531adb5bdd0e1d7e9f39cfd0072
|
4
|
+
data.tar.gz: 81896d38d3352ae7f9f77a24cbe193f9568c9b470302ecc69a2dfc2a3838a628
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 273e9bf75332d36f83ce0bf37a05ddb70d710557e995ef09f7789d45d251193304b204a861e3eb76421d0a66396966ec8c09ae6e32152ecaaddf001b7ab9cf74
|
7
|
+
data.tar.gz: 4da0ec44eb77de5d88f96cf20a43a38770d86c7f28d9bd53ce8ade4177e2f29592baaa9a8e5ce5d834d3b5fa48f4280b3188c9786f2d5a827b93961d309058e9
|
data/.github/workflows/build.yml
CHANGED
@@ -4,21 +4,36 @@ on: [push, pull_request]
|
|
4
4
|
|
5
5
|
jobs:
|
6
6
|
test:
|
7
|
-
runs-on: ubuntu-
|
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
data/.rubocop_todo.yml
CHANGED
@@ -1,15 +1,11 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config --exclude-limit 180`
|
3
|
-
# on 2024-
|
3
|
+
# on 2024-07-10 23:53:15 UTC using RuboCop version 1.65.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
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
RubyVersionGlobalsUsage:
|
10
|
-
Exclude:
|
11
|
-
- apipie-rails.gemspec
|
12
|
-
|
13
9
|
# Offense count: 1
|
14
10
|
# This cop supports safe autocorrection (--autocorrect).
|
15
11
|
# Configuration parameters: Severity, Include.
|
@@ -18,7 +14,7 @@ Gemspec/DeprecatedAttributeAssignment:
|
|
18
14
|
Exclude:
|
19
15
|
- 'apipie-rails.gemspec'
|
20
16
|
|
21
|
-
# Offense count:
|
17
|
+
# Offense count: 12
|
22
18
|
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
|
23
19
|
# SupportedStyles: Gemfile, gems.rb, gemspec
|
24
20
|
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
|
@@ -50,6 +46,13 @@ Gemspec/RequiredRubyVersion:
|
|
50
46
|
Exclude:
|
51
47
|
- 'spec/dummy/components/test_engine/test_engine.gemspec'
|
52
48
|
|
49
|
+
# Offense count: 1
|
50
|
+
# Configuration parameters: Severity, Include.
|
51
|
+
# Include: **/*.gemspec
|
52
|
+
Gemspec/RubyVersionGlobalsUsage:
|
53
|
+
Exclude:
|
54
|
+
- 'apipie-rails.gemspec'
|
55
|
+
|
53
56
|
# Offense count: 24
|
54
57
|
# This cop supports safe autocorrection (--autocorrect).
|
55
58
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
@@ -142,7 +145,7 @@ Layout/EmptyLineAfterGuardClause:
|
|
142
145
|
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
143
146
|
- 'spec/spec_helper.rb'
|
144
147
|
|
145
|
-
# Offense count:
|
148
|
+
# Offense count: 12
|
146
149
|
# This cop supports safe autocorrection (--autocorrect).
|
147
150
|
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, DefLikeMacros, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
148
151
|
Layout/EmptyLineBetweenDefs:
|
@@ -158,7 +161,7 @@ Layout/EmptyLineBetweenDefs:
|
|
158
161
|
- 'spec/dummy/app/controllers/pets_using_auto_views_controller.rb'
|
159
162
|
- 'spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb'
|
160
163
|
|
161
|
-
# Offense count:
|
164
|
+
# Offense count: 54
|
162
165
|
# This cop supports safe autocorrection (--autocorrect).
|
163
166
|
Layout/EmptyLines:
|
164
167
|
Exclude:
|
@@ -227,7 +230,7 @@ Layout/EmptyLinesAroundBlockBody:
|
|
227
230
|
- 'spec/spec_helper.rb'
|
228
231
|
- 'spec/test_engine/memes_controller_spec.rb'
|
229
232
|
|
230
|
-
# Offense count:
|
233
|
+
# Offense count: 43
|
231
234
|
# This cop supports safe autocorrection (--autocorrect).
|
232
235
|
# Configuration parameters: EnforcedStyle.
|
233
236
|
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
@@ -241,7 +244,6 @@ Layout/EmptyLinesAroundClassBody:
|
|
241
244
|
- 'lib/apipie/markup.rb'
|
242
245
|
- 'lib/apipie/param_description.rb'
|
243
246
|
- 'lib/apipie/resource_description.rb'
|
244
|
-
- 'lib/apipie/response_description.rb'
|
245
247
|
- 'lib/apipie/response_description_adapter.rb'
|
246
248
|
- 'lib/apipie/see_description.rb'
|
247
249
|
- 'lib/apipie/tag_list_description.rb'
|
@@ -415,16 +417,6 @@ Layout/MultilineMethodCallBraceLayout:
|
|
415
417
|
Exclude:
|
416
418
|
- 'lib/tasks/apipie.rake'
|
417
419
|
|
418
|
-
# Offense count: 14
|
419
|
-
# This cop supports safe autocorrection (--autocorrect).
|
420
|
-
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
421
|
-
# SupportedStyles: aligned, indented, indented_relative_to_receiver
|
422
|
-
Layout/MultilineMethodCallIndentation:
|
423
|
-
Exclude:
|
424
|
-
- 'lib/apipie/generator/swagger/param_description/builder.rb'
|
425
|
-
- 'lib/apipie/generator/swagger/param_description/composite.rb'
|
426
|
-
- 'lib/apipie/generator/swagger/param_description/type.rb'
|
427
|
-
|
428
420
|
# Offense count: 4
|
429
421
|
# This cop supports safe autocorrection (--autocorrect).
|
430
422
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
@@ -601,12 +593,11 @@ Layout/TrailingEmptyLines:
|
|
601
593
|
- 'spec/lib/apipie/generator/swagger/param_description_spec.rb'
|
602
594
|
- 'spec/lib/apipie/param_group_spec.rb'
|
603
595
|
|
604
|
-
# Offense count:
|
596
|
+
# Offense count: 14
|
605
597
|
# This cop supports safe autocorrection (--autocorrect).
|
606
598
|
# Configuration parameters: AllowInHeredoc.
|
607
599
|
Layout/TrailingWhitespace:
|
608
600
|
Exclude:
|
609
|
-
- 'lib/apipie/error_description.rb'
|
610
601
|
- 'spec/dummy/app/controllers/application_controller.rb'
|
611
602
|
- 'spec/dummy/app/controllers/twitter_example_controller.rb'
|
612
603
|
|
@@ -711,7 +702,7 @@ Lint/UnderscorePrefixedVariableName:
|
|
711
702
|
|
712
703
|
# Offense count: 22
|
713
704
|
# This cop supports safe autocorrection (--autocorrect).
|
714
|
-
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
705
|
+
# Configuration parameters: AutoCorrect, IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
715
706
|
Lint/UnusedBlockArgument:
|
716
707
|
Exclude:
|
717
708
|
- 'lib/apipie/configuration.rb'
|
@@ -726,7 +717,7 @@ Lint/UnusedBlockArgument:
|
|
726
717
|
|
727
718
|
# Offense count: 24
|
728
719
|
# This cop supports safe autocorrection (--autocorrect).
|
729
|
-
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
720
|
+
# Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
730
721
|
Lint/UnusedMethodArgument:
|
731
722
|
Exclude:
|
732
723
|
- 'lib/apipie/dsl_definition.rb'
|
@@ -737,6 +728,7 @@ Lint/UnusedMethodArgument:
|
|
737
728
|
|
738
729
|
# Offense count: 5
|
739
730
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
731
|
+
# Configuration parameters: AutoCorrect.
|
740
732
|
Lint/UselessAssignment:
|
741
733
|
Exclude:
|
742
734
|
- 'lib/apipie/application.rb'
|
@@ -746,24 +738,26 @@ Lint/UselessAssignment:
|
|
746
738
|
|
747
739
|
# Offense count: 2
|
748
740
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
741
|
+
# Configuration parameters: AutoCorrect.
|
749
742
|
Lint/UselessMethodDefinition:
|
750
743
|
Exclude:
|
751
744
|
- 'spec/dummy/app/controllers/overridden_concerns_controller.rb'
|
752
745
|
|
753
|
-
# Offense count:
|
746
|
+
# Offense count: 4
|
754
747
|
# This cop supports safe autocorrection (--autocorrect).
|
755
|
-
# Configuration parameters: CheckForMethodsWithNoSideEffects.
|
748
|
+
# Configuration parameters: AutoCorrect, CheckForMethodsWithNoSideEffects.
|
756
749
|
Lint/Void:
|
757
750
|
Exclude:
|
758
751
|
- 'spec/controllers/users_controller_spec.rb'
|
752
|
+
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
759
753
|
|
760
754
|
# Offense count: 60
|
761
755
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
762
756
|
Metrics/AbcSize:
|
763
757
|
Max: 96
|
764
758
|
|
765
|
-
# Offense count:
|
766
|
-
# Configuration parameters: CountBlocks.
|
759
|
+
# Offense count: 1
|
760
|
+
# Configuration parameters: CountBlocks, CountModifierForms.
|
767
761
|
Metrics/BlockNesting:
|
768
762
|
Max: 4
|
769
763
|
|
@@ -977,7 +971,7 @@ RSpec/DescribeClass:
|
|
977
971
|
|
978
972
|
# Offense count: 75
|
979
973
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
980
|
-
# Configuration parameters: SkipBlocks, EnforcedStyle.
|
974
|
+
# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
|
981
975
|
# SupportedStyles: described_class, explicit
|
982
976
|
RSpec/DescribedClass:
|
983
977
|
Exclude:
|
@@ -997,6 +991,7 @@ RSpec/DescribedClass:
|
|
997
991
|
|
998
992
|
# Offense count: 1
|
999
993
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
994
|
+
# Configuration parameters: AutoCorrect.
|
1000
995
|
RSpec/EmptyExampleGroup:
|
1001
996
|
Exclude:
|
1002
997
|
- 'spec/lib/apipie/generator/swagger/param_description/composite_spec.rb'
|
@@ -1020,7 +1015,7 @@ RSpec/EmptyLineAfterHook:
|
|
1020
1015
|
Exclude:
|
1021
1016
|
- 'spec/lib/apipie/apipies_controller_spec.rb'
|
1022
1017
|
|
1023
|
-
# Offense count:
|
1018
|
+
# Offense count: 55
|
1024
1019
|
# Configuration parameters: CountAsOne.
|
1025
1020
|
RSpec/ExampleLength:
|
1026
1021
|
Max: 85
|
@@ -1046,6 +1041,7 @@ RSpec/HookArgument:
|
|
1046
1041
|
|
1047
1042
|
# Offense count: 3
|
1048
1043
|
# This cop supports safe autocorrection (--autocorrect).
|
1044
|
+
# Configuration parameters: AutoCorrect.
|
1049
1045
|
RSpec/HooksBeforeExamples:
|
1050
1046
|
Exclude:
|
1051
1047
|
- 'spec/controllers/users_controller_spec.rb'
|
@@ -1092,7 +1088,7 @@ RSpec/MessageSpies:
|
|
1092
1088
|
RSpec/MultipleExpectations:
|
1093
1089
|
Max: 19
|
1094
1090
|
|
1095
|
-
# Offense count:
|
1091
|
+
# Offense count: 170
|
1096
1092
|
# Configuration parameters: AllowSubject.
|
1097
1093
|
RSpec/MultipleMemoizedHelpers:
|
1098
1094
|
Max: 15
|
@@ -1117,7 +1113,7 @@ RSpec/NamedSubject:
|
|
1117
1113
|
- 'spec/lib/swagger/rake_swagger_spec.rb'
|
1118
1114
|
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
1119
1115
|
|
1120
|
-
# Offense count:
|
1116
|
+
# Offense count: 99
|
1121
1117
|
# Configuration parameters: AllowedGroups.
|
1122
1118
|
RSpec/NestedGroups:
|
1123
1119
|
Max: 6
|
@@ -1156,13 +1152,6 @@ RSpec/PredicateMatcher:
|
|
1156
1152
|
- 'spec/lib/apipie/file_handler_spec.rb'
|
1157
1153
|
- 'spec/lib/swagger/swagger_dsl_spec.rb'
|
1158
1154
|
|
1159
|
-
# Offense count: 1
|
1160
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
1161
|
-
# Configuration parameters: Inferences.
|
1162
|
-
RSpecRails/InferredSpecType:
|
1163
|
-
Exclude:
|
1164
|
-
- 'spec/controllers/pets_controller_spec.rb'
|
1165
|
-
|
1166
1155
|
# Offense count: 2
|
1167
1156
|
RSpec/RepeatedExampleGroupBody:
|
1168
1157
|
Exclude:
|
@@ -1209,7 +1198,7 @@ Rails/Delegate:
|
|
1209
1198
|
Exclude:
|
1210
1199
|
- 'lib/apipie/response_description_adapter.rb'
|
1211
1200
|
|
1212
|
-
# Offense count:
|
1201
|
+
# Offense count: 25
|
1213
1202
|
# This cop supports safe autocorrection (--autocorrect).
|
1214
1203
|
# Configuration parameters: EnforcedStyle.
|
1215
1204
|
# SupportedStyles: slashes, arguments
|
@@ -1420,7 +1409,7 @@ Style/CommentedKeyword:
|
|
1420
1409
|
- 'lib/apipie/dsl_definition.rb'
|
1421
1410
|
- 'lib/apipie/extractor/recorder.rb'
|
1422
1411
|
|
1423
|
-
# Offense count:
|
1412
|
+
# Offense count: 7
|
1424
1413
|
# This cop supports safe autocorrection (--autocorrect).
|
1425
1414
|
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
1426
1415
|
# SupportedStyles: assign_to_condition, assign_inside_condition
|
@@ -1455,7 +1444,7 @@ Style/EmptyCaseCondition:
|
|
1455
1444
|
|
1456
1445
|
# Offense count: 3
|
1457
1446
|
# This cop supports safe autocorrection (--autocorrect).
|
1458
|
-
# Configuration parameters: EnforcedStyle, AllowComments.
|
1447
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle, AllowComments.
|
1459
1448
|
# SupportedStyles: empty, nil, both
|
1460
1449
|
Style/EmptyElse:
|
1461
1450
|
Exclude:
|
@@ -1465,7 +1454,7 @@ Style/EmptyElse:
|
|
1465
1454
|
|
1466
1455
|
# Offense count: 27
|
1467
1456
|
# This cop supports safe autocorrection (--autocorrect).
|
1468
|
-
# Configuration parameters: EnforcedStyle.
|
1457
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
1469
1458
|
# SupportedStyles: compact, expanded
|
1470
1459
|
Style/EmptyMethod:
|
1471
1460
|
Exclude:
|
@@ -1552,7 +1541,7 @@ Style/HashExcept:
|
|
1552
1541
|
# This cop supports safe autocorrection (--autocorrect).
|
1553
1542
|
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
1554
1543
|
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
1555
|
-
# SupportedShorthandSyntax: always, never, either, consistent
|
1544
|
+
# SupportedShorthandSyntax: always, never, either, consistent, either_consistent
|
1556
1545
|
Style/HashSyntax:
|
1557
1546
|
Exclude:
|
1558
1547
|
- 'spec/dummy/config/routes.rb'
|
@@ -1687,7 +1676,7 @@ Style/Proc:
|
|
1687
1676
|
- 'spec/lib/apipie/apipies_controller_spec.rb'
|
1688
1677
|
|
1689
1678
|
# Offense count: 7
|
1690
|
-
# This cop supports
|
1679
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
1691
1680
|
# Configuration parameters: EnforcedStyle, AllowedCompactTypes.
|
1692
1681
|
# SupportedStyles: compact, exploded
|
1693
1682
|
Style/RaiseArgs:
|
@@ -1844,7 +1833,7 @@ Style/StringConcatenation:
|
|
1844
1833
|
- 'lib/apipie/application.rb'
|
1845
1834
|
- 'lib/apipie/extractor/writer.rb'
|
1846
1835
|
|
1847
|
-
# Offense count:
|
1836
|
+
# Offense count: 1233
|
1848
1837
|
# This cop supports safe autocorrection (--autocorrect).
|
1849
1838
|
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
1850
1839
|
# SupportedStyles: single_quotes, double_quotes
|
@@ -1944,7 +1933,7 @@ Style/TrailingCommaInArrayLiteral:
|
|
1944
1933
|
- 'spec/controllers/users_controller_spec.rb'
|
1945
1934
|
- 'spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb'
|
1946
1935
|
|
1947
|
-
# Offense count:
|
1936
|
+
# Offense count: 4
|
1948
1937
|
# This cop supports safe autocorrection (--autocorrect).
|
1949
1938
|
# Configuration parameters: EnforcedStyleForMultiline.
|
1950
1939
|
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
@@ -1952,7 +1941,6 @@ Style/TrailingCommaInHashLiteral:
|
|
1952
1941
|
Exclude:
|
1953
1942
|
- 'lib/apipie/generator/swagger/param_description.rb'
|
1954
1943
|
- 'lib/apipie/generator/swagger/param_description/builder.rb'
|
1955
|
-
- 'lib/apipie/response_description.rb'
|
1956
1944
|
- 'spec/controllers/users_controller_spec.rb'
|
1957
1945
|
|
1958
1946
|
# Offense count: 1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
Changelog
|
2
2
|
===========
|
3
|
+
## [v1.5.0](https://github.com/Apipie/apipie-rails/tree/v1.5.0) (2025-08-19)
|
4
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.4.2...v1.5.0)
|
5
|
+
* Don't collect records without an action (Evgeni Golov)
|
6
|
+
* Update test matrix: rails 7.2, 8.0, ruby 3.4 [#960](https://github.com/Apipie/apipie-rails/pull/960) (Evgeni Golov)
|
7
|
+
* Fix activesupport::deprecation.warn deprecation (Jonathan Biolaz)
|
8
|
+
* Rubocop autofix (Evgeni Golov)
|
9
|
+
* Update ci workflow to run on ubuntu 24.04 (Evgeni Golov)
|
10
|
+
* Fix issue with loading rails logger in tests (Eric Helms)
|
11
|
+
* Update link for rdoc in readme (Panos Dalitsouris)
|
12
|
+
* Fix the decimalvalidator header in readme.md [#945](https://github.com/Apipie/apipie-rails/pull/945) (Ewoud Kohl van Wijngaarden)
|
13
|
+
* Rename render_page in apipie.rake to render_apipie_page [#943](https://github.com/Apipie/apipie-rails/pull/943) (Nathan Palmer)
|
14
|
+
* Update it.yml following latest en.yml [#942](https://github.com/Apipie/apipie-rails/pull/942) (Claudio Maradonna)
|
15
|
+
|
16
|
+
|
17
|
+
## [v1.4.2](https://github.com/Apipie/apipie-rails/tree/v1.4.2) (2024-07-20)
|
18
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.4.1...v1.4.2)
|
19
|
+
* Fix rubocop with most recent version 1.65.0 (#930) (Mathieu Jobin)
|
20
|
+
* Fix error for hash object warnings with delegated method descriptions (#938) (Murray Steele)
|
3
21
|
|
4
22
|
## [v1.4.1](https://github.com/Apipie/apipie-rails/tree/v1.4.1) (2024-07-09)
|
5
23
|
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v1.4.0...v1.4.1)
|
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://
|
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
|
data/config/locales/it.yml
CHANGED
@@ -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
|
data/lib/apipie/application.rb
CHANGED
@@ -271,22 +271,19 @@ module Apipie
|
|
271
271
|
.json_schema_for_method_response(method, return_code, allow_nulls)
|
272
272
|
end
|
273
273
|
|
274
|
-
|
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)
|
281
278
|
|
282
279
|
resources =
|
283
280
|
Apipie::Generator::Swagger::ResourceDescriptionsCollection
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
281
|
+
.new(resource_descriptions)
|
282
|
+
.filter(
|
283
|
+
resource_id: resource_id,
|
284
|
+
method_name: method_name,
|
285
|
+
version: version
|
286
|
+
)
|
290
287
|
|
291
288
|
Apipie::SwaggerGenerator.generate_from_resources(
|
292
289
|
resources,
|
@@ -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
|
-
|
234
|
-
|
235
|
-
|
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
|
-
|
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
|
-
#
|
255
|
-
param
|
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
|
-
|
260
|
-
|
261
|
-
|
262
|
-
params.
|
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
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
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
|
-
|
280
|
-
|
277
|
+
return unless [:implicitly, true].include?(Apipie.configuration.validate)
|
278
|
+
old_method = instance_method(description.method)
|
281
279
|
|
282
|
-
|
283
|
-
|
280
|
+
define_method(description.method) do |*args|
|
281
|
+
apipie_validations
|
284
282
|
|
285
|
-
|
286
|
-
|
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]))
|
data/lib/apipie/extractor.rb
CHANGED
@@ -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.
|
@@ -17,8 +17,8 @@ class Apipie::Generator::Swagger::MethodDescription::ApiSchemaService
|
|
17
17
|
end
|
18
18
|
|
19
19
|
parameters = Apipie::Generator::Swagger::MethodDescription::ParametersService
|
20
|
-
|
21
|
-
|
20
|
+
.new(@method_description, path: path, http_method: api.normalized_http_method)
|
21
|
+
.call
|
22
22
|
|
23
23
|
paths[path.swagger_path(@method_description)] ||= {}
|
24
24
|
paths[path.swagger_path(@method_description)][api.normalized_http_method] = {
|
@@ -40,7 +40,7 @@ class Apipie::Generator::Swagger::MethodDescription::ParametersService
|
|
40
40
|
|
41
41
|
if Apipie.configuration.generator.swagger.json_input_uses_refs?
|
42
42
|
composite = composite
|
43
|
-
|
43
|
+
.referenced("#{@method_description.operation_id}_input")
|
44
44
|
end
|
45
45
|
|
46
46
|
swagger_schema_for_body = composite.to_swagger
|
@@ -80,7 +80,7 @@ class Apipie::Generator::Swagger::MethodDescription::ParametersService
|
|
80
80
|
warn_path_parameter_not_described(name, @path)
|
81
81
|
|
82
82
|
result[name.to_sym] = Apipie::Generator::Swagger::ParamDescription
|
83
|
-
|
83
|
+
.create_for_missing_param(@method_description, name)
|
84
84
|
end
|
85
85
|
|
86
86
|
result
|
@@ -89,15 +89,15 @@ class Apipie::Generator::Swagger::MethodDescription::ParametersService
|
|
89
89
|
|
90
90
|
def body_param_descriptions
|
91
91
|
@body_param_descriptions ||= all_params
|
92
|
-
|
93
|
-
|
92
|
+
.reject { |k, _| @path.param?(k) }
|
93
|
+
.values
|
94
94
|
end
|
95
95
|
|
96
96
|
def path_param_descriptions
|
97
97
|
@path_param_descriptions ||= all_params
|
98
|
-
|
99
|
-
|
100
|
-
|
98
|
+
.select { |k, _| @path.param?(k) }
|
99
|
+
.each_value { |desc| desc.required = true }
|
100
|
+
.values
|
101
101
|
end
|
102
102
|
|
103
103
|
# @return [Array]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Apipie::Generator::Swagger::ParamDescription::Builder
|
2
2
|
# @param [Apipie::ParamDescription] param_description
|
3
3
|
# @param [TrueClass, FalseClass] in_schema
|
4
|
-
# @param [Apipie::MethodDescription] controller_method
|
4
|
+
# @param [Apipie::MethodDescription, nil] controller_method
|
5
5
|
def initialize(param_description, in_schema:, controller_method:)
|
6
6
|
@param_description = param_description
|
7
7
|
@in_schema = in_schema
|
@@ -98,8 +98,8 @@ class Apipie::Generator::Swagger::ParamDescription::Builder
|
|
98
98
|
def warn_optional_without_default_value(definition)
|
99
99
|
if !required? && !definition.key?(:default)
|
100
100
|
method_id =
|
101
|
-
if @param_description.is_a?(Apipie::ResponseDescriptionAdapter::PropDesc)
|
102
|
-
@controller_method
|
101
|
+
if @controller_method.present? && @param_description.is_a?(Apipie::ResponseDescriptionAdapter::PropDesc)
|
102
|
+
@controller_method.method_name
|
103
103
|
else
|
104
104
|
Apipie::Generator::Swagger::MethodDescription::Decorator.new(@controller_method).ruby_name
|
105
105
|
end
|
@@ -26,21 +26,21 @@ class Apipie::Generator::Swagger::ParamDescription::PathParamsComposite
|
|
26
26
|
context.add_to_prefix!(desc.name)
|
27
27
|
|
28
28
|
out = Apipie::Generator::Swagger::ParamDescription::PathParamsComposite
|
29
|
-
|
30
|
-
|
29
|
+
.new(desc.validator.params_ordered, context)
|
30
|
+
.to_swagger
|
31
31
|
|
32
32
|
@result.concat(out)
|
33
33
|
else
|
34
34
|
param_entry =
|
35
35
|
Apipie::Generator::Swagger::ParamDescription::Builder
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
36
|
+
.new(desc, in_schema: false, controller_method: context.controller_method)
|
37
|
+
.with_description(language: context.language)
|
38
|
+
.with_name(prefix: context.prefix)
|
39
|
+
.with_type(with_null: context.allow_null?)
|
40
|
+
.with_in(
|
41
|
+
http_method: context.http_method,
|
42
|
+
default_in_value: context.default_in_value
|
43
|
+
).to_swagger
|
44
44
|
|
45
45
|
@result << param_entry
|
46
46
|
end
|
@@ -114,7 +114,11 @@ class Apipie::Generator::Swagger::ParamDescription::Type
|
|
114
114
|
def warn_hash_without_internal_typespec
|
115
115
|
method_id =
|
116
116
|
if @param_description.is_a?(Apipie::ResponseDescriptionAdapter::PropDesc)
|
117
|
-
@controller_method.
|
117
|
+
if @controller_method.present?
|
118
|
+
@controller_method.method_name
|
119
|
+
else
|
120
|
+
Apipie::Generator::Swagger::MethodDescription::Decorator.new(nil).ruby_name
|
121
|
+
end
|
118
122
|
else
|
119
123
|
Apipie::Generator::Swagger::MethodDescription::Decorator.new(@param_description.method_description).ruby_name
|
120
124
|
end
|
@@ -41,11 +41,11 @@ class Apipie::Generator::Swagger::ResourceDescriptionComposite
|
|
41
41
|
next unless method_description.show
|
42
42
|
|
43
43
|
result = Apipie::Generator::Swagger::MethodDescription::ApiSchemaService
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
.new(
|
45
|
+
Apipie::Generator::Swagger::MethodDescription::Decorator.new(method_description),
|
46
|
+
language: @language
|
47
|
+
)
|
48
|
+
.call
|
49
49
|
|
50
50
|
results.deep_merge!(result)
|
51
51
|
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) &&
|
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
|
-
|
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
|
-
|
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
|
@@ -16,8 +16,8 @@ module Apipie
|
|
16
16
|
def match?(path)
|
17
17
|
# Replace all null bytes
|
18
18
|
path = ::Rack::Utils.unescape(path || '')
|
19
|
-
|
20
|
-
|
19
|
+
.encode(Encoding::UTF_8, invalid: :replace, replace: '')
|
20
|
+
.gsub("\x0", '')
|
21
21
|
|
22
22
|
full_path = path.empty? ? @root : File.join(@root, path)
|
23
23
|
paths = "#{full_path}#{ext}"
|
@@ -30,9 +30,7 @@ module Apipie
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
|
-
@file_server.call(env)
|
35
|
-
end
|
33
|
+
delegate :call, to: :@file_server
|
36
34
|
|
37
35
|
def ext
|
38
36
|
@ext ||= begin
|
data/lib/apipie/validator.rb
CHANGED
@@ -431,9 +431,7 @@ module Apipie
|
|
431
431
|
|
432
432
|
class DecimalValidator < BaseValidator
|
433
433
|
|
434
|
-
|
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
|
-
|
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
|
-
|
553
|
-
@validator.params_ordered
|
554
|
-
end
|
548
|
+
delegate :params_ordered, to: :@validator
|
555
549
|
end
|
556
550
|
|
557
551
|
end
|
data/lib/apipie/version.rb
CHANGED
data/lib/tasks/apipie.rake
CHANGED
@@ -182,7 +182,7 @@ namespace :apipie do
|
|
182
182
|
return @apipie_renderer
|
183
183
|
end
|
184
184
|
|
185
|
-
def
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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,
|
data/rel-eng/gem_release.ipynb
CHANGED
@@ -31,9 +31,25 @@
|
|
31
31
|
},
|
32
32
|
{
|
33
33
|
"cell_type": "code",
|
34
|
-
"execution_count":
|
35
|
-
"metadata": {},
|
36
|
-
"outputs": [
|
34
|
+
"execution_count": 5,
|
35
|
+
"metadata": {},
|
36
|
+
"outputs": [
|
37
|
+
{
|
38
|
+
"name": "stdout",
|
39
|
+
"output_type": "stream",
|
40
|
+
"text": [
|
41
|
+
"/home/evgeni/Devel/apipie/apipie-rails\n"
|
42
|
+
]
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"name": "stderr",
|
46
|
+
"output_type": "stream",
|
47
|
+
"text": [
|
48
|
+
"/usr/lib/python3.13/site-packages/IPython/core/magics/osm.py:417: UserWarning: This is now an optional IPython functionality, setting dhist requires you to install the `pickleshare` library.\n",
|
49
|
+
" self.shell.db['dhist'] = compress_dhist(dhist)[-100:]\n"
|
50
|
+
]
|
51
|
+
}
|
52
|
+
],
|
37
53
|
"source": [
|
38
54
|
"%cd .."
|
39
55
|
]
|
@@ -47,12 +63,12 @@
|
|
47
63
|
},
|
48
64
|
{
|
49
65
|
"cell_type": "code",
|
50
|
-
"execution_count":
|
66
|
+
"execution_count": 2,
|
51
67
|
"metadata": {},
|
52
68
|
"outputs": [],
|
53
69
|
"source": [
|
54
|
-
"NEW_VERSION = '
|
55
|
-
"LAST_VERSION = '
|
70
|
+
"NEW_VERSION = '1.5.0'\n",
|
71
|
+
"LAST_VERSION = '1.4.2'\n",
|
56
72
|
"GIT_REMOTE_UPSTREAM = 'origin'\n",
|
57
73
|
"STABLE_RELEASE = False\n",
|
58
74
|
"WORK_BRANCH = 'stable' if STABLE_RELEASE else 'master'\n",
|
@@ -149,7 +165,7 @@
|
|
149
165
|
},
|
150
166
|
{
|
151
167
|
"cell_type": "code",
|
152
|
-
"execution_count":
|
168
|
+
"execution_count": 7,
|
153
169
|
"metadata": {},
|
154
170
|
"outputs": [],
|
155
171
|
"source": [
|
@@ -158,9 +174,32 @@
|
|
158
174
|
},
|
159
175
|
{
|
160
176
|
"cell_type": "code",
|
161
|
-
"execution_count":
|
162
|
-
"metadata": {},
|
163
|
-
"outputs": [
|
177
|
+
"execution_count": 3,
|
178
|
+
"metadata": {},
|
179
|
+
"outputs": [
|
180
|
+
{
|
181
|
+
"data": {
|
182
|
+
"text/markdown": [
|
183
|
+
"* Don't collect records without an action (Evgeni Golov)\n",
|
184
|
+
"* Update test matrix: rails 7.2, 8.0, ruby 3.4 [#960](https://github.com/Apipie/apipie-rails/pull/960) (Evgeni Golov)\n",
|
185
|
+
"* Fix activesupport::deprecation.warn deprecation (Jonathan Biolaz)\n",
|
186
|
+
"* Rubocop autofix (Evgeni Golov)\n",
|
187
|
+
"* Update ci workflow to run on ubuntu 24.04 (Evgeni Golov)\n",
|
188
|
+
"* Fix issue with loading rails logger in tests (Eric Helms)\n",
|
189
|
+
"* Update link for rdoc in readme (Panos Dalitsouris)\n",
|
190
|
+
"* Fix the decimalvalidator header in readme.md [#945](https://github.com/Apipie/apipie-rails/pull/945) (Ewoud Kohl van Wijngaarden)\n",
|
191
|
+
"* Rename render_page in apipie.rake to render_apipie_page [#943](https://github.com/Apipie/apipie-rails/pull/943) (Nathan Palmer)\n",
|
192
|
+
"* Update it.yml following latest en.yml [#942](https://github.com/Apipie/apipie-rails/pull/942) (Claudio Maradonna)"
|
193
|
+
],
|
194
|
+
"text/plain": [
|
195
|
+
"<IPython.core.display.Markdown object>"
|
196
|
+
]
|
197
|
+
},
|
198
|
+
"execution_count": 3,
|
199
|
+
"metadata": {},
|
200
|
+
"output_type": "execute_result"
|
201
|
+
}
|
202
|
+
],
|
164
203
|
"source": [
|
165
204
|
"# Parse git changelog\n",
|
166
205
|
"from IPython.display import Markdown as md\n",
|
@@ -192,7 +231,7 @@
|
|
192
231
|
},
|
193
232
|
{
|
194
233
|
"cell_type": "code",
|
195
|
-
"execution_count":
|
234
|
+
"execution_count": 6,
|
196
235
|
"metadata": {},
|
197
236
|
"outputs": [],
|
198
237
|
"source": [
|
@@ -230,9 +269,7 @@
|
|
230
269
|
{
|
231
270
|
"cell_type": "code",
|
232
271
|
"execution_count": null,
|
233
|
-
"metadata": {
|
234
|
-
"scrolled": false
|
235
|
-
},
|
272
|
+
"metadata": {},
|
236
273
|
"outputs": [],
|
237
274
|
"source": [
|
238
275
|
"! git add -u\n",
|
@@ -355,9 +392,31 @@
|
|
355
392
|
},
|
356
393
|
{
|
357
394
|
"cell_type": "code",
|
358
|
-
"execution_count":
|
359
|
-
"metadata": {},
|
360
|
-
"outputs": [
|
395
|
+
"execution_count": 8,
|
396
|
+
"metadata": {},
|
397
|
+
"outputs": [
|
398
|
+
{
|
399
|
+
"name": "stdout",
|
400
|
+
"output_type": "stream",
|
401
|
+
"text": [
|
402
|
+
"\n",
|
403
|
+
"\n",
|
404
|
+
"* Don't collect records without an action (Evgeni Golov)\n",
|
405
|
+
"* Update test matrix: rails 7.2, 8.0, ruby 3.4 [#960](https://github.com/Apipie/apipie-rails/pull/960) (Evgeni Golov)\n",
|
406
|
+
"* Fix activesupport::deprecation.warn deprecation (Jonathan Biolaz)\n",
|
407
|
+
"* Rubocop autofix (Evgeni Golov)\n",
|
408
|
+
"* Update ci workflow to run on ubuntu 24.04 (Evgeni Golov)\n",
|
409
|
+
"* Fix issue with loading rails logger in tests (Eric Helms)\n",
|
410
|
+
"* Update link for rdoc in readme (Panos Dalitsouris)\n",
|
411
|
+
"* Fix the decimalvalidator header in readme.md [#945](https://github.com/Apipie/apipie-rails/pull/945) (Ewoud Kohl van Wijngaarden)\n",
|
412
|
+
"* Rename render_page in apipie.rake to render_apipie_page [#943](https://github.com/Apipie/apipie-rails/pull/943) (Nathan Palmer)\n",
|
413
|
+
"* Update it.yml following latest en.yml [#942](https://github.com/Apipie/apipie-rails/pull/942) (Claudio Maradonna)\n",
|
414
|
+
"\n",
|
415
|
+
"\n",
|
416
|
+
"https://github.com/Apipie/apipie-rails/releases/new?tag=1.5.0\n"
|
417
|
+
]
|
418
|
+
}
|
419
|
+
],
|
361
420
|
"source": [
|
362
421
|
"print('\\n')\n",
|
363
422
|
"print('\\n'.join(change_log))\n",
|
@@ -376,7 +435,7 @@
|
|
376
435
|
],
|
377
436
|
"metadata": {
|
378
437
|
"kernelspec": {
|
379
|
-
"display_name": "Python 3",
|
438
|
+
"display_name": "Python 3 (ipykernel)",
|
380
439
|
"language": "python",
|
381
440
|
"name": "python3"
|
382
441
|
},
|
@@ -390,9 +449,9 @@
|
|
390
449
|
"name": "python",
|
391
450
|
"nbconvert_exporter": "python",
|
392
451
|
"pygments_lexer": "ipython3",
|
393
|
-
"version": "3.6
|
452
|
+
"version": "3.13.6"
|
394
453
|
}
|
395
454
|
},
|
396
455
|
"nbformat": 4,
|
397
|
-
"nbformat_minor":
|
456
|
+
"nbformat_minor": 4
|
398
457
|
}
|
@@ -4,7 +4,7 @@ require 'rspec/expectations'
|
|
4
4
|
require 'apipie/rspec/response_validation_helper'
|
5
5
|
require "json-schema"
|
6
6
|
|
7
|
-
RSpec.describe PetsController
|
7
|
+
RSpec.describe PetsController do
|
8
8
|
it "does not raise error when rendered output matches the described response" do
|
9
9
|
response = get :return_and_validate_expected_response, format: :json
|
10
10
|
expect(response).to match_declared_responses
|
data/spec/dummy/config/boot.rb
CHANGED
@@ -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) {
|
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 }
|
@@ -145,6 +145,36 @@ describe Apipie::Generator::Swagger::ParamDescription::Builder do
|
|
145
145
|
/is optional but default value is not specified/
|
146
146
|
).to_stderr
|
147
147
|
end
|
148
|
+
|
149
|
+
context 'and param is a prop desc' do
|
150
|
+
let(:param_description) do
|
151
|
+
Apipie.prop(:param, 'object', param_description_options, [])
|
152
|
+
end
|
153
|
+
|
154
|
+
context 'with a delegated controller method' do
|
155
|
+
let(:method_desc) do
|
156
|
+
Apipie::Generator::Swagger::MethodDescription::Decorator.new(
|
157
|
+
Apipie::MethodDescription.new(:show, resource_desc, dsl_data)
|
158
|
+
)
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'warns' do
|
162
|
+
expect { subject }.to output(
|
163
|
+
/is optional but default value is not specified/
|
164
|
+
).to_stderr
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context 'with a nil controller method' do
|
169
|
+
let(:method_desc) { nil }
|
170
|
+
|
171
|
+
it 'warns' do
|
172
|
+
expect { subject }.to output(
|
173
|
+
/is optional but default value is not specified/
|
174
|
+
).to_stderr
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
148
178
|
end
|
149
179
|
end
|
150
180
|
end
|
@@ -3,7 +3,6 @@ require 'spec_helper'
|
|
3
3
|
describe Apipie::Generator::Swagger::ParamDescription::Type do
|
4
4
|
let(:validator_options) { {} }
|
5
5
|
let(:param_description_options) { {}.merge(validator_options) }
|
6
|
-
let(:with_null) { false }
|
7
6
|
let(:http_method) { :GET }
|
8
7
|
let(:path) { '/api' }
|
9
8
|
let(:validator) { String }
|
@@ -63,9 +62,11 @@ describe Apipie::Generator::Swagger::ParamDescription::Type do
|
|
63
62
|
)
|
64
63
|
end
|
65
64
|
|
65
|
+
let(:controller_method) { 'index' }
|
66
|
+
|
66
67
|
let(:type_definition) do
|
67
68
|
described_class.
|
68
|
-
new(param_description, with_null:
|
69
|
+
new(param_description, with_null: false, controller_method: controller_method).
|
69
70
|
to_hash
|
70
71
|
end
|
71
72
|
|
@@ -178,6 +179,32 @@ describe Apipie::Generator::Swagger::ParamDescription::Type do
|
|
178
179
|
it 'outputs a hash without internal typespec warning' do
|
179
180
|
expect { subject }.to output(/is a generic Hash without an internal type specification/).to_stderr
|
180
181
|
end
|
182
|
+
|
183
|
+
context 'and param is a prop desc' do
|
184
|
+
let(:param_description) do
|
185
|
+
Apipie.prop(param_description_name, 'object', {}, [])
|
186
|
+
end
|
187
|
+
|
188
|
+
context 'with a delegated controller method' do
|
189
|
+
let(:controller_method) do
|
190
|
+
Apipie::Generator::Swagger::MethodDescription::Decorator.new(
|
191
|
+
method_desc
|
192
|
+
)
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'outputs a hash without internal typespec warning' do
|
196
|
+
expect { subject }.to output(/is a generic Hash without an internal type specification/).to_stderr
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
context 'and controller method is nil' do
|
201
|
+
let(:controller_method) { nil }
|
202
|
+
|
203
|
+
it 'outputs a hash without internal typespec warning' do
|
204
|
+
expect { subject }.to output(/is a generic Hash without an internal type specification/).to_stderr
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
181
208
|
end
|
182
209
|
end
|
183
210
|
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
|
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]
|
@@ -61,8 +61,11 @@ RSpec.configure do |config|
|
|
61
61
|
|
62
62
|
config.mock_with :rspec
|
63
63
|
|
64
|
-
|
65
|
-
|
64
|
+
if Rails.version >= "7.1"
|
65
|
+
config.fixture_paths = ["#{Rails.root}/spec/fixtures"]
|
66
|
+
else
|
67
|
+
config.fixture_path = "#{Rails.root}/spec/fixtures"
|
68
|
+
end
|
66
69
|
|
67
70
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
68
71
|
# examples within a transaction, remove the following line or assign false
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apipie-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Pokorny
|
8
8
|
- Ivan Necas
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: actionpack
|
@@ -477,7 +476,6 @@ metadata:
|
|
477
476
|
bug_tracker_uri: https://github.com/Apipie/apipie-rails/issues
|
478
477
|
changelog_uri: https://github.com/Apipie/apipie-rails/blob/master/CHANGELOG.md
|
479
478
|
source_code_uri: https://github.com/Apipie/apipie-rails
|
480
|
-
post_install_message:
|
481
479
|
rdoc_options: []
|
482
480
|
require_paths:
|
483
481
|
- lib
|
@@ -492,8 +490,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
492
490
|
- !ruby/object:Gem::Version
|
493
491
|
version: '0'
|
494
492
|
requirements: []
|
495
|
-
rubygems_version: 3.
|
496
|
-
signing_key:
|
493
|
+
rubygems_version: 3.6.7
|
497
494
|
specification_version: 4
|
498
495
|
summary: Rails REST API documentation tool
|
499
496
|
test_files:
|