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

[BUG] fix is_optional_type to not return true for all union types #2824

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

pvditt
Copy link
Contributor

@pvditt pvditt commented Oct 16, 2024

Tracking issue

fixes: https://linear.app/unionai/issue/COR-2132/launch-plan-w-union-type-param-breaks

Why are the changes needed?

registering a workflow fails if it contains param of type union

@task
def calculate_interest(principal: int, rate: typing.Union[float, int], time: int) -> float:
    return (principal * rate * time) / 12


@workflow
def interest_workflow(principal: int, rate: typing.Union[float, int], time: int) -> float:
    return calculate_interest(principal=principal, rate=rate, time=time)
Request rejected by the API, due to Invalid input.
RPC Failed, with Status: StatusCode.INVALID_ARGUMENT
        Details: Type mismatch for Parameter rate in default_inputs has type union_type:{variants:{simple:FLOAT  structure:{tag:"float"}}  variants:{simple:INTEGER  structure:{tag:"int"}}}, expected simple:NONE

This occurs due to: #2327 + #2724

What changes were proposed in this pull request?

fix is_optional_type to not return true for all union types

How was this patch tested?

  • updated unit tests
  • ran workflows in sandbox to confirm registration issues are resolved

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Signed-off-by: Paul Dittamo <pvdittamo@gmail.com>
@wild-endeavor wild-endeavor merged commit de4e743 into master Oct 16, 2024
104 checks passed
eapolinario pushed a commit that referenced this pull request Oct 16, 2024
Signed-off-by: Paul Dittamo <pvdittamo@gmail.com>
wild-endeavor pushed a commit that referenced this pull request Oct 16, 2024
…2825)

Signed-off-by: Paul Dittamo <pvdittamo@gmail.com>
Co-authored-by: Paul Dittamo <37558497+pvditt@users.noreply.github.com>
kumare3 pushed a commit that referenced this pull request Nov 8, 2024
Signed-off-by: Paul Dittamo <pvdittamo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants