swaggable 0.6.0 → 0.7.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/lib/swaggable.rb +32 -7
- data/lib/swaggable/api_validator.rb +42 -0
- data/lib/swaggable/check_body_schema.rb +72 -0
- data/lib/swaggable/check_expected_parameters.rb +26 -0
- data/lib/swaggable/check_mandatory_parameters.rb +26 -0
- data/lib/swaggable/check_request_content_type.rb +26 -0
- data/lib/swaggable/check_response_code.rb +24 -0
- data/lib/swaggable/check_response_content_type.rb +26 -0
- data/lib/swaggable/endpoint_definition.rb +30 -2
- data/lib/swaggable/endpoint_validator.rb +27 -0
- data/lib/swaggable/errors.rb +9 -0
- data/lib/swaggable/errors/validations_collection.rb +44 -0
- data/lib/swaggable/grape_adapter.rb +2 -2
- data/lib/swaggable/mime_type_definition.rb +73 -0
- data/lib/swaggable/mime_types_collection.rb +60 -0
- data/lib/swaggable/parameter_definition.rb +19 -0
- data/lib/swaggable/query_params.rb +50 -0
- data/lib/swaggable/rack_request_adapter.rb +88 -0
- data/lib/swaggable/rack_response_adapter.rb +49 -0
- data/lib/swaggable/swagger_2_serializer.rb +3 -3
- data/lib/swaggable/validating_rack_app.rb +30 -0
- data/lib/swaggable/version.rb +1 -1
- data/spec/{swaggable/integration_spec.rb → integration/dsl_spec.rb} +0 -40
- data/spec/integration/rack_app_spec.rb +44 -0
- data/spec/integration/validating_rack_app_spec.rb +50 -0
- data/spec/spec_helper.rb +9 -5
- data/spec/swaggable/api_validator_spec.rb +61 -0
- data/spec/swaggable/check_body_schema_spec.rb +94 -0
- data/spec/swaggable/check_expected_parameters_spec.rb +110 -0
- data/spec/swaggable/check_mandatory_parameters_spec.rb +110 -0
- data/spec/swaggable/check_request_content_type_spec.rb +51 -0
- data/spec/swaggable/check_response_code_spec.rb +37 -0
- data/spec/swaggable/check_response_content_type_spec.rb +51 -0
- data/spec/swaggable/endpoint_definition_spec.rb +47 -0
- data/spec/swaggable/endpoint_validator_spec.rb +102 -0
- data/spec/swaggable/errors/validations_collection_spec.rb +78 -0
- data/spec/swaggable/grape_adapter_spec.rb +2 -2
- data/spec/swaggable/mime_type_definition_spec.rb +96 -0
- data/spec/swaggable/mime_types_collection_spec.rb +83 -0
- data/spec/swaggable/parameter_definition_spec.rb +23 -0
- data/spec/swaggable/query_params_spec.rb +37 -0
- data/spec/swaggable/rack_request_adapter_spec.rb +89 -0
- data/spec/swaggable/rack_response_adapter_spec.rb +46 -0
- data/spec/swaggable/swagger_2_serializer_spec.rb +4 -2
- data/spec/swaggable/swagger_2_validator_spec.rb +2 -2
- data/spec/swaggable/validating_rack_app_spec.rb +91 -0
- data/swaggable.gemspec +1 -0
- metadata +68 -4
@@ -0,0 +1,83 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe 'Swaggable::MimeTypesCollection' do
|
4
|
+
let(:subject_class) { Swaggable::MimeTypesCollection }
|
5
|
+
let(:subject_instance) { subject_class.new }
|
6
|
+
subject { subject_instance }
|
7
|
+
|
8
|
+
describe '#<<' do
|
9
|
+
it 'adds MimeTypeDefinitions as is' do
|
10
|
+
type = Swaggable::MimeTypeDefinition.new(:json)
|
11
|
+
subject << type
|
12
|
+
expect(subject.last).to be type
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#each' do
|
17
|
+
it 'iterates through the list' do
|
18
|
+
subject << :json
|
19
|
+
list = []
|
20
|
+
|
21
|
+
subject.each {|e| list << e.name }
|
22
|
+
|
23
|
+
expect(list).to eq(['application/json'])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#include?' do
|
28
|
+
it 'returns true if present' do
|
29
|
+
entry = Swaggable::MimeTypeDefinition.new(:json)
|
30
|
+
subject << entry
|
31
|
+
expect(subject).to include(entry)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#[]' do
|
36
|
+
it 'returns entries by symbol' do
|
37
|
+
entry = Swaggable::MimeTypeDefinition.new(:json)
|
38
|
+
subject << entry
|
39
|
+
expect(subject[:json]).to be entry
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'returns entries by string' do
|
43
|
+
entry = Swaggable::MimeTypeDefinition.new(:json)
|
44
|
+
subject << entry
|
45
|
+
expect(subject['application/json']).to be entry
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#inspect' do
|
50
|
+
it 'is readable' do
|
51
|
+
subject << :json
|
52
|
+
subject << :xml
|
53
|
+
expect(subject.inspect).to eq "#<Swaggable::MimeTypesCollection: application/json, application/xml>"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe '#==' do
|
58
|
+
it 'matches if the entries match' do
|
59
|
+
subject << :json
|
60
|
+
|
61
|
+
expect(subject).to eq [:json]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '#merge!' do
|
66
|
+
it 'joins the lists' do
|
67
|
+
subject << :json
|
68
|
+
|
69
|
+
other = subject_class.new
|
70
|
+
other << :xml
|
71
|
+
|
72
|
+
subject.merge!(other)
|
73
|
+
|
74
|
+
expect(subject).to eq [:json, :xml]
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'joins lists of symbols' do
|
78
|
+
subject << :json
|
79
|
+
subject.merge!([:xml])
|
80
|
+
expect(subject).to eq [:json, :xml]
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -10,6 +10,11 @@ RSpec.describe 'Swaggable::ParameterDefinition' do
|
|
10
10
|
expect(subject.name).to eq 'a name'
|
11
11
|
end
|
12
12
|
|
13
|
+
it 'coerces the name to string' do
|
14
|
+
subject.name = :a_name
|
15
|
+
expect(subject.name).to eq 'a_name'
|
16
|
+
end
|
17
|
+
|
13
18
|
it 'has a description' do
|
14
19
|
subject.description = 'a new desc'
|
15
20
|
expect(subject.description).to eq 'a new desc'
|
@@ -86,4 +91,22 @@ RSpec.describe 'Swaggable::ParameterDefinition' do
|
|
86
91
|
|
87
92
|
expect(subject.schema.attributes[:first_name].type).to be :string
|
88
93
|
end
|
94
|
+
|
95
|
+
describe '#==' do
|
96
|
+
it 'equals by name' do
|
97
|
+
subject.name = 'a name'
|
98
|
+
subject.location = :query
|
99
|
+
|
100
|
+
expect(subject).to eq OpenStruct.new(name: 'a name', location: :query)
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'doesn\'t throw error if comparing with any random object' do
|
104
|
+
expect{ subject == double }.not_to raise_error
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'has a value' do
|
109
|
+
subject.value = 10
|
110
|
+
expect(subject.value).to eq 10
|
111
|
+
end
|
89
112
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe 'Swaggable::QueryParams' do
|
4
|
+
subject { subject_class.new }
|
5
|
+
let(:subject_class) { Swaggable::QueryParams }
|
6
|
+
|
7
|
+
it 'parses the query string' do
|
8
|
+
subject.string = 'a=1&b=2'
|
9
|
+
expect(subject).to eq('a' => '1', 'b' => '2')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'can be updated' do
|
13
|
+
subject.string = 'a=1'
|
14
|
+
subject['b'] = 2
|
15
|
+
expect(subject).to eq('a' => '1', 'b' => '2')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'can initialized with a hash' do
|
19
|
+
subject = subject_class.new a: 1, b: 2
|
20
|
+
expect(subject).to eq('a' => '1', 'b' => '2')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'works with unicode' do
|
24
|
+
subject.string = "person=\u2713"
|
25
|
+
expect(subject).to eq('person' => "\u2713")
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'works with scaped chars in the string' do
|
29
|
+
subject.string = 'name=john%20smith'
|
30
|
+
expect(subject).to eq('name' => 'john smith')
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'works with scaped chars in the hash' do
|
34
|
+
subject['name'] = 'john smith'
|
35
|
+
expect(subject.string).to eq 'name=john+smith'
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Swaggable::RackRequestAdapter do
|
4
|
+
subject { Swaggable::RackRequestAdapter.new env }
|
5
|
+
let(:env) { {} }
|
6
|
+
|
7
|
+
it 'allows accessing the original env hash' do
|
8
|
+
subject = described_class.new('CONTENT_TYPE' => 'application/json')
|
9
|
+
expect(subject['CONTENT_TYPE']).to eq 'application/json'
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#query_parameters' do
|
13
|
+
it 'parses the query string' do
|
14
|
+
env['QUERY_STRING'] = 'a=1&b=2'
|
15
|
+
expect(subject.query_parameters).to eq('a' => '1', 'b' => '2')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'can be updated' do
|
19
|
+
env['QUERY_STRING'] = 'a=1'
|
20
|
+
subject.query_parameters['b'] = 2
|
21
|
+
expect(subject.query_parameters).to eq('a' => '1', 'b' => '2')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'can be assigned' do
|
25
|
+
subject.query_parameters = {a: 1, b: 2}
|
26
|
+
expect(subject.query_parameters).to eq('a' => '1', 'b' => '2')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#path' do
|
31
|
+
it 'returns PATH_INFO' do
|
32
|
+
subject = described_class.new('PATH_INFO' => '/test')
|
33
|
+
expect(subject.path).to eq '/test'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#body' do
|
38
|
+
it 'is the body of the request' do
|
39
|
+
env['rack.input'] = double(:body_stream, read: 'the body')
|
40
|
+
expect(subject.body).to eq 'the body'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#content_type' do
|
45
|
+
it 'is taken from CONTENT_TYPE' do
|
46
|
+
env['CONTENT_TYPE'] = 'application/json'
|
47
|
+
expect(subject.content_type).to eq 'application/json'
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'can be set' do
|
51
|
+
subject.content_type = 'application/json'
|
52
|
+
expect(subject.content_type).to eq 'application/json'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#parsed_body' do
|
57
|
+
it 'can be JSON' do
|
58
|
+
env['rack.input'] = double(:body_stream, read: '{"name":"John"}')
|
59
|
+
env['CONTENT_TYPE'] = 'application/json'
|
60
|
+
|
61
|
+
expect(subject.parsed_body).to eq({'name' => 'John'})
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '#parameters' do
|
66
|
+
it 'returns query params' do
|
67
|
+
env['QUERY_STRING'] = "name=John"
|
68
|
+
parameter = subject.parameters.first
|
69
|
+
|
70
|
+
expect(subject.parameters.count).to eq 1
|
71
|
+
expect(parameter.location).to eq :query
|
72
|
+
expect(parameter.name).to eq 'name'
|
73
|
+
expect(parameter.value).to eq 'John'
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'returns path params' do
|
77
|
+
env['PATH_INFO'] = "/users/37"
|
78
|
+
endpoint = double('endpoint', :path_parameters_for => { 'user_id' => '37' })
|
79
|
+
|
80
|
+
parameters = subject.parameters(endpoint)
|
81
|
+
parameter = parameters.first
|
82
|
+
|
83
|
+
expect(parameters.count).to eq 1
|
84
|
+
expect(parameter.location).to eq :path
|
85
|
+
expect(parameter.name).to eq 'user_id'
|
86
|
+
expect(parameter.value).to eq '37'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Swaggable::RackResponseAdapter do
|
4
|
+
let(:subject_class) { Swaggable::RackResponseAdapter }
|
5
|
+
subject { subject_class.new rack_request }
|
6
|
+
let(:rack_request) { [200, {}, []] }
|
7
|
+
|
8
|
+
describe '#content_type' do
|
9
|
+
it 'returns CONTENT_TYPE' do
|
10
|
+
rack_request[1]['Content-Type'] = 'application/xml'
|
11
|
+
expect(subject.content_type).to eq 'application/xml'
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'can be set' do
|
15
|
+
subject.content_type = 'application/xml'
|
16
|
+
expect(subject.content_type).to eq 'application/xml'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#code' do
|
21
|
+
it 'returns the request status code' do
|
22
|
+
rack_request[0] = 418
|
23
|
+
expect(subject.code).to eq 418
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'can be set' do
|
27
|
+
subject.code = 418
|
28
|
+
expect(subject.code).to eq 418
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#==' do
|
33
|
+
it 'equals by rack request' do
|
34
|
+
subject_1 = subject_class.new([418, {some: :header}, ['some body']])
|
35
|
+
subject_2 = subject_class.new([418, {some: :header}, ['some body']])
|
36
|
+
subject_3 = subject_class.new([418, {some: :header}, ['different body']])
|
37
|
+
|
38
|
+
expect(subject_1 == subject_2).to be true
|
39
|
+
expect(subject_1 == subject_3).to be false
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'doesn\'t throw error if comparing with any random object' do
|
43
|
+
expect{ subject == double }.not_to raise_error
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -78,7 +78,7 @@ RSpec.describe 'Swaggable::Swagger2Serializer' do
|
|
78
78
|
let(:api) { Swaggable::ApiDefinition.new {|a| a.endpoints << endpoint } }
|
79
79
|
let(:endpoint) { Swaggable::EndpointDefinition.new path: path, verb: verb }
|
80
80
|
let(:path) { '/a/path' }
|
81
|
-
let(:verb) {
|
81
|
+
let(:verb) { :post }
|
82
82
|
|
83
83
|
it 'uses the path as key' do
|
84
84
|
expect(output[:paths][path]).not_to be_nil
|
@@ -121,18 +121,20 @@ RSpec.describe 'Swaggable::Swagger2Serializer' do
|
|
121
121
|
it 'has consumes' do
|
122
122
|
endpoint.consumes << 'application/whatever'
|
123
123
|
expect(serialized_endpoint[:consumes]).to eq ['application/whatever']
|
124
|
+
expect(serialized_endpoint[:consumes].first).to be_a String
|
124
125
|
end
|
125
126
|
|
126
127
|
it 'has produces' do
|
127
128
|
endpoint.produces << 'application/whatever'
|
128
129
|
expect(serialized_endpoint[:produces]).to eq ['application/whatever']
|
130
|
+
expect(serialized_endpoint[:produces].first).to be_a String
|
129
131
|
end
|
130
132
|
|
131
133
|
it 'works with two endpoints with the same path' do
|
132
134
|
api.endpoints << Swaggable::EndpointDefinition.new(path: path, verb: 'get')
|
133
135
|
|
134
136
|
expect(output[:paths][path][verb]).not_to be_nil
|
135
|
-
expect(output[:paths][path][
|
137
|
+
expect(output[:paths][path][:get]).not_to be_nil
|
136
138
|
end
|
137
139
|
|
138
140
|
describe 'responses' do
|
@@ -7,7 +7,7 @@ RSpec.describe 'Swaggable::Swagger2Validator' do
|
|
7
7
|
subject { Swaggable::Swagger2Validator }
|
8
8
|
|
9
9
|
let(:valid_swagger) { JSON.parse File.read('spec/assets/valid-swagger-2.0.json') }
|
10
|
-
let(:invalid_swagger) { valid_swagger.merge("info" => nil) }
|
10
|
+
let(:invalid_swagger) { valid_swagger.merge!("info" => nil) }
|
11
11
|
|
12
12
|
it 'returns true for a valid schema' do
|
13
13
|
expect(subject.validate! valid_swagger).to be true
|
@@ -28,7 +28,7 @@ RSpec.describe 'Swaggable::Swagger2Validator' do
|
|
28
28
|
subject { Swaggable::Swagger2Validator }
|
29
29
|
|
30
30
|
let(:valid_swagger) { JSON.parse File.read('spec/assets/valid-swagger-2.0.json') }
|
31
|
-
let(:invalid_swagger) { valid_swagger.merge("info" => nil) }
|
31
|
+
let(:invalid_swagger) { valid_swagger.merge!("info" => nil) }
|
32
32
|
|
33
33
|
it 'returns empty errors for a valid schema' do
|
34
34
|
expect(subject.validate valid_swagger).to be_blank
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe 'Swaggable::ValidatingRackApp' do
|
4
|
+
let(:app) { Swaggable::ValidatingRackApp.new app: app_to_validate, definition: definition }
|
5
|
+
let(:response) { [200, {}, ['my-body']] }
|
6
|
+
let(:app_to_validate) { -> env { response } }
|
7
|
+
let(:definition) { Swaggable::ApiDefinition.new }
|
8
|
+
let(:request) { Rack::MockRequest.env_for '/', 'REQUEST_METHOD' => 'GET' }
|
9
|
+
let(:validator) { Swaggable::ApiValidator.new }
|
10
|
+
let(:some_errors) { Swaggable::Errors::ValidationsCollection.new }
|
11
|
+
|
12
|
+
before do
|
13
|
+
allow(Swaggable::ApiValidator).
|
14
|
+
to receive(:new).
|
15
|
+
and_return validator
|
16
|
+
end
|
17
|
+
|
18
|
+
def do_request
|
19
|
+
app.call request
|
20
|
+
end
|
21
|
+
|
22
|
+
before do
|
23
|
+
allow(validator).
|
24
|
+
to receive(:errors_for_request).
|
25
|
+
with(no_args).
|
26
|
+
and_return([])
|
27
|
+
|
28
|
+
allow(validator).
|
29
|
+
to receive(:errors_for_response).
|
30
|
+
with(Swaggable::RackResponseAdapter.new response).
|
31
|
+
and_return([])
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'for valid request and response' do
|
35
|
+
it 'raises no exception' do
|
36
|
+
expect{ do_request }.not_to raise_error
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'returns the response' do
|
40
|
+
last_response = do_request
|
41
|
+
expect(last_response).to be response
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'wraps the request into a rack request adapter' do
|
45
|
+
allow(Swaggable::ApiValidator).
|
46
|
+
to receive(:new) {|args| expect(args[:request]).to be_a Swaggable::RackRequestAdapter }.
|
47
|
+
and_return validator
|
48
|
+
|
49
|
+
do_request
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'for an invalid request' do
|
54
|
+
before do
|
55
|
+
allow(validator).
|
56
|
+
to receive(:errors_for_request).
|
57
|
+
with(no_args).
|
58
|
+
and_return(some_errors)
|
59
|
+
|
60
|
+
allow(some_errors).
|
61
|
+
to receive(:any?).
|
62
|
+
and_return true
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'raises the request errors' do
|
66
|
+
expect{ do_request }.to raise_error some_errors
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'doesn\'t make the request' do
|
70
|
+
expect(app_to_validate).not_to receive(:call)
|
71
|
+
do_request rescue some_errors
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'for an invalid response' do
|
76
|
+
before do
|
77
|
+
allow(validator).
|
78
|
+
to receive(:errors_for_response).
|
79
|
+
with(Swaggable::RackResponseAdapter.new response).
|
80
|
+
and_return(some_errors)
|
81
|
+
|
82
|
+
allow(some_errors).
|
83
|
+
to receive(:any?).
|
84
|
+
and_return true
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'raises the response errors' do
|
88
|
+
expect{ do_request }.to raise_error some_errors
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
data/swaggable.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_runtime_dependency "forwarding_dsl", '~> 1.0', '>= 1.0.3'
|
24
24
|
spec.add_runtime_dependency "json-schema", '~> 2.5'
|
25
25
|
spec.add_runtime_dependency "mini_object", '~> 0.1', '>= 0.1.7'
|
26
|
+
spec.add_runtime_dependency "addressable", '~> 2.3'
|
26
27
|
|
27
28
|
spec.add_development_dependency "bundler", "~> 1.7"
|
28
29
|
spec.add_development_dependency "rake", '~> 10.4'
|
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.
|
4
|
+
version: 0.7.0
|
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-
|
11
|
+
date: 2015-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: forwarding_dsl
|
@@ -64,6 +64,20 @@ dependencies:
|
|
64
64
|
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: 0.1.7
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: addressable
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '2.3'
|
74
|
+
type: :runtime
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '2.3'
|
67
81
|
- !ruby/object:Gem::Dependency
|
68
82
|
name: bundler
|
69
83
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,37 +123,70 @@ files:
|
|
109
123
|
- assets/swagger-2.0-schema.json
|
110
124
|
- lib/swaggable.rb
|
111
125
|
- lib/swaggable/api_definition.rb
|
126
|
+
- lib/swaggable/api_validator.rb
|
112
127
|
- lib/swaggable/attribute_definition.rb
|
128
|
+
- lib/swaggable/check_body_schema.rb
|
129
|
+
- lib/swaggable/check_expected_parameters.rb
|
130
|
+
- lib/swaggable/check_mandatory_parameters.rb
|
131
|
+
- lib/swaggable/check_request_content_type.rb
|
132
|
+
- lib/swaggable/check_response_code.rb
|
133
|
+
- lib/swaggable/check_response_content_type.rb
|
113
134
|
- lib/swaggable/definition_base.rb
|
114
135
|
- lib/swaggable/endpoint_definition.rb
|
136
|
+
- lib/swaggable/endpoint_validator.rb
|
115
137
|
- lib/swaggable/enumerable_attributes.rb
|
138
|
+
- lib/swaggable/errors.rb
|
139
|
+
- lib/swaggable/errors/validations_collection.rb
|
116
140
|
- lib/swaggable/grape_adapter.rb
|
117
141
|
- lib/swaggable/grape_entity_translator.rb
|
142
|
+
- lib/swaggable/mime_type_definition.rb
|
143
|
+
- lib/swaggable/mime_types_collection.rb
|
118
144
|
- lib/swaggable/parameter_definition.rb
|
145
|
+
- lib/swaggable/query_params.rb
|
119
146
|
- lib/swaggable/rack_app.rb
|
120
147
|
- lib/swaggable/rack_redirect.rb
|
148
|
+
- lib/swaggable/rack_request_adapter.rb
|
149
|
+
- lib/swaggable/rack_response_adapter.rb
|
121
150
|
- lib/swaggable/response_definition.rb
|
122
151
|
- lib/swaggable/schema_definition.rb
|
123
152
|
- lib/swaggable/swagger_2_serializer.rb
|
124
153
|
- lib/swaggable/swagger_2_validator.rb
|
125
154
|
- lib/swaggable/tag_definition.rb
|
155
|
+
- lib/swaggable/validating_rack_app.rb
|
126
156
|
- lib/swaggable/version.rb
|
127
157
|
- spec/assets/valid-swagger-2.0.json
|
158
|
+
- spec/integration/dsl_spec.rb
|
159
|
+
- spec/integration/rack_app_spec.rb
|
160
|
+
- spec/integration/validating_rack_app_spec.rb
|
128
161
|
- spec/spec_helper.rb
|
129
162
|
- spec/swaggable/api_definition_spec.rb
|
163
|
+
- spec/swaggable/api_validator_spec.rb
|
130
164
|
- spec/swaggable/attribute_definition_spec.rb
|
165
|
+
- spec/swaggable/check_body_schema_spec.rb
|
166
|
+
- spec/swaggable/check_expected_parameters_spec.rb
|
167
|
+
- spec/swaggable/check_mandatory_parameters_spec.rb
|
168
|
+
- spec/swaggable/check_request_content_type_spec.rb
|
169
|
+
- spec/swaggable/check_response_code_spec.rb
|
170
|
+
- spec/swaggable/check_response_content_type_spec.rb
|
131
171
|
- spec/swaggable/endpoint_definition_spec.rb
|
172
|
+
- spec/swaggable/endpoint_validator_spec.rb
|
173
|
+
- spec/swaggable/errors/validations_collection_spec.rb
|
132
174
|
- spec/swaggable/grape_adapter_spec.rb
|
133
175
|
- spec/swaggable/grape_entity_translator_spec.rb
|
134
|
-
- spec/swaggable/
|
176
|
+
- spec/swaggable/mime_type_definition_spec.rb
|
177
|
+
- spec/swaggable/mime_types_collection_spec.rb
|
135
178
|
- spec/swaggable/parameter_definition_spec.rb
|
179
|
+
- spec/swaggable/query_params_spec.rb
|
136
180
|
- spec/swaggable/rack_app_spec.rb
|
137
181
|
- spec/swaggable/rack_redirect_spec.rb
|
182
|
+
- spec/swaggable/rack_request_adapter_spec.rb
|
183
|
+
- spec/swaggable/rack_response_adapter_spec.rb
|
138
184
|
- spec/swaggable/response_definition_spec.rb
|
139
185
|
- spec/swaggable/schema_definition_spec.rb
|
140
186
|
- spec/swaggable/swagger_2_serializer_spec.rb
|
141
187
|
- spec/swaggable/swagger_2_validator_spec.rb
|
142
188
|
- spec/swaggable/tag_definition_spec.rb
|
189
|
+
- spec/swaggable/validating_rack_app_spec.rb
|
143
190
|
- spec/swaggable_spec.rb
|
144
191
|
- swaggable.gemspec
|
145
192
|
homepage: https://github.com/workshare/swaggable
|
@@ -169,20 +216,37 @@ summary: Allows you to generate Swagger documentation from Grape endpoints and e
|
|
169
216
|
it as a Rack app.
|
170
217
|
test_files:
|
171
218
|
- spec/assets/valid-swagger-2.0.json
|
219
|
+
- spec/integration/dsl_spec.rb
|
220
|
+
- spec/integration/rack_app_spec.rb
|
221
|
+
- spec/integration/validating_rack_app_spec.rb
|
172
222
|
- spec/spec_helper.rb
|
173
223
|
- spec/swaggable/api_definition_spec.rb
|
224
|
+
- spec/swaggable/api_validator_spec.rb
|
174
225
|
- spec/swaggable/attribute_definition_spec.rb
|
226
|
+
- spec/swaggable/check_body_schema_spec.rb
|
227
|
+
- spec/swaggable/check_expected_parameters_spec.rb
|
228
|
+
- spec/swaggable/check_mandatory_parameters_spec.rb
|
229
|
+
- spec/swaggable/check_request_content_type_spec.rb
|
230
|
+
- spec/swaggable/check_response_code_spec.rb
|
231
|
+
- spec/swaggable/check_response_content_type_spec.rb
|
175
232
|
- spec/swaggable/endpoint_definition_spec.rb
|
233
|
+
- spec/swaggable/endpoint_validator_spec.rb
|
234
|
+
- spec/swaggable/errors/validations_collection_spec.rb
|
176
235
|
- spec/swaggable/grape_adapter_spec.rb
|
177
236
|
- spec/swaggable/grape_entity_translator_spec.rb
|
178
|
-
- spec/swaggable/
|
237
|
+
- spec/swaggable/mime_type_definition_spec.rb
|
238
|
+
- spec/swaggable/mime_types_collection_spec.rb
|
179
239
|
- spec/swaggable/parameter_definition_spec.rb
|
240
|
+
- spec/swaggable/query_params_spec.rb
|
180
241
|
- spec/swaggable/rack_app_spec.rb
|
181
242
|
- spec/swaggable/rack_redirect_spec.rb
|
243
|
+
- spec/swaggable/rack_request_adapter_spec.rb
|
244
|
+
- spec/swaggable/rack_response_adapter_spec.rb
|
182
245
|
- spec/swaggable/response_definition_spec.rb
|
183
246
|
- spec/swaggable/schema_definition_spec.rb
|
184
247
|
- spec/swaggable/swagger_2_serializer_spec.rb
|
185
248
|
- spec/swaggable/swagger_2_validator_spec.rb
|
186
249
|
- spec/swaggable/tag_definition_spec.rb
|
250
|
+
- spec/swaggable/validating_rack_app_spec.rb
|
187
251
|
- spec/swaggable_spec.rb
|
188
252
|
has_rdoc:
|