-
Notifications
You must be signed in to change notification settings - Fork 106
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
Support Literal types in script runner #1249
Support Literal types in script runner #1249
Conversation
9e88b0a
to
a6813e8
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1249 +/- ##
=====================================
Coverage 86.2% 86.2%
=====================================
Files 60 60
Lines 4109 4113 +4
Branches 659 660 +1
=====================================
+ Hits 3543 3547 +4
Misses 393 393
Partials 173 173 ☔ View full report in Codecov by Sentry. |
3aa8505
to
3ee9ef3
Compare
ab05641
to
eadeb61
Compare
Combine the two non-Pydantic paths of _get_inputs_from_callable into one using construct_io_from_annotation. This fixes a bug where the default was being verified as None for optional strings only if there was no IO annotation. Signed-off-by: Alice Purcell <[email protected]>
Signed-off-by: Alice Purcell <[email protected]>
Signed-off-by: Alice Purcell <[email protected]>
Signed-off-by: Alice Purcell <[email protected]>
Signed-off-by: Alice Purcell <[email protected]>
bbdcfb1
to
602ed78
Compare
This function only support setting the enum field, and it doesn't appear likely that we will want to set other fields in future, so make the name more specific. Additionally, add a docstring, and refactor the function to use the early-return pattern now adding other metadata is ruled out. Signed-off-by: Alice Purcell <[email protected]>
602ed78
to
dbb4a66
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Pull Request Checklist
Description of PR
Currently, the script runner does not support
Literal
types, asorigin_type_issubtype
does not special-case them, so_is_str_kwarg_of
does not return True.This PR adds supports for Literals to
origin_type_issubtype
, and additionally copies their values from the annotation into theenum
field on input Parameters. It also combines two paths in_get_inputs_from_callable
into one by usingconstruct_io_from_annotation
instead of having a fallback branch ifget_workflow_annotation
returnsNone
; this fixes a bug where the default was being verified as None for optional strings only if there was no IO annotation.