hera icon indicating copy to clipboard operation
hera copied to clipboard

Fix issues with with_param

Open alicederyn opened this issue 4 months ago • 2 comments

Pull Request Checklist

  • [X] Fixes #861 and fixes #1234
  • [X] Tests added
  • [X] Documentation/examples added
  • [X] Good commit messages and/or PR title

Description of PR Currently, the logic implementing with_param assumes that Argo Parameters exactly match script function parameters, including the Python parameter name. This does not support the experimental script_annotations and script_pydantic_io features.

This PR extracts common logic for creating an IO object from parameter/field metadata into a construct_io_from_annotation function, which copies any IO annotation it finds, sets the name if missing, and defaults to a Parameter if no annotation is found. It then uses this to generalize _get_param_items_from_source, including:

  • pulling the parameters from a Pydantic Input type instead, if present
  • respecting the name in the Parameter annotation, if present
  • ignoring output=True annotations
  • ignoring Artifact annotations

alicederyn avatar Oct 10 '24 08:10 alicederyn