Skip to content

Commit 123a24e

Browse files
committed
[API] Generator: Improve the way we show optional values for options in API docs
1 parent 2a4eae2 commit 123a24e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

elasticsearch-api/utils/thor/generate_source.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,12 @@ def docs_helper(name, info)
229229
info['type'] = 'String' if info['type'] == 'enum' # Rename 'enums' to 'strings'
230230
tipo = info['type'] ? info['type'].capitalize : 'String'
231231
description = info['description'] ? info['description'].strip : '[TODO]'
232-
options = info['options'] ? "\n # (options: #{info['options'].join(', '.strip)})" : nil
233-
required = info['required'] ? ' (*Required*)' : ''
234-
deprecated = info['deprecated'] ? ' *Deprecated*' : ''
235-
"# @option arguments [#{tipo}] :#{name} #{description} #{required} #{deprecated} #{options}\n"
232+
options = info['options'] ? "(options: #{info['options'].join(', ').strip})" : nil
233+
required = info['required'] ? '(*Required*)' : ''
234+
deprecated = info['deprecated'] ? '*Deprecated*' : ''
235+
optionals = [required, deprecated, options].join(' ').strip
236+
237+
"# @option arguments [#{tipo}] :#{name} #{description} #{optionals}\n"
236238
end
237239

238240
def stability_doc_helper(stability)

0 commit comments

Comments
 (0)