Skip to content

Commit 26fec6b

Browse files
committed
wip: fix doc generation for absent return type (table functions)
1 parent 092ba9d commit 26fec6b

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

site/docs/extensions/generate_function_docs.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,29 @@ 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(
136+
"\n", "\n\t"
137+
)
138+
mdFile.new_line("\t```")
139+
mdFile.new_line(f"{multiline_return_str}")
140+
mdFile.new_line("\t```")
141+
else:
142+
mdFile.new_line(
143+
f"{count}. {function_name}({func_concat_arg_input_values}): -> "
144+
f"`{impl['return']}`"
145+
)
137146
else:
147+
# Return type not specified (e.g., table functions with runtime-dependent schemas)
138148
mdFile.new_line(
139149
f"{count}. {function_name}({func_concat_arg_input_values}): -> "
140-
f"`{impl['return']}`"
150+
f"`schema determined at runtime`"
141151
)
142152

143153
if "description" in function_spec:

0 commit comments

Comments
 (0)