<#3439 fix: EnumTransformer.to_literal accepts a s...
# flyte-github
a
#3439 fix: EnumTransformer.to_literal accepts a string matching an enum value Pull request opened by 1fanwang Why are the changes needed?
EnumTransformer.assert_type
accepts a raw string that matches one of the enum's values (for instance an enum default supplied as a string), but
EnumTransformer.to_literal
rejects that same string with
Expected an enum
. So a matching-string value passes type-checking and then fails at serialization. What changes were proposed in this pull request?
to_literal
now accepts a string matching one of the enum's values and serializes it to the corresponding literal, consistent with
assert_type
. A non-matching string is still rejected. How was this patch tested? Added
test_enum_to_literal_accepts_matching_string
— it fails on the current code with
TypeTransformerFailedError: Expected an enum
and passes with the fix. Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. flyteorg/flytekit