bullet_train-api 1.6.23 → 1.6.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/api/open_api_helper.rb +23 -6
- data/lib/bullet_train/api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b74d7978ed040fb1ff9fb993a9ef20681be77615016c9e206b0d553ccfd3328f
|
4
|
+
data.tar.gz: e69b03ab081484af08ff01de050836a048255118404500bf7bbc60fe81a43215
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71c42eac7d429cc9092d29fec72c778d790dcc8e66aa8b83af68fa4e601ced8b0ffd22a2265d376a5cde37fb200c0a0178ec29ecb31f59c5b54884cb7afd1a55
|
7
|
+
data.tar.gz: f5163efb4b5e5652882c3f92d26a565703b6cfabfd638bb47a2d50e31abd645264b60e1714780ece604f9d0a912777817272fbf7c9827442c42d8c69017a7637
|
@@ -27,18 +27,23 @@ module Api
|
|
27
27
|
output = render("api/#{@version}/open_api/shared/paths", except: except)
|
28
28
|
output = Scaffolding::Transformer.new(model.name, [parent&.name]).transform_string(output).html_safe
|
29
29
|
|
30
|
-
custom_actions_file_path = "api/#{@version}/open_api/#{model.
|
31
|
-
|
32
|
-
|
33
|
-
# There are some placeholders specific to this method that we still need to transform.
|
34
|
-
model_symbol = model.name.underscore.tr("/", "_").to_sym
|
30
|
+
custom_actions_file_path = "api/#{@version}/open_api/#{model.model_name.collection}/paths"
|
31
|
+
custom_output = render(custom_actions_file_path).html_safe if lookup_context.exists?(custom_actions_file_path, [], true)
|
35
32
|
|
36
33
|
FactoryBot::ExampleBot::REST_METHODS.each do |method|
|
37
|
-
if (code = FactoryBot.send(method,
|
34
|
+
if (code = FactoryBot.send(method, model.model_name.param_key.to_sym, version: @version))
|
38
35
|
output.gsub!("🚅 #{method}", code)
|
36
|
+
custom_output&.gsub!("🚅 #{method}", code)
|
39
37
|
end
|
40
38
|
end
|
41
39
|
|
40
|
+
if custom_output
|
41
|
+
merge = deep_merge(YAML.load(output), YAML.load(custom_output)).to_yaml.html_safe
|
42
|
+
# YAML.load escapes emojis https://github.com/ruby/psych/issues/371
|
43
|
+
# Next line returns emojis back and removes yaml garbage
|
44
|
+
output = merge.gsub("---", "").gsub(/\\u[\da-f]{8}/i) { |m| [m[-8..].to_i(16)].pack("U") }
|
45
|
+
end
|
46
|
+
|
42
47
|
indent(output, 1)
|
43
48
|
end
|
44
49
|
|
@@ -147,5 +152,17 @@ module Api
|
|
147
152
|
end
|
148
153
|
end
|
149
154
|
end
|
155
|
+
|
156
|
+
def deep_merge(hash1, hash2)
|
157
|
+
hash1.merge(hash2) do |_, old_val, new_val|
|
158
|
+
if old_val.is_a?(Hash) && new_val.is_a?(Hash)
|
159
|
+
deep_merge(old_val, new_val)
|
160
|
+
elsif old_val.is_a?(Array) && new_val.is_a?(Array)
|
161
|
+
(old_val + new_val).uniq
|
162
|
+
else
|
163
|
+
new_val
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
150
167
|
end
|
151
168
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|