rspec-openapi 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/rspec/openapi/record_builder.rb +8 -1
- data/lib/rspec/openapi/schema_builder.rb +14 -9
- data/lib/rspec/openapi/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b483a73ef32d771b4da3e66f3c63d1cd0a1cfbb839752546d5465cda43ff8444
|
4
|
+
data.tar.gz: cf8ec362c29193e2434db5433170ec655008cd5f636a8f2341f9abf7e7f3d454
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de935612cc1afdd9c8ccca7d69711beca33dea36ec97555293978544c9c1a978c04cdc196c42a39888408d7575e40d0d6dff76adf1d629b27512c569feb9b29a
|
7
|
+
data.tar.gz: 423d62a92e8a9b143fae9304af57d893e079dbc9cb956e17320ea45a3bf30d8084f88395fdeaa835cd8689c3b72ecba2b40812bd9c81a0f044ddf91754169f9c
|
data/CHANGELOG.md
CHANGED
@@ -24,6 +24,13 @@ class << RSpec::OpenAPI::RecordBuilder = Object.new
|
|
24
24
|
summary = "#{request.method} #{request.path}"
|
25
25
|
end
|
26
26
|
|
27
|
+
response_body =
|
28
|
+
begin
|
29
|
+
response.parsed_body
|
30
|
+
rescue JSON::ParserError
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
|
27
34
|
RSpec::OpenAPI::Record.new(
|
28
35
|
method: request.request_method,
|
29
36
|
path: path,
|
@@ -34,7 +41,7 @@ class << RSpec::OpenAPI::RecordBuilder = Object.new
|
|
34
41
|
summary: summary,
|
35
42
|
description: RSpec::OpenAPI.description_builder.call(example),
|
36
43
|
status: response.status,
|
37
|
-
response_body:
|
44
|
+
response_body: response_body,
|
38
45
|
response_content_type: response.content_type,
|
39
46
|
).freeze
|
40
47
|
end
|
@@ -2,6 +2,19 @@ class << RSpec::OpenAPI::SchemaBuilder = Object.new
|
|
2
2
|
# @param [RSpec::OpenAPI::Record] record
|
3
3
|
# @return [Hash]
|
4
4
|
def build(record)
|
5
|
+
response = {
|
6
|
+
description: record.description,
|
7
|
+
}
|
8
|
+
|
9
|
+
if record.response_body
|
10
|
+
response[:content] = {
|
11
|
+
normalize_content_type(record.response_content_type) => {
|
12
|
+
schema: build_property(record.response_body),
|
13
|
+
example: (record.response_body if example_enabled?),
|
14
|
+
}.compact,
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
5
18
|
{
|
6
19
|
paths: {
|
7
20
|
normalize_path(record.path) => {
|
@@ -10,15 +23,7 @@ class << RSpec::OpenAPI::SchemaBuilder = Object.new
|
|
10
23
|
parameters: build_parameters(record),
|
11
24
|
requestBody: build_request_body(record),
|
12
25
|
responses: {
|
13
|
-
record.status.to_s =>
|
14
|
-
description: record.description,
|
15
|
-
content: {
|
16
|
-
normalize_content_type(record.response_content_type) => {
|
17
|
-
schema: build_property(record.response_body),
|
18
|
-
example: (record.response_body if example_enabled?),
|
19
|
-
}.compact,
|
20
|
-
},
|
21
|
-
},
|
26
|
+
record.status.to_s => response,
|
22
27
|
},
|
23
28
|
}.compact,
|
24
29
|
},
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-openapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
|
-
rubygems_version: 3.2
|
91
|
+
rubygems_version: 3.1.2
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Generate OpenAPI schema from RSpec request specs
|