bullet_train-api 1.6.26 → 1.6.27
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 +45 -1
- data/lib/bullet_train/api/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: e8773d252b03c1ebb3342c9ee21e302f2b7bd2e6732da748c407f7e0796002c1
|
4
|
+
data.tar.gz: f7581ce2bc65fd5cd1f49324ddddb8b5936e1ee88bd431063cc82c253acc1c1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b64ba34512b1443e2a4d314c63aa691d700d20f398f6eb3fafbe397dba225f8c4415564d5a57f990ed9146183ff7c1814104b78b14fdb862da8469216d4e2322
|
7
|
+
data.tar.gz: 037ed5525018b8f23bc94cc737f1142991dbf3697c1501100e4361113a0db619b73550a5415db2845fb01b884af58ae4a688fbcc8d4c4e91008edda69237d1e7
|
@@ -47,7 +47,9 @@ module Api
|
|
47
47
|
indent(output, 1)
|
48
48
|
end
|
49
49
|
|
50
|
-
def automatic_components_for(model,
|
50
|
+
def automatic_components_for(model, **options)
|
51
|
+
locals = options.delete(:locals) || {}
|
52
|
+
|
51
53
|
path = "app/views/api/#{@version}"
|
52
54
|
paths = [path, "app/views"] + gem_paths.product(%W[/#{path} /app/views]).map(&:join)
|
53
55
|
|
@@ -76,6 +78,9 @@ module Api
|
|
76
78
|
|
77
79
|
attributes_output = JSON.parse(schema_json)
|
78
80
|
|
81
|
+
# Allow customization of Attributes
|
82
|
+
customize_component!(attributes_output, options[:attributes]) if options[:attributes]
|
83
|
+
|
79
84
|
# Add "Attributes" part to $ref's
|
80
85
|
update_ref_values!(attributes_output)
|
81
86
|
|
@@ -106,6 +111,9 @@ module Api
|
|
106
111
|
parameters_output["properties"].select! { |key| strong_parameter_keys.include?(key.to_sym) }
|
107
112
|
parameters_output["example"]&.select! { |key, value| strong_parameter_keys.include?(key.to_sym) && value.present? }
|
108
113
|
|
114
|
+
# Allow customization of Parameters
|
115
|
+
customize_component!(parameters_output, options[:parameters]) if options[:parameters]
|
116
|
+
|
109
117
|
(
|
110
118
|
indent(attributes_output.to_yaml.gsub("---", "#{model.name.gsub("::", "")}Attributes:"), 3) +
|
111
119
|
indent(" " + parameters_output.to_yaml.gsub("---", "#{model.name.gsub("::", "")}Parameters:"), 3)
|
@@ -164,5 +172,41 @@ module Api
|
|
164
172
|
end
|
165
173
|
end
|
166
174
|
end
|
175
|
+
|
176
|
+
def customize_component!(original, custom)
|
177
|
+
custom = custom.deep_stringify_keys.deep_transform_values { |v| v.is_a?(Symbol) ? v.to_s : v }
|
178
|
+
|
179
|
+
if custom.key?("add")
|
180
|
+
custom["add"].each do |property, details|
|
181
|
+
if details["required"]
|
182
|
+
original["required"] << property
|
183
|
+
details.delete("required")
|
184
|
+
end
|
185
|
+
original["properties"][property] = details
|
186
|
+
if details["example"]
|
187
|
+
original["example"][property] = details["example"]
|
188
|
+
details.delete("example")
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
if custom.key?("remove")
|
194
|
+
Array(custom["remove"]).each do |property|
|
195
|
+
original["required"].delete(property)
|
196
|
+
original["properties"].delete(property)
|
197
|
+
original["example"].delete(property)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
if custom.key?("only")
|
202
|
+
original["properties"].keys.each do |property|
|
203
|
+
unless Array(custom["only"]).include?(property)
|
204
|
+
original["properties"].delete(property)
|
205
|
+
original["required"].delete(property)
|
206
|
+
original["example"].delete(property)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
167
211
|
end
|
168
212
|
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.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
261
261
|
- !ruby/object:Gem::Version
|
262
262
|
version: '0'
|
263
263
|
requirements: []
|
264
|
-
rubygems_version: 3.
|
264
|
+
rubygems_version: 3.5.3
|
265
265
|
signing_key:
|
266
266
|
specification_version: 4
|
267
267
|
summary: Bullet Train API
|