diff --git a/src/neuro_api/command.py b/src/neuro_api/command.py index 8a39874..ee917eb 100644 --- a/src/neuro_api/command.py +++ b/src/neuro_api/command.py @@ -39,6 +39,7 @@ cast, get_type_hints, ) +from warnings import warn import orjson from typing_extensions import NotRequired, is_typeddict @@ -892,6 +893,7 @@ def check_action(action: Action) -> None: if action.schema is not None: bad_schema_keys = check_invalid_keys_recursive(action.schema) if bad_schema_keys: - raise ValueError( - f"Following invalid keys found in schema: {bad_schema_keys} ({action.name = })", + warn( + f"Discouraged keys found in schema: {bad_schema_keys} ({action.name = })\nPlease make sure you accurately check for them in your integration.", + stacklevel=2, ) diff --git a/tests/test_command.py b/tests/test_command.py index dbd4586..cf8298d 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -334,9 +334,9 @@ def test_check_action_invalid_schema_key() -> None: description="A valid action", schema={"$schema": {}}, # type: ignore[arg-type] ) - with pytest.raises( - ValueError, - match="Following invalid keys found in schema", + with pytest.warns( + UserWarning, + match="Discouraged keys found in schema", ): check_action(action)