fictium 0.4 → 0.4.1
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/.github/ISSUE_TEMPLATE/bug_report.md +31 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/fictium/exporters/api_blueprint_exporter/example_formatter.rb +3 -0
- data/lib/fictium/exporters/open_api/v3_exporter/path_formatter.rb +9 -3
- data/lib/fictium/exporters/postman/v2_exporter/body_formatter.rb +2 -0
- data/lib/fictium/exporters/postman/v2_exporter/header_formatter.rb +2 -0
- data/lib/fictium/exporters/postman/v2_exporter/request_formatter.rb +8 -0
- data/lib/fictium/exporters/postman/v2_exporter/response_formatter.rb +2 -0
- data/lib/fictium/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1a54edc49ccfb9c176f88c38fa85b3e082d10e94de2843900f864b12ed9dfa0
|
4
|
+
data.tar.gz: 115563764808af6b7b1bb86ac7e07cecdcf2ecb99f178152facb811b64550594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d72bf0d0cb122fb665c0ea59d02460cea824fa3ad51093cdb8c40a39484f7c077b5b0bde8591eb5ebffdaa5c63e9800eef852b14d6e8d98b17f28a7c283ebdf6
|
7
|
+
data.tar.gz: 2d03e36da0f6e8adbd8473951d5c4b5624f3016a2a36f1275cd9208236a5924ec292031e270a738ded4f6eb9b55924a9852b2c818020e1fb41d51532f1dd2eed
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Create a report to help us improve
|
4
|
+
title: ''
|
5
|
+
labels: bug
|
6
|
+
assignees: holywyvern
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Describe the bug**
|
11
|
+
A clear and concise description of what the bug is.
|
12
|
+
|
13
|
+
**To Reproduce**
|
14
|
+
Steps to reproduce the behavior:
|
15
|
+
1. Go to '...'
|
16
|
+
2. Click on '....'
|
17
|
+
3. Scroll down to '....'
|
18
|
+
4. See error
|
19
|
+
|
20
|
+
**Expected behavior**
|
21
|
+
A clear and concise description of what you expected to happen.
|
22
|
+
|
23
|
+
**Screenshots**
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
25
|
+
|
26
|
+
**Rails version (please complete the following information):**
|
27
|
+
**Ruby version (please complete the following information):**
|
28
|
+
**Fictium version (please complete the following information):**
|
29
|
+
|
30
|
+
**Additional context**
|
31
|
+
Add any other context about the problem here.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Suggest an idea for this project
|
4
|
+
title: ''
|
5
|
+
labels: enhancement
|
6
|
+
assignees: holywyvern
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
12
|
+
|
13
|
+
**Describe the solution you'd like**
|
14
|
+
A clear and concise description of what you want to happen.
|
15
|
+
|
16
|
+
**Describe alternatives you've considered**
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
18
|
+
|
19
|
+
**Additional context**
|
20
|
+
Add any other context or screenshots about the feature request here.
|
21
|
+
|
22
|
+
**Fictium version you want this feature:**
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -46,7 +46,7 @@ Fictium is closely tied to RSpec and Rails, but it's developed in a way to suppo
|
|
46
46
|
|
47
47
|
The primary goal is for generating OpenAPI Documentation, but, just like with RSpec, future versions may provide other output types.
|
48
48
|
|
49
|
-
[Check out the wiki too!](
|
49
|
+
[Check out the wiki too!](https://github.com/Wolox/fictium/wiki)
|
50
50
|
|
51
51
|
|
52
52
|
### Common terminology of this gem
|
@@ -10,6 +10,7 @@ module Fictium
|
|
10
10
|
private
|
11
11
|
|
12
12
|
def format_request(example)
|
13
|
+
return '' if example.request.blank?
|
13
14
|
return '' if example.request[:body].blank?
|
14
15
|
|
15
16
|
result = request_head(example)
|
@@ -19,6 +20,8 @@ module Fictium
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def format_response(example)
|
23
|
+
return '' if example.response.blank?
|
24
|
+
|
22
25
|
result = response_head(example)
|
23
26
|
result += parse_http_object(example.response)
|
24
27
|
result
|
@@ -3,6 +3,8 @@ module Fictium
|
|
3
3
|
class V3Exporter
|
4
4
|
class PathFormatter
|
5
5
|
def add_path(paths, action)
|
6
|
+
return if action.method.blank?
|
7
|
+
|
6
8
|
path_object = paths[action.full_path] || default_path_object
|
7
9
|
path_object[action.method.to_sym] = create_operation(action)
|
8
10
|
paths[action.full_path] = path_object
|
@@ -41,12 +43,16 @@ module Fictium
|
|
41
43
|
|
42
44
|
example_formatter.format_default(operation, responses, default_example)
|
43
45
|
other_examples = action.examples.reject { |example| example == default_example }
|
44
|
-
other_examples.each
|
45
|
-
responses[example.response[:status]] = example_formatter.format(example)
|
46
|
-
end
|
46
|
+
other_examples.each { |example| format_example(responses, example) }
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
+
def format_example(responses, example)
|
51
|
+
return if example.response.blank?
|
52
|
+
|
53
|
+
responses[example.response[:status]] = example_formatter.format(example)
|
54
|
+
end
|
55
|
+
|
50
56
|
def example_formatter
|
51
57
|
@example_formatter ||= ExampleFormatter.new
|
52
58
|
end
|
@@ -29,6 +29,8 @@ module Fictium
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def full_path(example)
|
32
|
+
return '' if example.request.blank?
|
33
|
+
|
32
34
|
"#{api_url}#{convert_path(example.action)}#{query_params_for(example)}"
|
33
35
|
end
|
34
36
|
|
@@ -52,6 +54,8 @@ module Fictium
|
|
52
54
|
end
|
53
55
|
|
54
56
|
def format_query(example)
|
57
|
+
return [] if example.request.blank?
|
58
|
+
|
55
59
|
example.request[:query_parameters].map do |key, value|
|
56
60
|
result = { key: key, value: value.to_json }
|
57
61
|
description = example.action[:query][key] && example.action[:query][key][:description]
|
@@ -61,6 +65,8 @@ module Fictium
|
|
61
65
|
end
|
62
66
|
|
63
67
|
def format_variable(example)
|
68
|
+
return [] if example.request.blank?
|
69
|
+
|
64
70
|
[].tap do |result|
|
65
71
|
example.action[:path].each do |name, _|
|
66
72
|
data = { id: name, key: name }
|
@@ -72,6 +78,8 @@ module Fictium
|
|
72
78
|
end
|
73
79
|
|
74
80
|
def add_optional_values(example, result)
|
81
|
+
return if example.request.blank?
|
82
|
+
|
75
83
|
body = body_formatter.format(example.request)
|
76
84
|
result[:body] = body if body.present?
|
77
85
|
end
|
data/lib/fictium/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fictium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ramiro Rojo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -240,6 +240,8 @@ extensions: []
|
|
240
240
|
extra_rdoc_files: []
|
241
241
|
files:
|
242
242
|
- ".codeclimate.yml"
|
243
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
244
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
243
245
|
- ".github/pull_request_template.md"
|
244
246
|
- ".gitignore"
|
245
247
|
- ".rspec"
|