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 +4 -4
- data/Gemfile.lock +4 -3
- data/lib/swagalicious.rb +7 -7
- data/lib/swagalicious/example_helpers.rb +4 -2
- data/lib/swagalicious/swagger_formatter.rb +5 -1
- data/lib/swagalicious/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76b550126d23800f0a2612840c99e9204b82b1007a77f9aa3ba0469565e98385
|
4
|
+
data.tar.gz: 30fd88c6c6e4316247cea40688b5649e42d9971c54fe98b301f90d24d56418c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a8b447b7903389bcaa24bcda9896723e79b3ff32b438874bc8bc604ba9420ed3888d5010c1074b2a0a56f5b2386b889ce111d6f0751ad98eab3a07ca03856cc
|
7
|
+
data.tar.gz: 1932ca415378e1197cf7ec88b43a7bd9284d1d8e61bb0575f8c4ff8fa6b2a60851de15166e190d70c4dd0021db4d1009cf248b564fe5183f3e22af4c8cf4864b
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
swagalicious (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.
|
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.
|
51
|
+
2.2.6
|
data/lib/swagalicious.rb
CHANGED
@@ -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
|
-
|
57
|
-
metadata[:
|
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
|
-
|
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
|
|
data/lib/swagalicious/version.rb
CHANGED
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.
|
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:
|
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.
|
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: []
|