Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse docstrings for nested argument models #418

Closed
tcompa opened this issue Jun 9, 2023 · 1 comment · Fixed by #436
Closed

Parse docstrings for nested argument models #418

tcompa opened this issue Jun 9, 2023 · 1 comment · Fixed by #436
Assignees
Labels
High Priority Current Priorities & Blocking Issues JSON Schemas

Comments

@tcompa
Copy link
Collaborator

tcompa commented Jun 9, 2023

After we introduce the first nested task-argument model (see #386), we should also parse the nested-model arguments description. This will probably be a bit custom, but it can be done as part of the dev tools.

@tcompa
Copy link
Collaborator Author

tcompa commented Jun 19, 2023

  1. Extract _get_args_descriptions and _include_args_descriptions_in_schema into a new module fractal_tasks_core.dev.lib_descriptions.py.

  2. Hard-code a list of inner Pydantic models with their module, e.g.

OmeroChannel, defined in fractal_tasks_core.lib_channels
Window, defined in fractal_tasks_core.lib_channels
Channel, defined in fractal_tasks_core.tasks._input_models
NapariWorkflowsInput, defined in fractal_tasks_core.tasks._input_models
NapariWorkflowsOutput, defined in fractal_tasks_core.tasks._input_models
...
  1. For each one of this model, run a function (similar to _get_args_descriptions) that extracts the docstring (via ast) and parses it (via docstring_parser). The goal is to have something similar to
descriptions = {
    "attribute1": "TBD",
    "attribute2": "This is my docstring...",
} 

for each object in the list.

  1. Write and run a function similar to _include_args_descriptions_in_schema, that goes into the definitions block and injects the new descriptions of custom-model attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
High Priority Current Priorities & Blocking Issues JSON Schemas
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants