diff --git a/python_modules/dagster/dagster/_config/pythonic_config/type_check_utils.py b/python_modules/dagster/dagster/_config/pythonic_config/type_check_utils.py index d929e3ccb30cf..ca432a32afb08 100644 --- a/python_modules/dagster/dagster/_config/pythonic_config/type_check_utils.py +++ b/python_modules/dagster/dagster/_config/pythonic_config/type_check_utils.py @@ -42,6 +42,8 @@ def is_optional(annotation: Type) -> bool: # The Python 3.10 pipe syntax evaluates to a UnionType # rather than a Union, so we need to check for that as well + # UnionType values are equivalent to Unions, e.g. str | None == Union[str, None] + # but the types themselves are not, e.g. type(str | None) != type(Union[str, None]) if get_origin(annotation) == UnionType: return len(get_args(annotation)) == 2 and type(None) in get_args(annotation)