Skip to content

Commit

Permalink
Also handle custom models with no docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
tcompa committed Jul 19, 2024
1 parent aec104f commit 24fbc90
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions fractal_tasks_core/dev/lib_args_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,20 @@ def _remove_attributes_from_descriptions(old_schema: _Schema) -> _Schema:
new_schema = old_schema.copy()
if "$defs" in new_schema:
for name, definition in new_schema["$defs"].items():
parsed_docstring = docparse(definition["description"])
new_schema["$defs"][name][
"description"
] = parsed_docstring.short_description
if "description" in definition.keys():
parsed_docstring = docparse(definition["description"])
new_schema["$defs"][name][
"description"
] = parsed_docstring.short_description
elif "title" in definition.keys():
title = definition["title"]
new_schema["$defs"][name][
"description"
] = f"Missing description for {title}."
else:
new_schema["$defs"][name][
"description"
] = "Missing description"
logging.info("[_remove_attributes_from_descriptions] END")
return new_schema

Expand Down

0 comments on commit 24fbc90

Please sign in to comment.