Skip to content

Commit d68c330

Browse files
authored
Merge pull request #136 from dapper91/dev
- fix: exceptions not frozen dataclasses anymore (cause errors in pytest). - fix: '.' replaced by '_' in openapi model prefix.
2 parents 12aeb3d + c4f83c9 commit d68c330

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ Changelog
22
=========
33

44

5+
2.1.2 (2025-11-15)
6+
-------------------
7+
8+
- fix: exceptions not frozen dataclasses anymore (cause errors in pytest).
9+
- fix: '.' replaced by '_' in openapi model prefix.
10+
11+
512
2.1.1 (2025-11-08)
613
-------------------
714

pjrpc/client/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
]
2121

2222

23-
@dc.dataclass(frozen=True)
23+
@dc.dataclass
2424
class JsonRpcError(exceptions.JsonRpcError):
2525
"""
2626
Client JSON-RPC error.

pjrpc/common/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DeserializationError(ProtocolError, ValueError):
3535
"""
3636

3737

38-
@dc.dataclass(frozen=True)
38+
@dc.dataclass
3939
class JsonRpcError(BaseError):
4040
"""
4141
`JSON-RPC <https://www.jsonrpc.org>`_ protocol error.

pjrpc/server/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
]
2121

2222

23-
@dc.dataclass(frozen=True)
23+
@dc.dataclass
2424
class JsonRpcError(exceptions.JsonRpcError):
2525
"""
2626
Server JSON-RPC error.

pjrpc/server/specs/openapi/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def _extract_errors_schema(
352352
) -> tuple[dict[int, dict[str, Any]], dict[str, JsonSchema]]:
353353
status_error_schema_map: dict[int, dict[str, Any]] = {}
354354
component_schemas: dict[str, JsonSchema] = {}
355-
component_name_prefix = method_metadata.component_name_prefix or f"{method.__module__}_"
355+
component_name_prefix = method_metadata.component_name_prefix or f"{method.__module__.replace('.', '_')}_"
356356

357357
for status, errors in status_errors_map.items():
358358
if result := self._extractor.extract_error_response_schema(
@@ -378,7 +378,7 @@ def _extract_request_schema(
378378
method_metadata: MethodMetadata,
379379
) -> tuple[MaybeSet[dict[str, Any]], dict[str, JsonSchema]]:
380380
component_schemas: dict[str, JsonSchema] = {}
381-
component_name_prefix = method_metadata.component_name_prefix or f"{method.__module__}_"
381+
component_name_prefix = method_metadata.component_name_prefix or f"{method.__module__.replace('.', '_')}_"
382382

383383
request_schema: MaybeSet[dict[str, Any]] = UNSET
384384
if params_schema := method_metadata.params_schema:
@@ -406,7 +406,7 @@ def _extract_response_schema(
406406
errors: list[type[exceptions.TypedError]],
407407
) -> tuple[MaybeSet[dict[str, Any]], dict[str, JsonSchema]]:
408408
component_schemas: dict[str, JsonSchema] = {}
409-
component_name_prefix = method_metadata.component_name_prefix or f"{method.__module__}_"
409+
component_name_prefix = method_metadata.component_name_prefix or f"{method.__module__.replace('.', '_')}_"
410410

411411
response_schema: MaybeSet[dict[str, Any]] = UNSET
412412
if result_schema := method_metadata.result_schema:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pjrpc"
3-
version = "2.1.1"
3+
version = "2.1.2"
44
description = "Extensible JSON-RPC library"
55
authors = ["Dmitry Pershin <dapper1291@gmail.com>"]
66
license = "Unlicense"

0 commit comments

Comments
 (0)