167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
# File 'lib/explicit/type.rb', line 167
def merge_base_json_schema(attributes)
topics = attributes.delete(:description_topics)&.compact_blank || []
formatted_description =
if description.present? && topics.empty?
description
elsif description.present? && topics.any?
description + "\n\n" + topics.join("\n")
else
topics.join("\n")
end
default_value =
if default&.respond_to?(:call)
nil
else
default
end
base_attributes = {
default: default_value,
description: formatted_description
}.compact_blank
base_attributes.merge(attributes)
end
|