https://prefect.io logo
Title
s

Stéphan Taljaard

11/16/2022, 9:19 AM
This is so simple, yet quite amazing:
from typing import Literal
from prefect import flow

AllowedStrings = Literal["A", "B"]

@flow
def example(str_input: AllowedStrings):
    print(str_input)

example("C")
--->
11:15:58.598 | INFO    | prefect.engine - Created flow run 'blond-auk' for flow 'example'
11:15:58.598 | ERROR   | Flow run 'blond-auk' - Validation of flow parameters failed with error: ParameterTypeError: Flow run received invalid parameters:
 - str_input: unexpected value; permitted: 'A', 'B'
🙏 1
:its-beautiful: 1