Skip to content

Commit f9bf8ff

Browse files
gavin-aguiarGavin Aguiarpdthummar
authored
Reverted route validation (#1278)
* Reverted route validation * Skipping unit tests * Removed skipped tests * Fixed flake8 test --------- Co-authored-by: Gavin Aguiar <gavin@GavinPC> Co-authored-by: pdthummar <[email protected]>
1 parent 242853b commit f9bf8ff

File tree

2 files changed

+3
-31
lines changed

2 files changed

+3
-31
lines changed

azure_functions_worker/functions.py

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,6 @@ def get_return_binding(binding_name: str,
8080

8181
return return_binding_name
8282

83-
@staticmethod
84-
def validate_binding_route(func_name: str, binding: BindingInfo,
85-
func_type: str):
86-
if hasattr(binding, 'route') and binding.route.startswith(
87-
'/') and func_type == 'function':
88-
raise FunctionLoadError(
89-
func_name,
90-
f'Invalid route name: {binding.route}. Route name cannot begin'
91-
f' with a /')
92-
9383
@staticmethod
9484
def validate_binding_direction(binding_name: str,
9585
binding_direction: str,
@@ -105,14 +95,6 @@ def validate_binding_direction(binding_name: str,
10595
func_name,
10696
'"$return" binding must have direction set to "out"')
10797

108-
def validate_binding(self, func_name: str, binding: BindingInfo,
109-
func_type: str):
110-
self.validate_binding_route(func_name, binding, func_type)
111-
112-
self.validate_binding_direction(binding.name,
113-
binding.direction,
114-
func_name)
115-
11698
@staticmethod
11799
def is_context_required(params, bound_params: dict,
118100
annotations: dict,
@@ -377,7 +359,6 @@ def add_function(self, function_id: str,
377359
def add_indexed_function(self, function):
378360
func = function.get_user_function()
379361
func_name = function.get_function_name()
380-
func_type = function.http_type
381362
function_id = str(uuid.uuid5(namespace=uuid.NAMESPACE_OID,
382363
name=func_name))
383364
return_binding_name: typing.Optional[str] = None
@@ -391,7 +372,9 @@ def add_indexed_function(self, function):
391372

392373
bound_params = {}
393374
for binding in function.get_bindings():
394-
self.validate_binding(func_name, binding, func_type)
375+
self.validate_binding_direction(binding.name,
376+
binding.direction,
377+
func_name)
395378

396379
has_explicit_return, has_implicit_return = \
397380
self.get_explicit_and_implicit_return(

tests/unittests/test_functions_registry.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,6 @@ def dummy():
2121
self.func = Function(self.dummy, "test.py")
2222
self.function_registry = functions.Registry()
2323

24-
def test_add_indexed_function_invalid_route(self):
25-
trigger1 = HttpTrigger(name="req1", route="/")
26-
self.func.add_trigger(trigger=trigger1)
27-
28-
with self.assertRaises(FunctionLoadError) as ex:
29-
self.function_registry.add_indexed_function(function=self.func)
30-
31-
self.assertEqual(str(ex.exception),
32-
'cannot load the dummy function: Invalid route name: '
33-
'/. Route name cannot begin with a /')
34-
3524
def test_add_indexed_function_invalid_direction(self):
3625
trigger1 = HttpTrigger(name="req1", route="test")
3726
binding = BlobInput(name="$return", path="testpath",

0 commit comments

Comments
 (0)