Skip to content

fix: validate_function_params error message #1700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions azure_functions_worker/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ def validate_function_params(params: dict, bound_params: dict,
if set(params) - set(bound_params):
raise FunctionLoadError(
func_name,
'the following parameters are declared in Python but '
f'not in function.json: {set(params) - set(bound_params)!r}')
'the following parameters are declared in function parameter but '
f'not in trigger annotation: {set(params) - set(bound_params)}')

if set(bound_params) - set(params):
raise FunctionLoadError(
func_name,
f'the following parameters are declared in function.json but '
f'not in Python: {set(bound_params) - set(params)!r}')
f'the following parameters are declared in trigger annotation but '
f'not in faction parameter: {set(bound_params) - set(params)}')

input_types: typing.Dict[str, ParamTypeInfo] = {}
output_types: typing.Dict[str, ParamTypeInfo] = {}
Expand Down
4 changes: 2 additions & 2 deletions tests/unittests/test_broken_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def test_load_broken__missing_py_param(self):
self.assertRegex(
r.response.result.exception.message,
r".*cannot load the missing_py_param function"
r".*parameters are declared in function.json"
r".*parameters are declared in trigger annotation"
r".*'req'.*")

async def test_load_broken__missing_json_param(self):
Expand All @@ -37,7 +37,7 @@ async def test_load_broken__missing_json_param(self):
self.assertRegex(
r.response.result.exception.message,
r".*cannot load the missing_json_param function"
r".*parameters are declared in Python"
r".*parameters are declared in function parameter"
r".*'spam'.*")

async def test_load_broken__wrong_param_dir(self):
Expand Down