bullet_train-api 1.6.23 → 1.6.24
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/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: d804ed1dce182c742eaea6f67f798bd160baa8e483e5bf0b778e2aaf53cfea7a
|
4
|
+
data.tar.gz: a979a3734abc96534ed39004f738415f064cd11ad4363044cc51002b51748fe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a6f2a8c49a6b17d12338c876a69443c6f2ccf7f604401d65f8541fb222528290de3a38b299c3d40590ef3294c3a70252e0220fde62c725f162145a621b13a65
|
7
|
+
data.tar.gz: 71c2c5a0ed25655ba970f3add908f418b252f525ea71f55b2af873c80128786c26bdd8caea75a098a6d0760c55e4b7eb4d566431d1825b08d22df123453eb666
|
@@ -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.24
|
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-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|