swagalicious 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76b550126d23800f0a2612840c99e9204b82b1007a77f9aa3ba0469565e98385
4
- data.tar.gz: 30fd88c6c6e4316247cea40688b5649e42d9971c54fe98b301f90d24d56418c5
3
+ metadata.gz: 660f3ec40bfe890817b3e6bdb147ed5d7499a3bcf5b5f966c2310292fb76f8d7
4
+ data.tar.gz: 4028bd843b9f12e82ff4c771a5389bf4504549bf304bc30d8fe3b0d66e057d6c
5
5
  SHA512:
6
- metadata.gz: 2a8b447b7903389bcaa24bcda9896723e79b3ff32b438874bc8bc604ba9420ed3888d5010c1074b2a0a56f5b2386b889ce111d6f0751ad98eab3a07ca03856cc
7
- data.tar.gz: 1932ca415378e1197cf7ec88b43a7bd9284d1d8e61bb0575f8c4ff8fa6b2a60851de15166e190d70c4dd0021db4d1009cf248b564fe5183f3e22af4c8cf4864b
6
+ metadata.gz: e8250341f3eef2fef73ec5c0db76b38771e8a127c80af680f844fd0c8e342e8be23ac8e8d62b262084b6024177b42076d6544e1ffd7546c1d3689142e0c4618e
7
+ data.tar.gz: 9ad802f13a6831eb15cccaa1491bbb52ff248b18e21dbf71c8cff0dde5093b52f5170b19f9f3314e4a1bafeec8e64a89ad998e10bda22122d1210fa94606a040
@@ -2,11 +2,11 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  swagalicious (0.2.0)
5
- faraday (~> 1.0.1)
5
+ faraday (~> 1.3.0)
6
6
  json-schema (~> 2.8.1)
7
- oj (~> 3.10.14)
7
+ oj (~> 3.11.0)
8
8
  rack-test (~> 1.1.0)
9
- rspec (~> 3.9.0)
9
+ rspec (~> 3.10.0)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
@@ -14,30 +14,34 @@ GEM
14
14
  addressable (2.7.0)
15
15
  public_suffix (>= 2.0.2, < 5.0)
16
16
  diff-lcs (1.4.4)
17
- faraday (1.0.1)
17
+ faraday (1.3.0)
18
+ faraday-net_http (~> 1.0)
18
19
  multipart-post (>= 1.2, < 3)
20
+ ruby2_keywords
21
+ faraday-net_http (1.0.1)
19
22
  json-schema (2.8.1)
20
23
  addressable (>= 2.4)
21
24
  multipart-post (2.1.1)
22
- oj (3.10.18)
25
+ oj (3.11.0)
23
26
  public_suffix (4.0.6)
24
27
  rack (2.2.3)
25
28
  rack-test (1.1.0)
26
29
  rack (>= 1.0, < 3)
27
30
  rake (12.3.3)
28
- rspec (3.9.0)
29
- rspec-core (~> 3.9.0)
30
- rspec-expectations (~> 3.9.0)
31
- rspec-mocks (~> 3.9.0)
32
- rspec-core (3.9.2)
33
- rspec-support (~> 3.9.3)
34
- rspec-expectations (3.9.2)
31
+ rspec (3.10.0)
32
+ rspec-core (~> 3.10.0)
33
+ rspec-expectations (~> 3.10.0)
34
+ rspec-mocks (~> 3.10.0)
35
+ rspec-core (3.10.1)
36
+ rspec-support (~> 3.10.0)
37
+ rspec-expectations (3.10.1)
35
38
  diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.9.0)
37
- rspec-mocks (3.9.1)
39
+ rspec-support (~> 3.10.0)
40
+ rspec-mocks (3.10.1)
38
41
  diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.9.0)
40
- rspec-support (3.9.3)
42
+ rspec-support (~> 3.10.0)
43
+ rspec-support (3.10.1)
44
+ ruby2_keywords (0.0.4)
41
45
 
42
46
  PLATFORMS
43
47
  ruby
@@ -9,13 +9,13 @@ class Swagalicious
9
9
  @config ||= Swagalicious::Configuration.new(RSpec.configuration)
10
10
  end
11
11
 
12
- require_relative "./swagalicious/configuration"
13
- require_relative "./swagalicious/example_group_helpers"
14
- require_relative "./swagalicious/example_helpers"
15
- require_relative "./swagalicious/extended_schema"
16
- require_relative "./swagalicious/request_factory"
17
- require_relative "./swagalicious/response_validator"
18
- require_relative "./swagalicious/swagger_formatter"
12
+ require_relative "swagalicious/configuration"
13
+ require_relative "swagalicious/example_group_helpers"
14
+ require_relative "swagalicious/example_helpers"
15
+ require_relative "swagalicious/extended_schema"
16
+ require_relative "swagalicious/request_factory"
17
+ require_relative "swagalicious/response_validator"
18
+ require_relative "swagalicious/swagger_formatter"
19
19
 
20
20
  ::RSpec::Core::ExampleGroup.define_example_group_method :path
21
21
 
@@ -53,10 +53,8 @@ class Swagalicious
53
53
  metadata[:response][:request] = Oj.load(request[:payload])
54
54
  end
55
55
 
56
- # TODO: What if there is more than 1 produces?
57
- mime_type = metadata[:operation][:produces].first
58
-
59
- metadata[:response][:body] ||= { mime_type => { examples: { mime_type => @body } } }
56
+ metadata[:response][:examples] ||= {}
57
+ metadata[:response][:examples]["application/json"] = @body
60
58
 
61
59
  # Validates response matches the proper schema
62
60
  Swagalicious::ResponseValidator.new.validate!(metadata, response)
@@ -125,11 +125,7 @@ class Swagalicious
125
125
 
126
126
  mime_list.each do |mime_type|
127
127
  # TODO upgrade to have content-type specific schema
128
- body = target_node
129
- .fetch(:body, {})
130
- .fetch(mime_type, {})
131
-
132
- target_node[:content][mime_type] = { schema: schema }.merge(body)
128
+ target_node[:content][mime_type] = { schema: schema }
133
129
  end
134
130
  end
135
131
 
@@ -1,3 +1,3 @@
1
1
  class Swagalicious
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -24,9 +24,9 @@ Gem::Specification.new do |spec|
24
24
  end
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_dependency "faraday", "~> 1.0.1"
27
+ spec.add_dependency "faraday", "~> 1.3.0"
28
28
  spec.add_dependency "json-schema", "~> 2.8.1"
29
- spec.add_dependency "oj", "~> 3.10.14"
29
+ spec.add_dependency "oj", "~> 3.11.0"
30
30
  spec.add_dependency "rack-test", "~> 1.1.0"
31
- spec.add_dependency "rspec", "~> 3.9.0"
31
+ spec.add_dependency "rspec", "~> 3.10.0"
32
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swagalicious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene Howe
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.1
19
+ version: 1.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.1
26
+ version: 1.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json-schema
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.10.14
47
+ version: 3.11.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.10.14
54
+ version: 3.11.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rack-test
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 3.9.0
75
+ version: 3.10.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 3.9.0
82
+ version: 3.10.0
83
83
  description: This gem is almost a straight copy and paste of https://github.com/rswag/rswag/tree/master/rswag-specs
84
84
  with the Rails specific code stripped out so it can be used in Rack applications
85
85
  that don't use Rails.