Skip to content

Commit

Permalink
feat: return validation error response with full location of fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Maximenyuk committed Mar 27, 2024
1 parent ccd4886 commit 0169fad
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pybotx_smartapp_rpc/models/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def build_invalid_rpc_args_error_response(
RPCError(
reason=error["msg"],
id=error["type"].split(".")[0].upper(),
meta={"field": error["loc"][0]},
meta={"location": error["loc"]},
)
for error in exc.errors()
],
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pybotx-smartapp-rpc"
version = "0.7.3"
version = "0.8.0"
description = "eXpress SmartApp JSON-RPC library"
authors = ["Arseniy Zhiltsov <arseniy.zhiltsov@ccsteam.ru>"]
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_rpc_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ async def sum_handler(smartapp: SmartApp, args: SumArgs) -> RPCResultResponse[in
{
"reason": "value is not a valid integer",
"id": "TYPE_ERROR",
"meta": {"field": "first"},
"meta": {"location": ("first",)},
},
{
"reason": "field required",
"id": "VALUE_ERROR",
"meta": {"field": "second"},
"meta": {"location": ("second",)},
},
],
"type": "smartapp_rpc",
Expand Down

0 comments on commit 0169fad

Please sign in to comment.