grape-swagger 0.26.0 → 0.26.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.gitignore +1 -0
- data/.rspec +0 -1
- data/.rubocop.yml +4 -0
- data/.travis.yml +26 -24
- data/CHANGELOG.md +14 -0
- data/Gemfile +3 -5
- data/README.md +9 -85
- data/UPGRADING.md +9 -0
- data/lib/grape-swagger.rb +20 -71
- data/lib/grape-swagger/doc_methods.rb +4 -6
- data/lib/grape-swagger/doc_methods/parse_params.rb +5 -9
- data/lib/grape-swagger/doc_methods/tag_name_description.rb +18 -5
- data/lib/grape-swagger/endpoint.rb +8 -10
- data/lib/grape-swagger/errors.rb +7 -6
- data/lib/grape-swagger/rake/oapi_tasks.rb +5 -1
- data/lib/grape-swagger/version.rb +1 -1
- data/spec/issues/532_allow_custom_format_spec.rb +36 -0
- data/spec/issues/537_enum_values_spec.rb +47 -0
- data/spec/issues/572_array_post_body_spec.rb +49 -0
- data/spec/lib/endpoint_spec.rb +42 -1
- data/spec/lib/extensions_spec.rb +42 -0
- data/spec/lib/oapi_tasks_spec.rb +13 -2
- data/spec/lib/operation_id_spec.rb +1 -5
- data/spec/lib/parse_params_spec.rb +58 -0
- data/spec/lib/tag_name_description_spec.rb +77 -0
- data/spec/lib/version_spec.rb +26 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/swagger_v2/api_swagger_v2_detail_spec.rb +1 -77
- data/spec/swagger_v2/description_not_initialized.rb +1 -1
- data/spec/swagger_v2/guarded_endpoint_spec.rb +2 -2
- metadata +16 -9
- data/lib/grape-swagger/markdown/kramdown_adapter.rb +0 -37
- data/lib/grape-swagger/markdown/redcarpet_adapter.rb +0 -92
- data/spec/markdown/kramdown_adapter_spec.rb +0 -31
- data/spec/markdown/redcarpet_adapter_spec.rb +0 -66
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5d302ec60b3bef72593d98458853f1b55cfa9be
|
4
|
+
data.tar.gz: a58b6ce813533e111d2292959821bb932e581358
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3e31c1740c6605ca8f59a07aeb0b1105ef9d1b789c526f3c212b582bcf36527362ea3f0843b2f5c8cb457659e37177cd9e3a04afbb09a39be5c55c07b41069d
|
7
|
+
data.tar.gz: 6fc0e0f55ad293e48696ce9721fccba8febb38ceebb85ee9990ef91d03b2c94beb5891875f1c84ef22ac7aaff42bc532a649ebf77e5617583f8053b8528e5713
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,40 +1,42 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
sudo: false
|
4
|
+
|
4
5
|
before_install:
|
6
|
+
- gem update --system
|
5
7
|
- gem install bundler
|
6
8
|
|
9
|
+
after_success:
|
10
|
+
- bundle exec danger
|
11
|
+
- coveralls
|
12
|
+
|
13
|
+
rvm:
|
14
|
+
- 2.4.0
|
15
|
+
- 2.3.3
|
16
|
+
|
17
|
+
env:
|
18
|
+
- MODEL_PARSER=grape-swagger-entity
|
19
|
+
- MODEL_PARSER=grape-swagger-representable
|
20
|
+
- GRAPE_VERSION=0.16.2
|
21
|
+
- GRAPE_VERSION=0.17.0
|
22
|
+
- GRAPE_VERSION=0.18.0
|
23
|
+
- GRAPE_VERSION=0.19.1
|
24
|
+
- GRAPE_VERSION=HEAD
|
25
|
+
|
7
26
|
matrix:
|
27
|
+
fast_finish: true
|
28
|
+
|
8
29
|
include:
|
9
|
-
- rvm: 2.4.0
|
10
|
-
script:
|
11
|
-
- bundle exec danger
|
12
|
-
- rvm: 2.4.0
|
13
|
-
env: MODEL_PARSER=grape-swagger-entity
|
14
|
-
- rvm: 2.4.0
|
15
|
-
env: MODEL_PARSER=grape-swagger-representable
|
16
|
-
- rvm: 2.4.0
|
17
|
-
env: GRAPE_VERSION=0.16.2
|
18
|
-
- rvm: 2.4.0
|
19
|
-
env: GRAPE_VERSION=0.17.0
|
20
|
-
- rvm: 2.4.0
|
21
|
-
env: GRAPE_VERSION=0.18.0
|
22
|
-
- rvm: 2.4.0
|
23
|
-
env: GRAPE_VERSION=0.19.0
|
24
|
-
- rvm: 2.4.0
|
25
|
-
env: GRAPE_VERSION=HEAD
|
26
|
-
- rvm: 2.3.3
|
27
|
-
env: MODEL_PARSER=grape-swagger-entity
|
28
|
-
- rvm: 2.3.3
|
29
|
-
env: MODEL_PARSER=grape-swagger-representable
|
30
|
-
- rvm: 2.3.3
|
31
30
|
- rvm: 2.2.6
|
31
|
+
env:
|
32
32
|
- rvm: ruby-head
|
33
|
-
|
33
|
+
env:
|
34
34
|
- rvm: jruby-head
|
35
|
+
env:
|
35
36
|
- rvm: rbx-2
|
37
|
+
env:
|
38
|
+
|
36
39
|
allow_failures:
|
37
40
|
- rvm: ruby-head
|
38
|
-
- rvm: jruby-9.1.6.0
|
39
41
|
- rvm: jruby-head
|
40
42
|
- rvm: rbx-2
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,20 @@
|
|
8
8
|
|
9
9
|
* Your contribution here.
|
10
10
|
|
11
|
+
### 0.26.1 (February 3, 2014)
|
12
|
+
|
13
|
+
#### Features
|
14
|
+
|
15
|
+
* [#567](https://github.com/ruby-grape/grape-swagger/pull/567): Issue#566: removes markdown - [@LeFnord](https://github.com/LeFnord).
|
16
|
+
* [#568](https://github.com/ruby-grape/grape-swagger/pull/568): Adds code coverage w/ coveralls - [@LeFnord](https://github.com/LeFnord).
|
17
|
+
* [#570](https://github.com/ruby-grape/grape-swagger/pull/570): Removes dead code -> increases code coverage - [@LeFnord](https://github.com/LeFnord).
|
18
|
+
* [#576](https://github.com/ruby-grape/grape-swagger/pull/576): Allows custom format, for params and definition properties - [@LeFnord](https://github.com/LeFnord).
|
19
|
+
|
20
|
+
#### Fixes
|
21
|
+
|
22
|
+
* [#562](https://github.com/ruby-grape/grape-swagger/pull/562): The guard method should allow regular object methods as arguments - [@tim-vandecasteele](https://github.com/tim-vandecasteele).
|
23
|
+
* [#574](https://github.com/ruby-grape/grape-swagger/pull/574): Fixes #572: `is_array` should only be applied to success - [@LeFnord](https://github.com/LeFnord).
|
24
|
+
|
11
25
|
### 0.26.0 (January 9, 2017)
|
12
26
|
|
13
27
|
#### Features
|
data/Gemfile
CHANGED
@@ -15,7 +15,6 @@ gem ENV['MODEL_PARSER'] if ENV.key?('MODEL_PARSER')
|
|
15
15
|
|
16
16
|
group :development, :test do
|
17
17
|
gem 'bundler'
|
18
|
-
gem 'kramdown'
|
19
18
|
gem 'pry', platforms: [:mri]
|
20
19
|
gem 'pry-byebug', platforms: [:mri]
|
21
20
|
gem 'rack'
|
@@ -23,14 +22,13 @@ group :development, :test do
|
|
23
22
|
gem 'rack-test'
|
24
23
|
gem 'rake'
|
25
24
|
gem 'rdoc'
|
26
|
-
gem 'redcarpet', '< 3.4', platforms: [:mri]
|
27
|
-
gem 'rouge', platforms: [:mri]
|
28
25
|
gem 'rspec', '~> 3.0'
|
29
|
-
gem 'rubocop', '~> 0.
|
30
|
-
gem 'shoulda'
|
26
|
+
gem 'rubocop', '~> 0.46'
|
31
27
|
end
|
32
28
|
group :test do
|
29
|
+
gem 'coveralls', require: false
|
33
30
|
gem 'grape-entity'
|
34
31
|
gem 'grape-swagger-entity'
|
35
32
|
gem 'ruby-grape-danger', '~> 0.1.1', require: false
|
33
|
+
gem 'simplecov', require: false
|
36
34
|
end
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/grape-swagger.svg)](http://badge.fury.io/rb/grape-swagger)
|
2
2
|
[![Build Status](https://travis-ci.org/ruby-grape/grape-swagger.svg?branch=master)](https://travis-ci.org/ruby-grape/grape-swagger)
|
3
|
+
[![Coverage Status](https://coveralls.io/repos/github/ruby-grape/grape-swagger/badge.svg?branch=master)](https://coveralls.io/github/ruby-grape/grape-swagger?branch=master)
|
3
4
|
[![Dependency Status](https://gemnasium.com/ruby-grape/grape-swagger.svg)](https://gemnasium.com/ruby-grape/grape-swagger)
|
4
5
|
[![Code Climate](https://codeclimate.com/github/ruby-grape/grape-swagger.svg)](https://codeclimate.com/github/ruby-grape/grape-swagger)
|
5
6
|
|
@@ -16,7 +17,7 @@
|
|
16
17
|
* [Routes Configuration](#routes)
|
17
18
|
* [Using Grape Entities](#grape-entity)
|
18
19
|
* [Securing the Swagger UI](#oauth)
|
19
|
-
* [Markdown](#md_usage)
|
20
|
+
* [Markdown (deprecated)](#md_usage)
|
20
21
|
* [Example](#example)
|
21
22
|
* [Rake Tasks](#rake)
|
22
23
|
|
@@ -62,7 +63,7 @@ grape-swagger | swagger spec | grape | grape-entity | represen
|
|
62
63
|
|
63
64
|
Grape-swagger generates documentation per [Swagger / OpenAPI Spec 2.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md).
|
64
65
|
|
65
|
-
<!-- validating: http://bigstickcarpet.com/swagger-parser/www/index.html -->
|
66
|
+
<!-- validating it with: http://bigstickcarpet.com/swagger-parser/www/index.html -->
|
66
67
|
|
67
68
|
<a name="install" />
|
68
69
|
## Installation
|
@@ -196,7 +197,6 @@ end
|
|
196
197
|
* [add_base_path](#add_base_path)
|
197
198
|
* [add_version](#add_version)
|
198
199
|
* [doc_version](#doc_version)
|
199
|
-
* [markdown](#markdown)
|
200
200
|
* [endpoint_auth_wrapper](#endpoint_auth_wrapper)
|
201
201
|
* [swagger_endpoint_guard](#swagger_endpoint_guard)
|
202
202
|
* [token_owner](#token_owner)
|
@@ -268,18 +268,8 @@ add_swagger_documentation \
|
|
268
268
|
```
|
269
269
|
|
270
270
|
<a name="markdown" />
|
271
|
-
#### markdown:
|
272
|
-
|
273
|
-
|
274
|
-
```ruby
|
275
|
-
add_swagger_documentation \
|
276
|
-
markdown: GrapeSwagger::Markdown::KramdownAdapter.new
|
277
|
-
```
|
278
|
-
or alternative
|
279
|
-
```ruby
|
280
|
-
add_swagger_documentation \
|
281
|
-
markdown: GrapeSwagger::Markdown::RedcarpetAdapter.new
|
282
|
-
```
|
271
|
+
#### markdown: (deprecated)
|
272
|
+
OAPI accepts GFM for descriptions
|
283
273
|
|
284
274
|
<a name="endpoint_auth_wrapper" />
|
285
275
|
#### endpoint_auth_wrapper:
|
@@ -1087,77 +1077,11 @@ The lambda is checking whether the user is authenticated (if not, the token_owne
|
|
1087
1077
|
role - only admins can see this endpoint.
|
1088
1078
|
|
1089
1079
|
<a name="md_usage" />
|
1090
|
-
## Markdown in Detail
|
1091
|
-
|
1092
|
-
The grape-swagger gem allows you to add an explanation in markdown in the detail field. Which would result in proper formatted markdown in Swagger UI.
|
1093
|
-
Grape-swagger uses adapters for several markdown formatters. It includes adapters for [kramdown](http://kramdown.rubyforge.org) (kramdown [syntax](http://kramdown.rubyforge.org/syntax.html)) and [redcarpet](https://github.com/vmg/redcarpet).
|
1094
|
-
The adapters are packed in the GrapeSwagger::Markdown modules. We do not include the markdown gems in our gemfile, so be sure to include or install the depended gems.
|
1095
|
-
|
1096
|
-
To use it, add a new instance of the adapter to the markdown options of `add_swagger_documentation`, such as:
|
1097
|
-
```ruby
|
1098
|
-
add_swagger_documentation \
|
1099
|
-
markdown: GrapeSwagger::Markdown::KramdownAdapter.new(options)
|
1100
|
-
```
|
1101
|
-
and write your route details in GFM, examples could be find in [details spec](blob/master/spec/swagger_v2/api_swagger_v2_detail_spec.rb)
|
1102
|
-
|
1103
|
-
|
1104
|
-
#### Kramdown
|
1105
|
-
If you want to use kramdown as markdown formatter, you need to add kramdown to your gemfile.
|
1106
|
-
|
1107
|
-
```ruby
|
1108
|
-
gem 'kramdown'
|
1109
|
-
```
|
1110
|
-
|
1111
|
-
Configure your api documentation route with:
|
1112
|
-
```ruby
|
1113
|
-
add_swagger_documentation \
|
1114
|
-
markdown: GrapeSwagger::Markdown::KramdownAdapter.new(options)
|
1115
|
-
```
|
1116
|
-
|
1080
|
+
## Markdown in Detail (deprecated)
|
1117
1081
|
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
```ruby
|
1122
|
-
gem 'redcarpet'
|
1123
|
-
gem 'rouge'
|
1124
|
-
```
|
1125
|
-
|
1126
|
-
Configure your api documentation route with:
|
1127
|
-
|
1128
|
-
```ruby
|
1129
|
-
add_swagger_documentation(
|
1130
|
-
markdown: GrapeSwagger::Markdown::RedcarpetAdapter.new(render_options: { highlighter: :rouge })
|
1131
|
-
)
|
1132
|
-
```
|
1133
|
-
|
1134
|
-
Alternatively you can disable rouge by adding `:none` as highlighter option. You can add redcarpet extensions and render options trough the `extenstions:` and `render_options:` parameters.
|
1135
|
-
|
1136
|
-
|
1137
|
-
#### Custom markdown formatter
|
1138
|
-
|
1139
|
-
You can also add your custom adapter for your favourite markdown formatter, as long it responds to the method `markdown(text)` and it formats the given text.
|
1140
|
-
|
1141
|
-
|
1142
|
-
```ruby
|
1143
|
-
module API
|
1144
|
-
|
1145
|
-
class FancyAdapter
|
1146
|
-
attr_reader :adapter
|
1147
|
-
|
1148
|
-
def initialize(options)
|
1149
|
-
require 'superbmarkdownformatter'
|
1150
|
-
@adapter = SuperbMarkdownFormatter.new options
|
1151
|
-
end
|
1152
|
-
|
1153
|
-
def markdown(text)
|
1154
|
-
@adapter.render_supreme(text)
|
1155
|
-
end
|
1156
|
-
end
|
1157
|
-
|
1158
|
-
add_swagger_documentation markdown: FancyAdapter.new(no_links: true)
|
1159
|
-
end
|
1160
|
-
```
|
1082
|
+
Usage of option `markdown` won't no longer be supported,
|
1083
|
+
cause OAPI accepts [GFM](https://help.github.com/articles/github-flavored-markdown) and plain text.
|
1084
|
+
(see: [description of `Info`](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#info-object))
|
1161
1085
|
|
1162
1086
|
|
1163
1087
|
<a="example" />
|
data/UPGRADING.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## Upgrading Grape-swagger
|
2
2
|
|
3
|
+
### Upgrading to >= 0.26.1
|
4
|
+
|
5
|
+
The format can now be specified,
|
6
|
+
to achieve it for definition properties one have to use grape-swagger-entity >= 0.1.6.
|
7
|
+
|
8
|
+
Usage of option `markdown` won't no longer be supported,
|
9
|
+
cause OAPI accepts [GFM](https://help.github.com/articles/github-flavored-markdown) and plain text.
|
10
|
+
(see: [description of `Info`](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#info-object))
|
11
|
+
|
3
12
|
### Upgrading to >= 0.25.2
|
4
13
|
|
5
14
|
Avoids ambiguous documentation of array parameters,
|
data/lib/grape-swagger.rb
CHANGED
@@ -7,9 +7,6 @@ require 'grape-swagger/errors'
|
|
7
7
|
require 'grape-swagger/doc_methods'
|
8
8
|
require 'grape-swagger/model_parsers'
|
9
9
|
|
10
|
-
require 'grape-swagger/markdown/kramdown_adapter'
|
11
|
-
require 'grape-swagger/markdown/redcarpet_adapter'
|
12
|
-
|
13
10
|
module GrapeSwagger
|
14
11
|
class << self
|
15
12
|
def model_parsers
|
@@ -79,11 +76,8 @@ module Grape
|
|
79
76
|
|
80
77
|
def combine_namespaces(app)
|
81
78
|
app.endpoints.each do |endpoint|
|
82
|
-
ns =
|
83
|
-
|
84
|
-
else
|
85
|
-
endpoint.settings.stack.last[:namespace]
|
86
|
-
end
|
79
|
+
ns = endpoint.namespace_stackable(:namespace).last
|
80
|
+
|
87
81
|
# use the full namespace here (not the latest level only)
|
88
82
|
# and strip leading slash
|
89
83
|
mount_path = (endpoint.namespace_stackable(:mount_path) || []).join('/')
|
@@ -96,7 +90,7 @@ module Grape
|
|
96
90
|
|
97
91
|
def combine_namespace_routes(namespaces)
|
98
92
|
# iterate over each single namespace
|
99
|
-
namespaces.each do |name,
|
93
|
+
namespaces.each do |name, _|
|
100
94
|
# get the parent route for the namespace
|
101
95
|
parent_route_name = extract_parent_route(name)
|
102
96
|
parent_route = @target_class.combined_routes[parent_route_name]
|
@@ -105,55 +99,28 @@ module Grape
|
|
105
99
|
!route_path_start_with?(route, name) || !route_instance_variable_equals?(route, name)
|
106
100
|
end
|
107
101
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
@target_class.combined_namespace_routes
|
122
|
-
|
123
|
-
|
124
|
-
standalone_namespaces = namespaces.reject do |_, ns|
|
125
|
-
!ns.options.key?(:swagger) ||
|
126
|
-
!ns.options[:swagger].key?(:nested) ||
|
127
|
-
ns.options[:swagger][:nested] != false
|
128
|
-
end
|
129
|
-
|
130
|
-
parent_standalone_namespaces = standalone_namespaces.reject { |ns_name, _| !name.start_with?(ns_name) }
|
131
|
-
# add only to the main route
|
132
|
-
# if the namespace is not within any other namespace appearing as standalone resource
|
133
|
-
if parent_standalone_namespaces.empty?
|
134
|
-
# default option, append namespace methods to parent route
|
135
|
-
parent_route = @target_class.combined_namespace_routes.key?(parent_route_name)
|
136
|
-
@target_class.combined_namespace_routes[parent_route_name] = [] unless parent_route
|
137
|
-
@target_class.combined_namespace_routes[parent_route_name].push(*namespace_routes)
|
138
|
-
end
|
102
|
+
# default case when not explicitly specified or nested == true
|
103
|
+
standalone_namespaces = namespaces.reject do |_, ns|
|
104
|
+
!ns.options.key?(:swagger) ||
|
105
|
+
!ns.options[:swagger].key?(:nested) ||
|
106
|
+
ns.options[:swagger][:nested] != false
|
107
|
+
end
|
108
|
+
|
109
|
+
parent_standalone_namespaces = standalone_namespaces.reject { |ns_name, _| !name.start_with?(ns_name) }
|
110
|
+
# add only to the main route
|
111
|
+
# if the namespace is not within any other namespace appearing as standalone resource
|
112
|
+
# rubocop:disable Style/Next
|
113
|
+
if parent_standalone_namespaces.empty?
|
114
|
+
# default option, append namespace methods to parent route
|
115
|
+
parent_route = @target_class.combined_namespace_routes.key?(parent_route_name)
|
116
|
+
@target_class.combined_namespace_routes[parent_route_name] = [] unless parent_route
|
117
|
+
@target_class.combined_namespace_routes[parent_route_name].push(*namespace_routes)
|
139
118
|
end
|
140
119
|
end
|
141
120
|
end
|
142
121
|
|
143
122
|
def extract_parent_route(name)
|
144
|
-
|
145
|
-
return route_name unless route_name.include? ':'
|
146
|
-
name.match(/\/[a-z]+/)[0].delete('/')
|
147
|
-
end
|
148
|
-
|
149
|
-
def sub_routes_from(parent_route, sub_namespaces)
|
150
|
-
sub_ns_paths = sub_namespaces.collect { |ns_name, _| ["/#{ns_name}", "/:version/#{ns_name}"] }
|
151
|
-
sub_routes = parent_route.reject do |route|
|
152
|
-
parent_namespace = route_instance_variable(route)
|
153
|
-
!sub_ns_paths.assoc(parent_namespace) && !sub_ns_paths.rassoc(parent_namespace)
|
154
|
-
end
|
155
|
-
|
156
|
-
sub_routes
|
123
|
+
name.match(%r{^/?([^/]*).*$})[1]
|
157
124
|
end
|
158
125
|
|
159
126
|
def route_instance_variable(route)
|
@@ -172,24 +139,6 @@ module Grape
|
|
172
139
|
route.path.start_with?(route_prefix, route_versioned_prefix)
|
173
140
|
end
|
174
141
|
|
175
|
-
def standalone_sub_namespaces(name, namespaces)
|
176
|
-
# assign all nested namespace routes to this resource, too
|
177
|
-
# (unless they are assigned to another standalone namespace themselves)
|
178
|
-
sub_namespaces = {}
|
179
|
-
# fetch all namespaces that are children of the current namespace
|
180
|
-
namespaces.each { |ns_name, ns| sub_namespaces[ns_name] = ns if ns_name.start_with?(name) && ns_name != name }
|
181
|
-
# remove the sub namespaces if they are assigned to another standalone namespace themselves
|
182
|
-
sub_namespaces.each do |sub_name, sub_ns|
|
183
|
-
# skip if sub_ns is standalone, too
|
184
|
-
next unless sub_ns.options.key?(:swagger) && sub_ns.options[:swagger][:nested] == false
|
185
|
-
# remove all namespaces that are nested below this standalone sub_ns
|
186
|
-
sub_namespaces.each do |sub_sub_name, _|
|
187
|
-
sub_namespaces.delete(sub_sub_name) if sub_sub_name.start_with?(sub_name)
|
188
|
-
end
|
189
|
-
end
|
190
|
-
sub_namespaces
|
191
|
-
end
|
192
|
-
|
193
142
|
def create_documentation_class
|
194
143
|
Class.new(Grape::API) do
|
195
144
|
extend GrapeSwagger::DocMethods
|
@@ -14,10 +14,6 @@ require 'grape-swagger/doc_methods/version'
|
|
14
14
|
|
15
15
|
module GrapeSwagger
|
16
16
|
module DocMethods
|
17
|
-
def name
|
18
|
-
@@class_name
|
19
|
-
end
|
20
|
-
|
21
17
|
def hide_documentation_path
|
22
18
|
@@hide_documentation_path
|
23
19
|
end
|
@@ -27,6 +23,9 @@ module GrapeSwagger
|
|
27
23
|
end
|
28
24
|
|
29
25
|
def setup(options)
|
26
|
+
# FIXME: move out after next minor is released
|
27
|
+
GrapeSwagger::Errors::SwaggerSpecDeprecated.tell!(options[:markdown]) if options.key?(:markdown)
|
28
|
+
|
30
29
|
options = defaults.merge(options)
|
31
30
|
|
32
31
|
# options could be set on #add_swagger_documentation call,
|
@@ -43,7 +42,7 @@ module GrapeSwagger
|
|
43
42
|
end
|
44
43
|
end
|
45
44
|
|
46
|
-
|
45
|
+
instance_eval(guard) unless guard.nil?
|
47
46
|
|
48
47
|
output_path_definitions = proc do |combi_routes, endpoint|
|
49
48
|
output = endpoint.swagger_object(
|
@@ -93,7 +92,6 @@ module GrapeSwagger
|
|
93
92
|
base_path: nil,
|
94
93
|
add_base_path: false,
|
95
94
|
add_version: true,
|
96
|
-
markdown: false,
|
97
95
|
hide_documentation_path: true,
|
98
96
|
format: :json,
|
99
97
|
authorizations: nil,
|