def register_typed_event()

in src/functions_framework/_typed_event.py [0:0]


def register_typed_event(decorator_type, func):
    try:
        sig = signature(func)
        annotation_type = list(sig.parameters.values())[0].annotation
        input_type = _select_input_type(decorator_type, annotation_type)
        _validate_input_type(input_type)
    except IndexError:
        raise FunctionsFrameworkException(
            "Function signature is missing an input parameter."
            "The function should be defined as 'def your_fn(in: inputType)'"
        )
    except Exception as e:
        raise FunctionsFrameworkException(
            "Functions using the @typed decorator must provide "
            "the type of the input parameter by specifying @typed(inputType) and/or using python "
            "type annotations 'def your_fn(in: inputType)'"
        )

    _function_registry.INPUT_TYPE_MAP[func.__name__] = input_type
    _function_registry.REGISTRY_MAP[func.__name__] = (
        _function_registry.TYPED_SIGNATURE_TYPE
    )