swaggable 0.5.2 → 0.5.3
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/lib/swaggable/endpoint_definition.rb +2 -2
- data/lib/swaggable/grape_adapter.rb +3 -1
- data/lib/swaggable/swagger_2_serializer.rb +2 -2
- data/lib/swaggable/version.rb +1 -1
- data/spec/swaggable/endpoint_definition_spec.rb +2 -2
- data/spec/swaggable/grape_adapter_spec.rb +11 -2
- data/spec/swaggable/integration_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0ba12b2dc9c54ce2f6920b7d6fd6c45fe056ff5
|
4
|
+
data.tar.gz: 27874e95a2cfcdd88f67c3ef2bbd024660c979a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf44a0e08c55b0f6e948f73d711d7c758b77ae00a90dad0007451c1102265f0c44a928c868827be588504f380797f6c548826af5ab68c260bfcae7e4014712e2
|
7
|
+
data.tar.gz: faab31754af448942d0e7f9012c233a28e004c718a750c2adbd450082ecdd5c1f3b40fa1c3921e199ed6b6a20b5f52537a6c7953b0e6c689c50d08b820088cbd
|
@@ -62,9 +62,11 @@ module Swaggable
|
|
62
62
|
def import_endpoint grape_endpoint, api_endpoint, grape
|
63
63
|
api_endpoint.verb = grape_endpoint.route_method.downcase
|
64
64
|
api_endpoint.summary = grape_endpoint.route_description
|
65
|
-
api_endpoint.produces << "application/#{grape.format}" if grape.format
|
66
65
|
api_endpoint.path = extract_path(grape_endpoint, grape)
|
67
66
|
|
67
|
+
api_endpoint.produces.merge grape.content_types.values
|
68
|
+
api_endpoint.consumes.merge grape.content_types.values
|
69
|
+
|
68
70
|
api_endpoint.tags.add_new do |t|
|
69
71
|
t.name = grape.name
|
70
72
|
end
|
@@ -52,8 +52,8 @@ module Swaggable
|
|
52
52
|
def serialize_endpoint endpoint
|
53
53
|
{
|
54
54
|
tags: endpoint.tags.map(&:name),
|
55
|
-
consumes: endpoint.consumes,
|
56
|
-
produces: endpoint.produces,
|
55
|
+
consumes: endpoint.consumes.to_a,
|
56
|
+
produces: endpoint.produces.to_a,
|
57
57
|
parameters: endpoint.parameters.map{|p| serialize_parameter p },
|
58
58
|
responses: serialize_responses(endpoint.responses),
|
59
59
|
}.
|
data/lib/swaggable/version.rb
CHANGED
@@ -34,13 +34,13 @@ RSpec.describe 'Swaggable::EndpointDefinition' do
|
|
34
34
|
it 'has consumes' do
|
35
35
|
format = double('format')
|
36
36
|
subject.consumes << format
|
37
|
-
expect(subject.consumes).to eq [format]
|
37
|
+
expect(subject.consumes.to_a).to eq [format]
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'has produces' do
|
41
41
|
format = double('format')
|
42
42
|
subject.produces << format
|
43
|
-
expect(subject.produces).to eq [format]
|
43
|
+
expect(subject.produces.to_a).to eq [format]
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'has parameters' do
|
@@ -51,11 +51,20 @@ RSpec.describe 'Swaggable::GrapeAdapter' do
|
|
51
51
|
expect(api.endpoints.first.summary).to eq 'My endpoint'
|
52
52
|
end
|
53
53
|
|
54
|
-
it 'sets
|
54
|
+
it 'sets produces' do
|
55
55
|
grape.format :json
|
56
|
+
grape.content_type :xml, 'application/xml'
|
56
57
|
grape.post { }
|
57
58
|
do_import
|
58
|
-
expect(api.endpoints.first.produces).to eq ['application/json']
|
59
|
+
expect(api.endpoints.first.produces.to_a).to eq ['application/json', 'application/xml']
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'sets consumes' do
|
63
|
+
grape.format :json
|
64
|
+
grape.content_type :xml, 'application/xml'
|
65
|
+
grape.post { }
|
66
|
+
do_import
|
67
|
+
expect(api.endpoints.first.consumes.to_a).to eq ['application/json', 'application/xml']
|
59
68
|
end
|
60
69
|
|
61
70
|
describe 'path' do
|
@@ -116,8 +116,8 @@ RSpec.describe 'Integration' do
|
|
116
116
|
expect(api.endpoints.first.parameters.first.name).to eq 'include_comments_count'
|
117
117
|
expect(api.endpoints.first.responses.first).to be api.endpoints.first.responses[200]
|
118
118
|
expect(api.endpoints.first.responses.first.description).to eq 'Success'
|
119
|
-
expect(api.endpoints.first.consumes).to eq [:json]
|
120
|
-
expect(api.endpoints.first.produces).to eq [:json]
|
119
|
+
expect(api.endpoints.first.consumes.to_a).to eq [:json]
|
120
|
+
expect(api.endpoints.first.produces.to_a).to eq [:json]
|
121
121
|
end
|
122
122
|
|
123
123
|
it 'renders proper swagger JSON' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swaggable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Morales
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: forwarding_dsl
|