swagalicious 0.2.0 → 0.3.0

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: 5067242694dc59e20ef8dd3c3c3a22456cd22b1b905be4805721f73c5239036c
4
- data.tar.gz: eac425366e51b211629753cb3ca7eeaa896688beafa44a75de75ab591aac3246
3
+ metadata.gz: 76b550126d23800f0a2612840c99e9204b82b1007a77f9aa3ba0469565e98385
4
+ data.tar.gz: 30fd88c6c6e4316247cea40688b5649e42d9971c54fe98b301f90d24d56418c5
5
5
  SHA512:
6
- metadata.gz: 1b89eaa63682085fa323a27b268b2b7255d5ac453040e0c2e0c988d8378c62b986514056eaf062b76737424623c36743fd56ca1f71ee1c6116e1b991bb1082b8
7
- data.tar.gz: 9ab0b21f31c7ec3e845ae58be31db0d006855ce717ca1a1f1f596ee480ddad44904d4fa43ea7f47801cd7014e480d0673af177b601b95ec761cc1e66274db8dc
6
+ metadata.gz: 2a8b447b7903389bcaa24bcda9896723e79b3ff32b438874bc8bc604ba9420ed3888d5010c1074b2a0a56f5b2386b889ce111d6f0751ad98eab3a07ca03856cc
7
+ data.tar.gz: 1932ca415378e1197cf7ec88b43a7bd9284d1d8e61bb0575f8c4ff8fa6b2a60851de15166e190d70c4dd0021db4d1009cf248b564fe5183f3e22af4c8cf4864b
@@ -1,11 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swagalicious (0.1.0)
4
+ swagalicious (0.2.0)
5
5
  faraday (~> 1.0.1)
6
6
  json-schema (~> 2.8.1)
7
7
  oj (~> 3.10.14)
8
8
  rack-test (~> 1.1.0)
9
+ rspec (~> 3.9.0)
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
@@ -18,7 +19,7 @@ GEM
18
19
  json-schema (2.8.1)
19
20
  addressable (>= 2.4)
20
21
  multipart-post (2.1.1)
21
- oj (3.10.14)
22
+ oj (3.10.18)
22
23
  public_suffix (4.0.6)
23
24
  rack (2.2.3)
24
25
  rack-test (1.1.0)
@@ -47,4 +48,4 @@ DEPENDENCIES
47
48
  swagalicious!
48
49
 
49
50
  BUNDLED WITH
50
- 2.1.2
51
+ 2.2.6
@@ -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,8 +53,10 @@ class Swagalicious
53
53
  metadata[:response][:request] = Oj.load(request[:payload])
54
54
  end
55
55
 
56
- metadata[:response][:examples] ||= {}
57
- metadata[:response][:examples]["application/json"] = @body
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 } } }
58
60
 
59
61
  # Validates response matches the proper schema
60
62
  Swagalicious::ResponseValidator.new.validate!(metadata, response)
@@ -125,7 +125,11 @@ class Swagalicious
125
125
 
126
126
  mime_list.each do |mime_type|
127
127
  # TODO upgrade to have content-type specific schema
128
- target_node[:content][mime_type] = { schema: schema }
128
+ body = target_node
129
+ .fetch(:body, {})
130
+ .fetch(mime_type, {})
131
+
132
+ target_node[:content][mime_type] = { schema: schema }.merge(body)
129
133
  end
130
134
  end
131
135
 
@@ -1,3 +1,3 @@
1
1
  class Swagalicious
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swagalicious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene Howe
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-30 00:00:00.000000000 Z
11
+ date: 2021-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -118,7 +118,7 @@ metadata:
118
118
  allowed_push_host: https://rubygems.org
119
119
  homepage_uri: https://github.com/ehowe/swagalicious
120
120
  source_code_uri: https://github.com/ehowe/swagalicious
121
- post_install_message:
121
+ post_install_message:
122
122
  rdoc_options: []
123
123
  require_paths:
124
124
  - lib
@@ -133,8 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  requirements: []
136
- rubygems_version: 3.1.4
137
- signing_key:
136
+ rubygems_version: 3.0.8
137
+ signing_key:
138
138
  specification_version: 4
139
139
  summary: RSwag without Rails
140
140
  test_files: []