Skip to content
Merged

Dev #136

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
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ Changelog
=========


2.1.2 (2025-11-15)
-------------------

- fix: exceptions not frozen dataclasses anymore (cause errors in pytest).
- fix: '.' replaced by '_' in openapi model prefix.


2.1.1 (2025-11-08)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion pjrpc/client/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
]


@dc.dataclass(frozen=True)
@dc.dataclass
class JsonRpcError(exceptions.JsonRpcError):
"""
Client JSON-RPC error.
Expand Down
2 changes: 1 addition & 1 deletion pjrpc/common/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DeserializationError(ProtocolError, ValueError):
"""


@dc.dataclass(frozen=True)
@dc.dataclass
class JsonRpcError(BaseError):
"""
`JSON-RPC <https://www.jsonrpc.org>`_ protocol error.
Expand Down
2 changes: 1 addition & 1 deletion pjrpc/server/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
]


@dc.dataclass(frozen=True)
@dc.dataclass
class JsonRpcError(exceptions.JsonRpcError):
"""
Server JSON-RPC error.
Expand Down
6 changes: 3 additions & 3 deletions pjrpc/server/specs/openapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def _extract_errors_schema(
) -> tuple[dict[int, dict[str, Any]], dict[str, JsonSchema]]:
status_error_schema_map: dict[int, dict[str, Any]] = {}
component_schemas: dict[str, JsonSchema] = {}
component_name_prefix = method_metadata.component_name_prefix or f"{method.__module__}_"
component_name_prefix = method_metadata.component_name_prefix or f"{method.__module__.replace('.', '_')}_"

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

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

response_schema: MaybeSet[dict[str, Any]] = UNSET
if result_schema := method_metadata.result_schema:
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 = "pjrpc"
version = "2.1.1"
version = "2.1.2"
description = "Extensible JSON-RPC library"
authors = ["Dmitry Pershin <[email protected]>"]
license = "Unlicense"
Expand Down