Skip to content

Commit 62ca59b

Browse files
committed
wip: fix doc generation for absent return type (table functions)
1 parent 19041fb commit 62ca59b

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

site/docs/extensions/generate_function_docs.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,27 @@ def write_markdown(file_obj: dict, file_name: str) -> None:
125125
# If the return value for the function implementation is multiple lines long,
126126
# print each line separately. This is the case for some functions in
127127
# functions_arithmetic_decimal.yaml
128-
if "\n" in impl["return"]:
129-
mdFile.new_line(
130-
f"{count}. {function_name}({func_concat_arg_input_values}): -> "
131-
)
132-
multiline_return_str = "\t" + impl["return"]
133-
multiline_return_str = multiline_return_str.replace("\n", "\n\t")
134-
mdFile.new_line("\t```")
135-
mdFile.new_line(f"{multiline_return_str}")
136-
mdFile.new_line("\t```")
128+
# Table functions may omit the return field if schema depends on runtime data
129+
if "return" in impl:
130+
if "\n" in impl["return"]:
131+
mdFile.new_line(
132+
f"{count}. {function_name}({func_concat_arg_input_values}): -> "
133+
)
134+
multiline_return_str = "\t" + impl["return"]
135+
multiline_return_str = multiline_return_str.replace("\n", "\n\t")
136+
mdFile.new_line("\t```")
137+
mdFile.new_line(f"{multiline_return_str}")
138+
mdFile.new_line("\t```")
139+
else:
140+
mdFile.new_line(
141+
f"{count}. {function_name}({func_concat_arg_input_values}): -> "
142+
f"`{impl['return']}`"
143+
)
137144
else:
145+
# Return type not specified (e.g., table functions with runtime-dependent schemas)
138146
mdFile.new_line(
139147
f"{count}. {function_name}({func_concat_arg_input_values}): -> "
140-
f"`{impl['return']}`"
148+
f"`schema determined at runtime`"
141149
)
142150

143151
if "description" in function_spec:

0 commit comments

Comments
 (0)