in azure/functions/decorators/function_app.py [0:0]
def _validate_function(self,
auth_level: Optional[AuthLevel] = None) -> None:
"""
Validates the function information before building the function.
Functions with the same function name are not supported and should
fail indexing. If a function name is not defined, the default is the
method name. This also means that two functions with the same
method name will also fail indexing.
https://github.com/Azure/azure-functions-python-worker/issues/1489
:param auth_level: Http auth level that will be set if http
trigger function auth level is None.
"""
function_name = self._function.get_function_name()
trigger = self._function.get_trigger()
if trigger is None:
raise ValueError(
f"Function {function_name} does not have a trigger. A valid "
f"function must have one and only one trigger registered.")
bindings = self._function.get_bindings()
if trigger not in bindings:
raise ValueError(
f"Function {function_name} trigger {trigger} not present"
f" in bindings {bindings}")
# Set route to function name if unspecified in the http trigger
# Set auth level to function app auth level if unspecified in the
# http trigger
if Trigger.is_supported_trigger_type(trigger, HttpTrigger):
if getattr(trigger, 'route', None) is None:
getattr(trigger, 'init_params').append('route')
setattr(trigger, 'route', function_name)
if getattr(trigger, 'auth_level',
None) is None and auth_level is not None:
getattr(trigger, 'init_params').append('auth_level')
setattr(trigger, 'auth_level',
parse_singular_param_to_enum(auth_level, AuthLevel))
self._function._is_http_function = True