grape-swagger 0.34.2 → 1.3.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/.rubocop.yml +86 -0
- data/.travis.yml +19 -12
- data/CHANGELOG.md +47 -4
- data/Gemfile +9 -3
- data/README.md +125 -12
- data/UPGRADING.md +34 -0
- data/grape-swagger.gemspec +1 -2
- data/lib/grape-swagger.rb +2 -2
- data/lib/grape-swagger/doc_methods.rb +65 -62
- data/lib/grape-swagger/doc_methods/build_model_definition.rb +53 -2
- data/lib/grape-swagger/doc_methods/data_type.rb +6 -6
- data/lib/grape-swagger/doc_methods/format_data.rb +2 -2
- data/lib/grape-swagger/doc_methods/operation_id.rb +2 -2
- data/lib/grape-swagger/doc_methods/parse_params.rb +19 -4
- data/lib/grape-swagger/endpoint.rb +37 -26
- data/lib/grape-swagger/endpoint/params_parser.rb +12 -5
- data/lib/grape-swagger/rake/oapi_tasks.rb +12 -2
- data/lib/grape-swagger/version.rb +1 -1
- data/spec/issues/427_entity_as_string_spec.rb +1 -1
- data/spec/issues/430_entity_definitions_spec.rb +7 -5
- data/spec/issues/784_extensions_on_params_spec.rb +38 -0
- data/spec/lib/data_type_spec.rb +14 -2
- data/spec/lib/endpoint/params_parser_spec.rb +2 -1
- data/spec/lib/endpoint_spec.rb +1 -1
- data/spec/lib/move_params_spec.rb +2 -2
- data/spec/lib/oapi_tasks_spec.rb +15 -5
- data/spec/support/empty_model_parser.rb +1 -2
- data/spec/support/mock_parser.rb +1 -2
- data/spec/support/model_parsers/entity_parser.rb +9 -9
- data/spec/support/model_parsers/mock_parser.rb +8 -8
- data/spec/support/model_parsers/representable_parser.rb +9 -9
- data/spec/swagger_v2/api_swagger_v2_hide_param_spec.rb +14 -3
- data/spec/swagger_v2/api_swagger_v2_param_type_body_spec.rb +2 -2
- data/spec/swagger_v2/api_swagger_v2_response_with_models_spec.rb +53 -0
- data/spec/swagger_v2/boolean_params_spec.rb +1 -1
- data/spec/swagger_v2/inheritance_and_discriminator_spec.rb +56 -0
- data/spec/swagger_v2/reference_entity_spec.rb +74 -29
- data/spec/swagger_v2/security_requirement_spec.rb +2 -2
- metadata +17 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a3f65f49a31d6affe69a657daff3867582070436163992acb47f1166dde1cc6
|
4
|
+
data.tar.gz: da9f13e2efd7e2b23dc92eea5b9deeaf4d9b8a860b13bae2b7f928b31d996be3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d51d5cde5ff558fefcbf8b4503d290bc535c48f22d1ee3c2662ad406c548b7ef72d196b36598b2d3ea68d6ebef8e6ce43e3dec8dab6f371df9d12aaadd34567
|
7
|
+
data.tar.gz: b22301456da8cd150767fd614434bfad161959eb0836b028b4ff8d15893fd128c53513e87ab8180a6442b8fda9ec41a6e6648b67cb32a46b692d2b117e229ec1
|
data/.rubocop.yml
CHANGED
@@ -4,11 +4,17 @@ AllCops:
|
|
4
4
|
Exclude:
|
5
5
|
- vendor/**/*
|
6
6
|
- example/**/*
|
7
|
+
NewCops: enable
|
7
8
|
TargetRubyVersion: 2.7
|
8
9
|
|
10
|
+
# Layout stuff
|
11
|
+
#
|
9
12
|
Layout/EmptyLinesAroundArguments:
|
10
13
|
Enabled: false
|
11
14
|
|
15
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
16
|
+
Enabled: true
|
17
|
+
|
12
18
|
Layout/FirstHashElementIndentation:
|
13
19
|
EnforcedStyle: consistent
|
14
20
|
|
@@ -17,6 +23,28 @@ Layout/LineLength:
|
|
17
23
|
Exclude:
|
18
24
|
- spec/**/*
|
19
25
|
|
26
|
+
Layout/SpaceAroundMethodCallOperator:
|
27
|
+
Enabled: true
|
28
|
+
|
29
|
+
# Lint stuff
|
30
|
+
#
|
31
|
+
Lint/DeprecatedOpenSSLConstant:
|
32
|
+
Enabled: true
|
33
|
+
|
34
|
+
Lint/DuplicateElsifCondition:
|
35
|
+
Enabled: true
|
36
|
+
|
37
|
+
Lint/MixedRegexpCaptureTypes:
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
Lint/RaiseException:
|
41
|
+
Enabled: true
|
42
|
+
|
43
|
+
Lint/StructNewOverride:
|
44
|
+
Enabled: true
|
45
|
+
|
46
|
+
# Metrics stuff
|
47
|
+
#
|
20
48
|
Metrics/BlockLength:
|
21
49
|
Exclude:
|
22
50
|
- spec/**/*
|
@@ -24,12 +52,70 @@ Metrics/BlockLength:
|
|
24
52
|
Metrics/ClassLength:
|
25
53
|
Max: 300
|
26
54
|
|
55
|
+
Metrics/CyclomaticComplexity:
|
56
|
+
Max: 17
|
57
|
+
|
27
58
|
Metrics/MethodLength:
|
28
59
|
Exclude:
|
29
60
|
- spec/**/*
|
30
61
|
|
62
|
+
# Naming stuff
|
63
|
+
#
|
31
64
|
Naming:
|
32
65
|
Enabled: false
|
33
66
|
|
67
|
+
# Style stuff
|
68
|
+
#
|
69
|
+
Style/AccessorGrouping:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Style/ArrayCoercion:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
Style/BisectedAttrAccessor:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Style/CaseLikeIf:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
Style/ExponentialNotation:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
Style/ExplicitBlockArgument:
|
85
|
+
Enabled: false
|
86
|
+
|
87
|
+
Style/HashAsLastArrayItem:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
Style/HashEachMethods:
|
91
|
+
Enabled: true
|
92
|
+
|
93
|
+
Style/HashLikeCase:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
Style/HashTransformKeys:
|
97
|
+
Enabled: true
|
98
|
+
|
99
|
+
Style/HashTransformValues:
|
100
|
+
Enabled: true
|
101
|
+
|
34
102
|
Style/RegexpLiteral:
|
35
103
|
Enabled: false
|
104
|
+
|
105
|
+
Style/RedundantAssignment:
|
106
|
+
Enabled: true
|
107
|
+
|
108
|
+
Style/RedundantFetchBlock:
|
109
|
+
Enabled: true
|
110
|
+
|
111
|
+
Style/RedundantFileExtensionInRequire:
|
112
|
+
Enabled: true
|
113
|
+
|
114
|
+
Style/RedundantRegexpCharacterClass:
|
115
|
+
Enabled: true
|
116
|
+
|
117
|
+
Style/RedundantRegexpEscape:
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
Style/SlicingWithRange:
|
121
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
|
+
os: linux
|
4
|
+
|
3
5
|
before_install:
|
4
6
|
- gem install bundler
|
5
7
|
|
@@ -7,27 +9,32 @@ after_success:
|
|
7
9
|
- bundle exec danger
|
8
10
|
|
9
11
|
rvm:
|
10
|
-
- 2.5.
|
11
|
-
- 2.6.
|
12
|
-
- 2.7.
|
12
|
+
- 2.5.8
|
13
|
+
- 2.6.6
|
14
|
+
- 2.7.1
|
13
15
|
env:
|
14
|
-
- GRAPE_VERSION=1.
|
15
|
-
- GRAPE_VERSION=1.
|
16
|
-
- GRAPE_VERSION=1.0
|
17
|
-
- GRAPE_VERSION=1.
|
16
|
+
- GRAPE_VERSION=1.3.3
|
17
|
+
- GRAPE_VERSION=1.4.0 MODEL_PARSER=grape-swagger-entity
|
18
|
+
- GRAPE_VERSION=1.4.0 MODEL_PARSER=grape-swagger-representable
|
19
|
+
- GRAPE_VERSION=1.4.0
|
20
|
+
- GRAPE_VERSION=HEAD
|
18
21
|
|
19
|
-
|
22
|
+
jobs:
|
20
23
|
fast_finish: true
|
21
24
|
|
22
25
|
include:
|
23
|
-
- rvm: 2.4.
|
24
|
-
env:
|
26
|
+
- rvm: 2.4.10
|
27
|
+
env:
|
25
28
|
- rvm: ruby-head
|
26
|
-
env:
|
29
|
+
env:
|
27
30
|
- rvm: jruby-head
|
28
31
|
env:
|
32
|
+
- rvm: truffleruby-head
|
33
|
+
env:
|
34
|
+
script: bundle exec rake spec
|
29
35
|
|
30
36
|
allow_failures:
|
31
|
-
- rvm: 2.4.
|
37
|
+
- rvm: 2.4.10
|
32
38
|
- rvm: ruby-head
|
33
39
|
- rvm: jruby-head
|
40
|
+
- rvm: truffleruby-head
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,53 @@
|
|
6
6
|
|
7
7
|
#### Fixes
|
8
8
|
|
9
|
+
* Your contribution here.
|
10
|
+
|
11
|
+
|
12
|
+
### 1.3.0 (September 3, 2020)
|
13
|
+
|
14
|
+
#### Features
|
15
|
+
|
16
|
+
* [#804](https://github.com/ruby-grape/grape-swagger/pull/804): Don't overwrite model description with the route description - [@Bhacaz](https://github.com/Bhacaz).
|
17
|
+
|
18
|
+
|
19
|
+
### 1.2.1 (July 15, 2020)
|
20
|
+
|
21
|
+
#### Fixes
|
22
|
+
|
23
|
+
* [#801](https://github.com/ruby-grape/grape-swagger/pull/801): Fixes behaviour after grape upgrade to 1.4.0 - [@LeFnord](https://github.com/LeFnord).
|
24
|
+
|
25
|
+
|
26
|
+
### 1.2.0 (July 1, 2020)
|
27
|
+
|
28
|
+
#### Features
|
29
|
+
|
30
|
+
* [#794](https://github.com/ruby-grape/grape-swagger/pull/794): Allow `entity_name` to be inherited, fixes issue #659 - [@urkle](https://github.com/urkle).
|
31
|
+
* [#793](https://github.com/ruby-grape/grape-swagger/pull/793): Features/inheritance and discriminator - [@MaximeRDY](https://github.com/MaximeRDY).
|
32
|
+
|
33
|
+
#### Fixes
|
34
|
+
|
35
|
+
* [#798](https://github.com/ruby-grape/grape-swagger/pull/798): Modify full entity name separator - [@GarrettB71](https://github.com/GarrettB71).
|
36
|
+
* [#796](https://github.com/ruby-grape/grape-swagger/pull/796): Support grape 1.4.0 - [@thedanielhanke](https://github.com/thedanielhanke).
|
37
|
+
|
38
|
+
|
39
|
+
### 1.1.0 (April 20, 2020)
|
40
|
+
|
41
|
+
#### Features
|
42
|
+
|
43
|
+
* [#785](https://github.com/ruby-grape/grape-swagger/pull/785): Add extensions for params - [@MaximeRDY](https://github.com/MaximeRDY).
|
44
|
+
* [#782](https://github.com/ruby-grape/grape-swagger/pull/782): Allow passing class name as string for rake task initializer - [@misdoro](https://github.com/misdoro).
|
45
|
+
* [#786](https://github.com/ruby-grape/grape-swagger/pull/786): Use full entity name as a default - [@mrexox](https://github.com/mrexox).
|
46
|
+
|
47
|
+
|
48
|
+
### 1.0.0 (February 10, 2020)
|
49
|
+
|
50
|
+
#### Features
|
51
|
+
|
52
|
+
* [#777](https://github.com/ruby-grape/grape-swagger/pull/777): Make usage of grape >= 1.3, rack >= 2.1 - [@LeFnord](https://github.com/LeFnord).
|
53
|
+
* [#775](https://github.com/ruby-grape/grape-swagger/pull/775): Add in token_owner support to param hidden procs - [@urkle](https://github.com/urkle).
|
54
|
+
|
55
|
+
|
9
56
|
### 0.34.2 (January 20, 2020)
|
10
57
|
|
11
58
|
#### Fixes
|
@@ -38,10 +85,6 @@
|
|
38
85
|
* [#743](https://github.com/ruby-grape/grape-swagger/pull/743): CI: use 2.4.6, 2.5.5 - [@olleolleolle](https://github.com/olleolleolle).
|
39
86
|
* [#737](https://github.com/ruby-grape/grape-swagger/pull/737): Add swagger endpoint guard to both doc endpoints - [@urkle](https://github.com/urkle).
|
40
87
|
|
41
|
-
#### Changes
|
42
|
-
|
43
|
-
* [#749](https://github.com/ruby-grape/grape-swagger/pull/749) Drop support for Ruby 2.3 and below - [@LeFnord](https://github.com/LeFnord).
|
44
|
-
|
45
88
|
|
46
89
|
### 0.32.1 (December 7, 2018)
|
47
90
|
|
data/Gemfile
CHANGED
@@ -6,7 +6,7 @@ ruby RUBY_VERSION
|
|
6
6
|
|
7
7
|
gemspec
|
8
8
|
|
9
|
-
gem 'grape', case version = ENV['GRAPE_VERSION'] || '
|
9
|
+
gem 'grape', case version = ENV['GRAPE_VERSION'] || '>= 1.4.0'
|
10
10
|
when 'HEAD'
|
11
11
|
{ git: 'https://github.com/ruby-grape/grape' }
|
12
12
|
else
|
@@ -14,23 +14,29 @@ gem 'grape', case version = ENV['GRAPE_VERSION'] || '< 1.3.0'
|
|
14
14
|
end
|
15
15
|
|
16
16
|
gem ENV['MODEL_PARSER'] if ENV.key?('MODEL_PARSER')
|
17
|
+
|
17
18
|
group :development, :test do
|
18
19
|
gem 'bundler'
|
19
20
|
gem 'grape-entity'
|
20
21
|
gem 'pry', platforms: [:mri]
|
21
22
|
gem 'pry-byebug', platforms: [:mri]
|
22
23
|
|
24
|
+
gem 'rack', '~> 2.2'
|
23
25
|
gem 'rack-cors'
|
24
26
|
gem 'rack-test'
|
25
27
|
gem 'rake'
|
26
28
|
gem 'rdoc'
|
27
29
|
gem 'rspec', '~> 3.9'
|
28
|
-
gem 'rubocop', '~> 0.
|
30
|
+
gem 'rubocop', '~> 0.90', require: false
|
29
31
|
end
|
30
32
|
|
31
33
|
group :test do
|
32
34
|
gem 'coveralls_reborn', require: false
|
33
|
-
|
35
|
+
|
34
36
|
gem 'ruby-grape-danger', '~> 0.1.1', require: false
|
35
37
|
gem 'simplecov', require: false
|
38
|
+
|
39
|
+
unless ENV['MODEL_PARSER'] == 'grape-swagger-entity'
|
40
|
+
gem 'grape-swagger-entity', git: 'https://github.com/ruby-grape/grape-swagger-entity'
|
41
|
+
end
|
36
42
|
end
|
data/README.md
CHANGED
@@ -43,15 +43,16 @@ This screenshot is based on the [Hussars](https://github.com/LeFnord/hussars) sa
|
|
43
43
|
|
44
44
|
The following versions of grape, grape-entity and grape-swagger can currently be used together.
|
45
45
|
|
46
|
-
grape-swagger | swagger spec | grape | grape-entity | representable |
|
47
|
-
|
48
|
-
0.10.5 |
|
49
|
-
0.11.0 |
|
50
|
-
0.25.2 |
|
51
|
-
0.26.0 |
|
52
|
-
0.27.0 |
|
53
|
-
0.32.0 |
|
54
|
-
0.34.0 |
|
46
|
+
| grape-swagger | swagger spec | grape | grape-entity | representable |
|
47
|
+
| ------------- | ------------ | ----------------------- | ------------ | ------------- |
|
48
|
+
| 0.10.5 | 1.2 | >= 0.10.0 ... <= 0.14.0 | < 0.5.0 | n/a |
|
49
|
+
| 0.11.0 | 1.2 | >= 0.16.2 | < 0.5.0 | n/a |
|
50
|
+
| 0.25.2 | 2.0 | >= 0.14.0 ... <= 0.18.0 | <= 0.6.0 | >= 2.4.1 |
|
51
|
+
| 0.26.0 | 2.0 | >= 0.16.2 ... <= 1.1.0 | <= 0.6.1 | >= 2.4.1 |
|
52
|
+
| 0.27.0 | 2.0 | >= 0.16.2 ... <= 1.1.0 | >= 0.5.0 | >= 2.4.1 |
|
53
|
+
| 0.32.0 | 2.0 | >= 0.16.2 | >= 0.5.0 | >= 2.4.1 |
|
54
|
+
| 0.34.0 | 2.0 | >= 0.16.2 ... < 1.3.0 | >= 0.5.0 | >= 2.4.1 |
|
55
|
+
| >= 1.0.0 | 2.0 | >= 1.3.0 | >= 0.5.0 | >= 2.4.1 |
|
55
56
|
|
56
57
|
|
57
58
|
## Swagger-Spec <a name="swagger-spec"></a>
|
@@ -743,9 +744,12 @@ end
|
|
743
744
|
Exclude single optional parameter from the documentation
|
744
745
|
|
745
746
|
```ruby
|
747
|
+
not_admins = lambda { |token_owner = nil| token_owner.nil? || !token_owner.admin? }
|
748
|
+
|
746
749
|
params do
|
747
750
|
optional :one, documentation: { hidden: true }
|
748
|
-
optional :two, documentation: { hidden: -> { true } }
|
751
|
+
optional :two, documentation: { hidden: -> { |t=nil| true } }
|
752
|
+
optional :three, documentation: { hidden: not_admins }
|
749
753
|
end
|
750
754
|
post :act do
|
751
755
|
...
|
@@ -855,10 +859,11 @@ get '/thing', failure: [
|
|
855
859
|
end
|
856
860
|
```
|
857
861
|
|
858
|
-
By adding a `model` key, e.g. this would be taken.
|
862
|
+
By adding a `model` key, e.g. this would be taken. Setting an empty string will act like an empty body.
|
859
863
|
```ruby
|
860
864
|
get '/thing', failure: [
|
861
865
|
{ code: 400, message: 'General error' },
|
866
|
+
{ code: 403, message: 'Forbidden error', model: '' },
|
862
867
|
{ code: 422, message: 'Invalid parameter entry', model: Entities::ApiError }
|
863
868
|
] do
|
864
869
|
# ...
|
@@ -1080,6 +1085,20 @@ or, for more definitions:
|
|
1080
1085
|
route_setting :x_def, [{ for: 422, other: 'stuff' }, { for: 200, some: 'stuff' }]
|
1081
1086
|
```
|
1082
1087
|
|
1088
|
+
- `params` extension, add a `x` key to the `documentation` hash :
|
1089
|
+
```ruby
|
1090
|
+
requires :foo, type: String, documentation: { x: { some: 'stuff' } }
|
1091
|
+
```
|
1092
|
+
this would generate:
|
1093
|
+
```json
|
1094
|
+
{
|
1095
|
+
"in": "formData",
|
1096
|
+
"name": "foo",
|
1097
|
+
"type": "string",
|
1098
|
+
"required": true,
|
1099
|
+
"x-some": "stuff"
|
1100
|
+
}
|
1101
|
+
```
|
1083
1102
|
|
1084
1103
|
#### Response examples documentation <a name="response-examples"></a>
|
1085
1104
|
|
@@ -1363,6 +1382,94 @@ module API
|
|
1363
1382
|
end
|
1364
1383
|
```
|
1365
1384
|
|
1385
|
+
#### Inheritance with allOf and discriminator
|
1386
|
+
```ruby
|
1387
|
+
module Entities
|
1388
|
+
class Pet < Grape::Entity
|
1389
|
+
expose :type, documentation: {
|
1390
|
+
type: 'string',
|
1391
|
+
is_discriminator: true,
|
1392
|
+
required: true
|
1393
|
+
}
|
1394
|
+
expose :name, documentation: {
|
1395
|
+
type: 'string',
|
1396
|
+
required: true
|
1397
|
+
}
|
1398
|
+
end
|
1399
|
+
|
1400
|
+
class Cat < Pet
|
1401
|
+
expose :huntingSkill, documentation: {
|
1402
|
+
type: 'string',
|
1403
|
+
description: 'The measured skill for hunting',
|
1404
|
+
default: 'lazy',
|
1405
|
+
values: %w[
|
1406
|
+
clueless
|
1407
|
+
lazy
|
1408
|
+
adventurous
|
1409
|
+
aggressive
|
1410
|
+
]
|
1411
|
+
}
|
1412
|
+
end
|
1413
|
+
end
|
1414
|
+
```
|
1415
|
+
|
1416
|
+
Should generate this definitions:
|
1417
|
+
```JSON
|
1418
|
+
{
|
1419
|
+
"definitions": {
|
1420
|
+
"Pet": {
|
1421
|
+
"type": "object",
|
1422
|
+
"discriminator": "petType",
|
1423
|
+
"properties": {
|
1424
|
+
"name": {
|
1425
|
+
"type": "string"
|
1426
|
+
},
|
1427
|
+
"petType": {
|
1428
|
+
"type": "string"
|
1429
|
+
}
|
1430
|
+
},
|
1431
|
+
"required": [
|
1432
|
+
"name",
|
1433
|
+
"petType"
|
1434
|
+
]
|
1435
|
+
},
|
1436
|
+
"Cat": {
|
1437
|
+
"description": "A representation of a cat",
|
1438
|
+
"allOf": [
|
1439
|
+
{
|
1440
|
+
"$ref": "#/definitions/Pet"
|
1441
|
+
},
|
1442
|
+
{
|
1443
|
+
"type": "object",
|
1444
|
+
"properties": {
|
1445
|
+
"huntingSkill": {
|
1446
|
+
"type": "string",
|
1447
|
+
"description": "The measured skill for hunting",
|
1448
|
+
"default": "lazy",
|
1449
|
+
"enum": [
|
1450
|
+
"clueless",
|
1451
|
+
"lazy",
|
1452
|
+
"adventurous",
|
1453
|
+
"aggressive"
|
1454
|
+
]
|
1455
|
+
},
|
1456
|
+
"petType": {
|
1457
|
+
"type": "string",
|
1458
|
+
"enum": ["Cat"]
|
1459
|
+
}
|
1460
|
+
},
|
1461
|
+
"required": [
|
1462
|
+
"huntingSkill",
|
1463
|
+
"petType"
|
1464
|
+
]
|
1465
|
+
}
|
1466
|
+
]
|
1467
|
+
}
|
1468
|
+
}
|
1469
|
+
}
|
1470
|
+
```
|
1471
|
+
|
1472
|
+
|
1366
1473
|
|
1367
1474
|
|
1368
1475
|
## Securing the Swagger UI <a name="oauth"></a>
|
@@ -1482,13 +1589,19 @@ end
|
|
1482
1589
|
|
1483
1590
|
## Rake Tasks <a name="rake"></a>
|
1484
1591
|
|
1485
|
-
Add these lines to your Rakefile, and initialize the Task class with your Api class
|
1592
|
+
Add these lines to your Rakefile, and initialize the Task class with your Api class.
|
1486
1593
|
|
1487
1594
|
```ruby
|
1488
1595
|
require 'grape-swagger/rake/oapi_tasks'
|
1489
1596
|
GrapeSwagger::Rake::OapiTasks.new(::Api::Base)
|
1490
1597
|
```
|
1491
1598
|
|
1599
|
+
You may initialize with the class name as a string if the class is not yet loaded at the time Rakefile is parsed:
|
1600
|
+
```ruby
|
1601
|
+
require 'grape-swagger/rake/oapi_tasks'
|
1602
|
+
GrapeSwagger::Rake::OapiTasks.new('::Api::Base')
|
1603
|
+
```
|
1604
|
+
|
1492
1605
|
#### OpenApi/Swagger Documentation
|
1493
1606
|
|
1494
1607
|
```
|