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

Optional Parameter Input Becoming Required for Flow Submission #1599

Open
prefectcboyd opened this issue Jul 19, 2023 · 1 comment
Open

Optional Parameter Input Becoming Required for Flow Submission #1599

prefectcboyd opened this issue Jul 19, 2023 · 1 comment
Labels
bug Something isn't working priority:medium

Comments

@prefectcboyd
Copy link

An Optional input that has a parameter requirement, is being coerced into a required field.

Below is a sample repo that demonstrates the issue - notably, if required_integer: int, is entirely removed (leaving only the Optional[InputModel], the custom deployment cannot be submitted. It can be submitted from the JSON page, however.

image

from typing import Optional

import prefect
from pydantic import BaseModel


class InputModel(BaseModel):
    required_field: int


@prefect.flow(name="test-flow")
def test(
    required_integer: int,
    optional_input_model: Optional[InputModel] = None,
) -> None:
    logger = prefect.get_run_logger()

    logger.info(f"{required_integer=}")
    logger.info(f"{optional_input_model=}")
@prefectcboyd prefectcboyd added the bug Something isn't working label Jul 19, 2023
@zhen0
Copy link
Member

zhen0 commented Jul 31, 2023

@prefectcboyd - since there is a workaround by using the json input, I'm marking as medium, please let me know if you think this needs a higher priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:medium
Projects
None yet
Development

No branches or pull requests

2 participants