grape-swagger 0.20.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/Gemfile +1 -1
- data/README.md +33 -40
- data/grape-swagger.gemspec +1 -1
- data/lib/grape-swagger/doc_methods.rb +0 -1
- data/lib/grape-swagger/endpoint.rb +1 -0
- data/lib/grape-swagger/version.rb +1 -1
- data/spec/support/api_swagger_v2_result.rb +4 -5
- data/spec/swagger_v2/api_swagger_v2_response_spec.rb +0 -3
- data/spec/swagger_v2/api_swagger_v2_type-format_spec.rb +28 -28
- data/spec/swagger_v2/default_api_spec.rb +0 -2
- data/spec/swagger_v2/hide_api_spec.rb +0 -3
- data/spec/swagger_v2/mounted_target_class_spec.rb +0 -2
- data/spec/swagger_v2/response_model_spec.rb +20 -20
- data/spec/swagger_v2/simple_mounted_api_spec.rb +0 -3
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7b49d3317f5b9d9082b501e10b2a7fd14715cbc
|
4
|
+
data.tar.gz: badfe74ba2b87d06cdfd44c98e9ce3e26a9bb30e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bff5776130052d3c48d45a2a26bc59cef0ad264bfd5adaf197280019ba79476c5e8e6c9566a7c345b595664df5e27ccc259986c9d94d010873636a6d9e49eb6b
|
7
|
+
data.tar.gz: 1685bef67cd8be2e477dab910d42e1236409b38040a34f08697ccc3fdd5ae8871d73b05b00e25f1c8b1ab96f3f158d8f9ee8c6817e83532bd9f5bb2044137ad1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
### x.xx.x (next)
|
2
|
+
|
3
|
+
#### Features
|
4
|
+
|
5
|
+
#### Fixes
|
6
|
+
|
7
|
+
### 0.20.1 / 2016-04-17
|
8
|
+
|
9
|
+
#### Features
|
10
|
+
|
11
|
+
* [#382](https://github.com/ruby-grape/grape-swagger/pull/382): make schemes optional - [@wleeper](https://github.com/wleeper).
|
12
|
+
* [#381](https://github.com/ruby-grape/grape-swagger/pull/381): adding entity property description when property documentation desc option is present - [@elciok](https://github.com/elciok).
|
13
|
+
|
14
|
+
#### Fixes
|
15
|
+
|
16
|
+
* [#383](https://github.com/ruby-grape/grape-swagger/pull/383): fixes grape to 0.12.0–0.14.0 - [@LeFnord](https://github.com/LeFnord).
|
17
|
+
|
1
18
|
### 0.20.0 / 2016-04-09
|
2
19
|
|
3
20
|
#### Features
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,26 +1,22 @@
|
|
1
|
-
This is work in progress for bringing grape-swagger to [swagger-spec (OpenAPI) 2.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md) spec. Re-added/reimplemented features from [grape-swagger 1.2](https://github.com/ruby-grape/grape-swagger/tree/swagger-1.2) could be found in the ToC.
|
2
|
-
|
3
|
-
##### Table of Contents
|
4
|
-
|
5
|
-
[What is grape-swagger?](#what)
|
6
|
-
[Related Projects](#related)
|
7
|
-
[Swagger-Spec](#swagger-spec)
|
8
|
-
[Installation](#install)
|
9
|
-
[Usage](#usage)
|
10
|
-
[Configure](#configure)
|
11
|
-
[Routes Configuration](#routes)
|
12
|
-
[Markdown](#md_usage)
|
13
|
-
[Response documentation](#response)
|
14
|
-
[Extensions](#extensions)
|
15
|
-
[Example](#example)
|
16
|
-
|
17
|
-
For how to use at the moment see [v2 specs](tree/master/spec/swagger_v2) and or [Hussars](https://github.com/LeFnord/hussars) sample app.
|
18
|
-
|
19
1
|
[](http://badge.fury.io/rb/grape-swagger)
|
20
2
|
[](https://travis-ci.org/ruby-grape/grape-swagger)
|
21
3
|
[](https://gemnasium.com/ruby-grape/grape-swagger)
|
22
4
|
[](https://codeclimate.com/github/ruby-grape/grape-swagger)
|
23
5
|
|
6
|
+
##### Table of Contents
|
7
|
+
|
8
|
+
* [What is grape-swagger?](#what)
|
9
|
+
* [Related Projects](#related)
|
10
|
+
* [Swagger-Spec](#swagger-spec)
|
11
|
+
* [Installation](#install)
|
12
|
+
* [Usage](#usage)
|
13
|
+
* [Configure](#configure)
|
14
|
+
* [Routes Configuration](#routes)
|
15
|
+
* [Markdown](#md_usage)
|
16
|
+
* [Response documentation](#response)
|
17
|
+
* [Extensions](#extensions)
|
18
|
+
* [Example](#example)
|
19
|
+
|
24
20
|
<a name="what" />
|
25
21
|
## What is grape-swagger?
|
26
22
|
|
@@ -50,10 +46,9 @@ Grape-swagger generates documentation per [Swagger Spec 2.0](https://github.com/
|
|
50
46
|
Add to your Gemfile:
|
51
47
|
|
52
48
|
```ruby
|
53
|
-
|
49
|
+
gem 'grape-swagger'
|
54
50
|
```
|
55
51
|
|
56
|
-
|
57
52
|
## Upgrade
|
58
53
|
|
59
54
|
Please see [UPGRADING](UPGRADING.md) when upgrading from a previous version.
|
@@ -109,16 +104,16 @@ end
|
|
109
104
|
<a name="configure" />
|
110
105
|
## Configure
|
111
106
|
|
112
|
-
[host](#host)
|
113
|
-
[base_path](#base_path)
|
114
|
-
[mount_path](#mount_path)
|
115
|
-
[add_base_path](#add_base_path)
|
116
|
-
[add_version](#add_version)
|
117
|
-
[markdown](#markdown)
|
118
|
-
[api_version](#api_version)
|
119
|
-
[models](#models)
|
120
|
-
[hide_documentation_path](#hide_documentation_path)
|
121
|
-
[info](#info)
|
107
|
+
* [host](#host)
|
108
|
+
* [base_path](#base_path)
|
109
|
+
* [mount_path](#mount_path)
|
110
|
+
* [add_base_path](#add_base_path)
|
111
|
+
* [add_version](#add_version)
|
112
|
+
* [markdown](#markdown)
|
113
|
+
* [api_version](#api_version)
|
114
|
+
* [models](#models)
|
115
|
+
* [hide_documentation_path](#hide_documentation_path)
|
116
|
+
* [info](#info)
|
122
117
|
|
123
118
|
|
124
119
|
You can pass a hash with optional configuration settings to ```add_swagger_documentation```.
|
@@ -259,12 +254,12 @@ add_swagger_documentation \
|
|
259
254
|
<a name="routes" />
|
260
255
|
## Routes Configuration
|
261
256
|
|
262
|
-
[Swagger Header Parameters](#headers)
|
263
|
-
[Hiding an Endpoint](#hiding)
|
264
|
-
[Defining an endpoint as array](#array)
|
265
|
-
[Using an options hash](#options)
|
266
|
-
[Specify endpoint details](#details)
|
267
|
-
[Response documentation](#response)
|
257
|
+
* [Swagger Header Parameters](#headers)
|
258
|
+
* [Hiding an Endpoint](#hiding)
|
259
|
+
* [Defining an endpoint as array](#array)
|
260
|
+
* [Using an options hash](#options)
|
261
|
+
* [Specify endpoint details](#details)
|
262
|
+
* [Response documentation](#response)
|
268
263
|
|
269
264
|
|
270
265
|
<a name="headers" />
|
@@ -422,10 +417,8 @@ end
|
|
422
417
|
<a name="additions" />
|
423
418
|
## Additional documentation
|
424
419
|
|
425
|
-
|
426
|
-
[
|
427
|
-
[Response documentation](#response)
|
428
|
-
|
420
|
+
* [Markdown in Detail](#md_usage)
|
421
|
+
* [Response documentation](#response)
|
429
422
|
|
430
423
|
### Setting a Swagger defaultValue
|
431
424
|
|
data/grape-swagger.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = 'A simple way to add auto generated documentation to your Grape API that can be displayed with Swagger.'
|
12
12
|
s.license = 'MIT'
|
13
13
|
|
14
|
-
s.add_runtime_dependency 'grape'
|
14
|
+
s.add_runtime_dependency 'grape', ['>= 0.12.0', '<= 0.14.0']
|
15
15
|
s.add_runtime_dependency 'grape-entity'
|
16
16
|
s.add_runtime_dependency 'awesome_print'
|
17
17
|
|
@@ -270,6 +270,7 @@ module Grape
|
|
270
270
|
|
271
271
|
memo[x.first][:enum] = x.last[:values] if x.last[:values] && x.last[:values].is_a?(Array)
|
272
272
|
end
|
273
|
+
memo[x.first][:description] = x.last[:documentation][:desc] if x.last[:documentation] && x.last[:documentation][:desc]
|
273
274
|
end
|
274
275
|
end
|
275
276
|
|
@@ -79,7 +79,6 @@ RSpec.shared_context "swagger example" do
|
|
79
79
|
{"name"=>"thing2", "description"=>"Operations about thing2s"},
|
80
80
|
{"name"=>"dummy", "description"=>"Operations about dummies"}
|
81
81
|
],
|
82
|
-
"schemes"=>["https", "http"],
|
83
82
|
"paths"=>{
|
84
83
|
"/v3/other_thing/{elements}"=>{
|
85
84
|
"get"=>{
|
@@ -174,22 +173,22 @@ RSpec.shared_context "swagger example" do
|
|
174
173
|
"definitions"=>{
|
175
174
|
"QueryInput"=>{
|
176
175
|
"type"=>"object",
|
177
|
-
"properties"=>{"elements"=>{"type"=>"array", "items"=>{"$ref"=>"#/definitions/QueryInputElement"}}},
|
176
|
+
"properties"=>{"elements"=>{"type"=>"array", "items"=>{"$ref"=>"#/definitions/QueryInputElement"}, "description"=>"Set of configuration"}},
|
178
177
|
"description"=>"nested route inside namespace"},
|
179
178
|
"QueryInputElement"=>{
|
180
179
|
"type"=>"object",
|
181
|
-
"properties"=>{"key"=>{"type"=>"string"}, "value"=>{"type"=>"string"}}},
|
180
|
+
"properties"=>{"key"=>{"type"=>"string", "description"=>"Name of parameter"}, "value"=>{"type"=>"string", "description"=>"Value of parameter"}}},
|
182
181
|
"Thing"=>{
|
183
182
|
"type"=>"object",
|
184
183
|
"properties"=>{"id"=>{"type"=>"integer", "format"=>"int32"}, "text"=>{"type"=>"string"}, "links"=>{"type"=>"link"}, "others"=>{"type"=>"text"}},
|
185
184
|
"description"=>"This gets Thing."},
|
186
185
|
"ApiError"=>{
|
187
186
|
"type"=>"object",
|
188
|
-
"properties"=>{"code"=>{"type"=>"integer", "format"=>"int32"}, "message"=>{"type"=>"string"}},
|
187
|
+
"properties"=>{"code"=>{"type"=>"integer", "format"=>"int32", "description"=>"status code"}, "message"=>{"type"=>"string", "description"=>"error message"}},
|
189
188
|
"description"=>"This gets Things."},
|
190
189
|
"Something"=>{
|
191
190
|
"type"=>"object",
|
192
|
-
"properties"=>{"id"=>{"type"=>"integer", "format"=>"int32"}, "text"=>{"type"=>"string"}, "links"=>{"type"=>"link"}, "others"=>{"type"=>"text"}},
|
191
|
+
"properties"=>{"id"=>{"type"=>"integer", "format"=>"int32", "description"=>"Identity of Something"}, "text"=>{"type"=>"string", "description"=>"Content of something."}, "links"=>{"type"=>"link"}, "others"=>{"type"=>"text"}},
|
193
192
|
"description"=>"This gets Things."
|
194
193
|
}
|
195
194
|
}
|
@@ -55,7 +55,6 @@ describe 'response' do
|
|
55
55
|
{"name"=>"entity_response", "description"=>"Operations about entity_responses"},
|
56
56
|
{"name"=>"nested_type", "description"=>"Operations about nested_types"}
|
57
57
|
],
|
58
|
-
"schemes"=>["https", "http"],
|
59
58
|
"paths"=>{
|
60
59
|
"/nested_type"=>{
|
61
60
|
"get"=>{
|
@@ -104,7 +103,6 @@ describe 'response' do
|
|
104
103
|
{"name"=>"entity_response", "description"=>"Operations about entity_responses"},
|
105
104
|
{"name"=>"nested_type", "description"=>"Operations about nested_types"}
|
106
105
|
],
|
107
|
-
"schemes"=>["https", "http"],
|
108
106
|
"paths"=>{
|
109
107
|
"/entity_response"=>{
|
110
108
|
"get"=>{
|
@@ -150,7 +148,6 @@ describe 'response' do
|
|
150
148
|
{"name"=>"entity_response", "description"=>"Operations about entity_responses"},
|
151
149
|
{"name"=>"nested_type", "description"=>"Operations about nested_types"}
|
152
150
|
],
|
153
|
-
"schemes"=>["https", "http"],
|
154
151
|
"paths"=>{
|
155
152
|
"/params_response"=>{
|
156
153
|
"post"=>{
|
@@ -24,20 +24,20 @@ describe 'type format settings' do
|
|
24
24
|
module TheApi
|
25
25
|
module Entities
|
26
26
|
class TypedDefinition < Grape::Entity
|
27
|
-
expose :prop_integer, documentation: { type: Integer, desc: 'prop_integer' }
|
28
|
-
expose :prop_long, documentation: { type: Numeric, desc: 'prop_long' }
|
29
|
-
expose :prop_float, documentation: { type: Float, desc: 'prop_float' }
|
30
|
-
expose :prop_double, documentation: { type: BigDecimal, desc: 'prop_double' }
|
31
|
-
expose :prop_string, documentation: { type: String, desc: 'prop_string' }
|
32
|
-
expose :prop_symbol, documentation: { type: Symbol, desc: 'prop_symbol' }
|
33
|
-
expose :prop_date, documentation: { type: Date, desc: 'prop_date' }
|
34
|
-
expose :prop_date_time, documentation: { type: DateTime, desc: 'prop_date_time' }
|
35
|
-
expose :prop_time, documentation: { type: Time, desc: 'prop_time' }
|
36
|
-
expose :prop_password, documentation: { type: 'password', desc: 'prop_password' }
|
37
|
-
expose :prop_email, documentation: { type: 'email', desc: 'prop_email' }
|
38
|
-
expose :prop_boolean, documentation: { type: Virtus::Attribute::Boolean, desc: 'prop_boolean' }
|
39
|
-
expose :prop_file, documentation: { type: File, desc: 'prop_file' }
|
40
|
-
expose :prop_json, documentation: { type: JSON, desc: 'prop_json' }
|
27
|
+
expose :prop_integer, documentation: { type: Integer, desc: 'prop_integer description' }
|
28
|
+
expose :prop_long, documentation: { type: Numeric, desc: 'prop_long description' }
|
29
|
+
expose :prop_float, documentation: { type: Float, desc: 'prop_float description' }
|
30
|
+
expose :prop_double, documentation: { type: BigDecimal, desc: 'prop_double description' }
|
31
|
+
expose :prop_string, documentation: { type: String, desc: 'prop_string description' }
|
32
|
+
expose :prop_symbol, documentation: { type: Symbol, desc: 'prop_symbol description' }
|
33
|
+
expose :prop_date, documentation: { type: Date, desc: 'prop_date description' }
|
34
|
+
expose :prop_date_time, documentation: { type: DateTime, desc: 'prop_date_time description' }
|
35
|
+
expose :prop_time, documentation: { type: Time, desc: 'prop_time description' }
|
36
|
+
expose :prop_password, documentation: { type: 'password', desc: 'prop_password description' }
|
37
|
+
expose :prop_email, documentation: { type: 'email', desc: 'prop_email description' }
|
38
|
+
expose :prop_boolean, documentation: { type: Virtus::Attribute::Boolean, desc: 'prop_boolean description' }
|
39
|
+
expose :prop_file, documentation: { type: File, desc: 'prop_file description' }
|
40
|
+
expose :prop_json, documentation: { type: JSON, desc: 'prop_json description' }
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -102,20 +102,20 @@ describe 'type format settings' do
|
|
102
102
|
|
103
103
|
specify do
|
104
104
|
expect(subject['definitions']['TypedDefinition']['properties']).to eql({
|
105
|
-
"prop_integer"=>{"type"=>"integer", "format"=>"int32"},
|
106
|
-
"prop_long"=>{"type"=>"integer", "format"=>"int64"},
|
107
|
-
"prop_float"=>{"type"=>"number", "format"=>"float"},
|
108
|
-
"prop_double"=>{"type"=>"number", "format"=>"double"},
|
109
|
-
"prop_string"=>{"type"=>"string"},
|
110
|
-
"prop_symbol"=>{"type"=>"string"},
|
111
|
-
"prop_date"=>{"type"=>"string", "format"=>"date"},
|
112
|
-
"prop_date_time"=>{"type"=>"string", "format"=>"date-time"},
|
113
|
-
"prop_time"=>{"type"=>"string", "format"=>"date-time"},
|
114
|
-
"prop_password"=>{"type"=>"string", "format"=>"password"},
|
115
|
-
"prop_email"=>{"type"=>"string", "format"=>"email"},
|
116
|
-
"prop_boolean"=>{"type"=>"boolean"},
|
117
|
-
"prop_file"=>{"type"=>"file"},
|
118
|
-
"prop_json"=>{"type"=>"json"}
|
105
|
+
"prop_integer"=>{"type"=>"integer", "format"=>"int32", "description"=>"prop_integer description"},
|
106
|
+
"prop_long"=>{"type"=>"integer", "format"=>"int64", "description"=>"prop_long description"},
|
107
|
+
"prop_float"=>{"type"=>"number", "format"=>"float", "description"=>"prop_float description"},
|
108
|
+
"prop_double"=>{"type"=>"number", "format"=>"double", "description"=>"prop_double description"},
|
109
|
+
"prop_string"=>{"type"=>"string", "description"=>"prop_string description"},
|
110
|
+
"prop_symbol"=>{"type"=>"string", "description"=>"prop_symbol description"},
|
111
|
+
"prop_date"=>{"type"=>"string", "format"=>"date", "description"=>"prop_date description"},
|
112
|
+
"prop_date_time"=>{"type"=>"string", "format"=>"date-time", "description"=>"prop_date_time description"},
|
113
|
+
"prop_time"=>{"type"=>"string", "format"=>"date-time", "description"=>"prop_time description"},
|
114
|
+
"prop_password"=>{"type"=>"string", "format"=>"password", "description"=>"prop_password description"},
|
115
|
+
"prop_email"=>{"type"=>"string", "format"=>"email", "description"=>"prop_email description"},
|
116
|
+
"prop_boolean"=>{"type"=>"boolean", "description"=>"prop_boolean description"},
|
117
|
+
"prop_file"=>{"type"=>"file", "description"=>"prop_file description"},
|
118
|
+
"prop_json"=>{"type"=>"json", "description"=>"prop_json description"}
|
119
119
|
})
|
120
120
|
end
|
121
121
|
end
|
@@ -27,7 +27,6 @@ describe 'Default API' do
|
|
27
27
|
"produces"=>["application/json"],
|
28
28
|
"host"=>"example.org",
|
29
29
|
"tags" => [{"name"=>"something", "description"=>"Operations about somethings"}],
|
30
|
-
"schemes" => ["https", "http"],
|
31
30
|
"paths"=>{
|
32
31
|
"/something"=>{
|
33
32
|
"get"=>{
|
@@ -72,7 +71,6 @@ describe 'Default API' do
|
|
72
71
|
"produces"=>["application/json"],
|
73
72
|
"host"=>"example.org",
|
74
73
|
"tags" => [{"name"=>"something", "description"=>"Operations about somethings"}],
|
75
|
-
"schemes" => ["https", "http"],
|
76
74
|
"paths"=>{
|
77
75
|
"/something"=>{
|
78
76
|
"get"=>{
|
@@ -41,7 +41,6 @@ describe 'a hide mounted api' do
|
|
41
41
|
"produces"=>["application/xml", "application/json", "application/octet-stream", "text/plain"],
|
42
42
|
"host"=>"example.org",
|
43
43
|
"tags" => [{"name"=>"simple", "description"=>"Operations about simples"}, {"name"=>"lazy", "description"=>"Operations about lazies"}],
|
44
|
-
"schemes" => ["https", "http"],
|
45
44
|
"paths"=>{
|
46
45
|
"/simple"=>{
|
47
46
|
"get"=>{
|
@@ -98,7 +97,6 @@ describe 'a hide mounted api with same namespace' do
|
|
98
97
|
"produces"=>["application/xml", "application/json", "application/octet-stream", "text/plain"],
|
99
98
|
"host"=>"example.org",
|
100
99
|
"tags" => [{"name"=>"simple", "description"=>"Operations about simples"}],
|
101
|
-
"schemes" => ["https", "http"],
|
102
100
|
"paths"=>{
|
103
101
|
"/simple/show"=>{
|
104
102
|
"get"=>{
|
@@ -117,7 +115,6 @@ describe 'a hide mounted api with same namespace' do
|
|
117
115
|
"produces"=>["application/xml", "application/json", "application/octet-stream", "text/plain"],
|
118
116
|
"host"=>"example.org",
|
119
117
|
"tags" => [{"name"=>"simple", "description"=>"Operations about simples"}],
|
120
|
-
"schemes" => ["https", "http"],
|
121
118
|
"paths"=>{
|
122
119
|
"/simple/show"=>{
|
123
120
|
"get"=>{
|
@@ -34,7 +34,6 @@ describe 'docs mounted separately from api' do
|
|
34
34
|
"produces"=>["application/xml", "application/json", "application/octet-stream", "text/plain"],
|
35
35
|
"host"=>"example.org",
|
36
36
|
"tags"=>[{"name"=>"simple", "description"=>"Operations about simples"}],
|
37
|
-
"schemes"=>["https", "http"],
|
38
37
|
"paths"=>{
|
39
38
|
"/simple"=>{
|
40
39
|
"get"=>{
|
@@ -57,7 +56,6 @@ describe 'docs mounted separately from api' do
|
|
57
56
|
"tags" => [{"name"=>"simple", "description"=>"Operations about simples"}],
|
58
57
|
"produces"=>["application/xml", "application/json", "application/octet-stream", "text/plain"],
|
59
58
|
"host"=>"example.org",
|
60
|
-
"schemes" => ["https", "http"],
|
61
59
|
"paths" => {
|
62
60
|
"/simple"=>{
|
63
61
|
"get"=>{
|
@@ -105,8 +105,8 @@ describe 'responseModel' do
|
|
105
105
|
"type"=>"object",
|
106
106
|
"description" => "This returns something or an error",
|
107
107
|
"properties"=>{
|
108
|
-
"code"=>{"type"=>"string"},
|
109
|
-
"message"=>{"type"=>"string"}
|
108
|
+
"code"=>{"type"=>"string","description"=>"Error code"},
|
109
|
+
"message"=>{"type"=>"string","description"=>"Error message"}
|
110
110
|
}}
|
111
111
|
)
|
112
112
|
|
@@ -115,27 +115,27 @@ describe 'responseModel' do
|
|
115
115
|
{ "type"=>"object",
|
116
116
|
"description" => "This returns something or an error",
|
117
117
|
"properties"=>
|
118
|
-
{ "text"=>{"type"=>"string"},
|
119
|
-
"kind"=>{"$ref"=>"#/definitions/Kind"},
|
120
|
-
"kind2"=>{"$ref"=>"#/definitions/Kind"},
|
121
|
-
"kind3"=>{"$ref"=>"#/definitions/Kind"},
|
122
|
-
"tags"=>{"type"=>"array", "items"=>{"$ref"=>"#/definitions/Tag"}},
|
123
|
-
"relation"=>{"$ref"=>"#/definitions/Relation"}}}
|
118
|
+
{ "text"=>{"type"=>"string","description"=>"Content of something."},
|
119
|
+
"kind"=>{"$ref"=>"#/definitions/Kind","description"=>"The kind of this something."},
|
120
|
+
"kind2"=>{"$ref"=>"#/definitions/Kind","description"=>"Secondary kind."},
|
121
|
+
"kind3"=>{"$ref"=>"#/definitions/Kind","description"=>"Tertiary kind."},
|
122
|
+
"tags"=>{"type"=>"array", "items"=>{"$ref"=>"#/definitions/Tag"},"description"=>"Tags."},
|
123
|
+
"relation"=>{"$ref"=>"#/definitions/Relation","description"=>"A related model."}}}
|
124
124
|
)
|
125
125
|
|
126
126
|
expect(subject['definitions'].keys).to include 'Kind'
|
127
127
|
expect(subject['definitions']['Kind']).to eq(
|
128
|
-
"type"=>"object", "properties"=>{"title"=>{"type"=>"string"}}
|
128
|
+
"type"=>"object", "properties"=>{"title"=>{"type"=>"string","description"=>"Title of the kind."}}
|
129
129
|
)
|
130
130
|
|
131
131
|
expect(subject['definitions'].keys).to include 'Relation'
|
132
132
|
expect(subject['definitions']['Relation']).to eq(
|
133
|
-
"type"=>"object", "properties"=>{"name"=>{"type"=>"string"}}
|
133
|
+
"type"=>"object", "properties"=>{"name"=>{"type"=>"string","description"=>"Name"}}
|
134
134
|
)
|
135
135
|
|
136
136
|
expect(subject['definitions'].keys).to include 'Tag'
|
137
137
|
expect(subject['definitions']['Tag']).to eq(
|
138
|
-
"type"=>"object", "properties"=>{"name"=>{"type"=>"string"}}
|
138
|
+
"type"=>"object", "properties"=>{"name"=>{"type"=>"string","description"=>"Name"}}
|
139
139
|
)
|
140
140
|
end
|
141
141
|
end
|
@@ -193,18 +193,18 @@ describe 'should build definition from given entity' do
|
|
193
193
|
|
194
194
|
it "it prefer entity over others" do
|
195
195
|
expect(subject['definitions']).to eql({
|
196
|
-
"Kind"=>{"type"=>"object", "properties"=>{"id"=>{"type"=>"integer", "format"=>"int32"}}},
|
197
|
-
"Tag"=>{"type"=>"object", "properties"=>{"name"=>{"type"=>"string"}}},
|
198
|
-
"Relation"=>{"type"=>"object", "properties"=>{"name"=>{"type"=>"string"}}},
|
196
|
+
"Kind"=>{"type"=>"object", "properties"=>{"id"=>{"type"=>"integer", "format"=>"int32", "description"=>"Title of the kind."}}},
|
197
|
+
"Tag"=>{"type"=>"object", "properties"=>{"name"=>{"type"=>"string", "description"=>"Name"}}},
|
198
|
+
"Relation"=>{"type"=>"object", "properties"=>{"name"=>{"type"=>"string", "description"=>"Name"}}},
|
199
199
|
"SomeEntity"=>{
|
200
200
|
"type"=>"object",
|
201
201
|
"properties"=>{
|
202
|
-
"text"=>{"type"=>"string"},
|
203
|
-
"kind"=>{"$ref"=>"#/definitions/Kind"},
|
204
|
-
"kind2"=>{"$ref"=>"#/definitions/Kind"},
|
205
|
-
"kind3"=>{"$ref"=>"#/definitions/Kind"},
|
206
|
-
"tags"=>{"type"=>"array", "items"=>{"$ref"=>"#/definitions/Tag"}},
|
207
|
-
"relation"=>{"$ref"=>"#/definitions/Relation"}
|
202
|
+
"text"=>{"type"=>"string", "description"=>"Content of something."},
|
203
|
+
"kind"=>{"$ref"=>"#/definitions/Kind", "description"=>"The kind of this something."},
|
204
|
+
"kind2"=>{"$ref"=>"#/definitions/Kind", "description"=>"Secondary kind."},
|
205
|
+
"kind3"=>{"$ref"=>"#/definitions/Kind", "description"=>"Tertiary kind."},
|
206
|
+
"tags"=>{"type"=>"array", "items"=>{"$ref"=>"#/definitions/Tag"}, "description"=>"Tags."},
|
207
|
+
"relation"=>{"$ref"=>"#/definitions/Relation", "description"=>"A related model."}
|
208
208
|
},
|
209
209
|
"description"=>"This returns something"
|
210
210
|
}})
|
@@ -79,7 +79,6 @@ describe 'a simple mounted api' do
|
|
79
79
|
"produces"=>["application/xml", "application/json", "application/octet-stream", "text/plain"],
|
80
80
|
"host"=>"example.org",
|
81
81
|
"tags" => [{"name"=>"simple", "description"=>"Operations about simples"}, {"name"=>"simple-test", "description"=>"Operations about simple-tests"}, {"name"=>"simple_with_headers", "description"=>"Operations about simple_with_headers"}, {"name"=>"items", "description"=>"Operations about items"}, {"name"=>"custom", "description"=>"Operations about customs"}],
|
82
|
-
"schemes"=>["https", "http"],
|
83
82
|
"paths"=>{
|
84
83
|
"/simple"=>{
|
85
84
|
"get"=>{
|
@@ -155,7 +154,6 @@ describe 'a simple mounted api' do
|
|
155
154
|
"produces"=>["application/xml", "application/json", "application/octet-stream", "text/plain"],
|
156
155
|
"host"=>"example.org",
|
157
156
|
"tags" => [{"name"=>"simple", "description"=>"Operations about simples"}, {"name"=>"simple-test", "description"=>"Operations about simple-tests"}, {"name"=>"simple_with_headers", "description"=>"Operations about simple_with_headers"}, {"name"=>"items", "description"=>"Operations about items"}, {"name"=>"custom", "description"=>"Operations about customs"}],
|
158
|
-
"schemes"=>["https", "http"],
|
159
157
|
"paths"=>{
|
160
158
|
"/simple"=>{
|
161
159
|
"get"=>{
|
@@ -182,7 +180,6 @@ describe 'a simple mounted api' do
|
|
182
180
|
"produces"=>["application/xml", "application/json", "application/octet-stream", "text/plain"],
|
183
181
|
"host"=>"example.org",
|
184
182
|
"tags" => [{"name"=>"simple", "description"=>"Operations about simples"}, {"name"=>"simple-test", "description"=>"Operations about simple-tests"}, {"name"=>"simple_with_headers", "description"=>"Operations about simple_with_headers"}, {"name"=>"items", "description"=>"Operations about items"}, {"name"=>"custom", "description"=>"Operations about customs"}],
|
185
|
-
"schemes"=>["https", "http"],
|
186
183
|
"paths"=>{
|
187
184
|
"/simple-test"=>{
|
188
185
|
"get"=>{
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-swagger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.
|
4
|
+
version: 0.20.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Vandecasteele
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.12.0
|
20
|
+
- - "<="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.14.0
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
29
|
+
version: 0.12.0
|
30
|
+
- - "<="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.14.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: grape-entity
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|