From ee3d9f21ba2a794cc0eb749cf6e9e02533c48de5 Mon Sep 17 00:00:00 2001 From: KTrain5369 Date: Thu, 18 Dec 2025 10:09:59 +1000 Subject: [PATCH 1/4] Replace ValueError with warnings.warn for discouraed schema keys --- src/neuro_api/command.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/neuro_api/command.py b/src/neuro_api/command.py index bae2a18..227792a 100644 --- a/src/neuro_api/command.py +++ b/src/neuro_api/command.py @@ -38,6 +38,7 @@ cast, get_type_hints, ) +from warnings import warn import orjson from typing_extensions import NotRequired, is_typeddict @@ -880,6 +881,4 @@ 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.") From 77d92ecc77899f6b549ec2805d2f89c0617ad648 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 18 Dec 2025 00:18:52 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/neuro_api/command.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/neuro_api/command.py b/src/neuro_api/command.py index 227792a..0e8638d 100644 --- a/src/neuro_api/command.py +++ b/src/neuro_api/command.py @@ -881,4 +881,6 @@ 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: - warn(f"Discouraged keys found in schema: {bad_schema_keys} ({action.name = })\nPlease make sure you accurately check for them in your integration.") + warn( + f"Discouraged keys found in schema: {bad_schema_keys} ({action.name = })\nPlease make sure you accurately check for them in your integration.", + ) From 1799fe98e3d13950b1906796c5bdce60772ffcfe Mon Sep 17 00:00:00 2001 From: KTrain5369 Date: Thu, 18 Dec 2025 10:45:59 +1000 Subject: [PATCH 3/4] update tests --- tests/test_command.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_command.py b/tests/test_command.py index 2c26bc3..8f275f0 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -252,9 +252,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) From 0c550c04621be96efcae8ac5ecb7ee28f433ced6 Mon Sep 17 00:00:00 2001 From: KTrain5369 Date: Thu, 18 Dec 2025 10:49:16 +1000 Subject: [PATCH 4/4] I thought this was already added lol --- src/neuro_api/command.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/neuro_api/command.py b/src/neuro_api/command.py index 0e8638d..e09620c 100644 --- a/src/neuro_api/command.py +++ b/src/neuro_api/command.py @@ -883,4 +883,5 @@ def check_action(action: Action) -> None: if bad_schema_keys: 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, )