logging-objects-with-schema 1.0.2__tar.gz → 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {logging_objects_with_schema-1.0.2 → logging_objects_with_schema-1.0.3}/PKG-INFO +1 -1
- {logging_objects_with_schema-1.0.2 → logging_objects_with_schema-1.0.3}/pyproject.toml +1 -1
- {logging_objects_with_schema-1.0.2 → logging_objects_with_schema-1.0.3}/pyproject.toml.orig +1 -1
- {logging_objects_with_schema-1.0.2 → logging_objects_with_schema-1.0.3}/src/logging_objects_with_schema/schema_applier.py +15 -6
- {logging_objects_with_schema-1.0.2 → logging_objects_with_schema-1.0.3}/LICENSE +0 -0
- {logging_objects_with_schema-1.0.2 → logging_objects_with_schema-1.0.3}/README.md +0 -0
- {logging_objects_with_schema-1.0.2 → logging_objects_with_schema-1.0.3}/src/logging_objects_with_schema/__init__.py +0 -0
- {logging_objects_with_schema-1.0.2 → logging_objects_with_schema-1.0.3}/src/logging_objects_with_schema/errors.py +0 -0
- {logging_objects_with_schema-1.0.2 → logging_objects_with_schema-1.0.3}/src/logging_objects_with_schema/py.typed +0 -0
- {logging_objects_with_schema-1.0.2 → logging_objects_with_schema-1.0.3}/src/logging_objects_with_schema/schema_loader.py +0 -0
- {logging_objects_with_schema-1.0.2 → logging_objects_with_schema-1.0.3}/src/logging_objects_with_schema/schema_logger.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: logging-objects-with-schema
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: Schema-aware Python logging with strict extra validation and schema-driven field projection.
|
|
5
5
|
Keywords: logging,schema,validation,structured-logging,structured-logs
|
|
6
6
|
Author: Dmitrii Safronov
|
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "logging-objects-with-schema"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.3"
|
|
8
8
|
description = "Schema-aware Python logging with strict extra validation and schema-driven field projection."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "logging-objects-with-schema"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.3"
|
|
8
8
|
description = "Schema-aware Python logging with strict extra validation and schema-driven field projection."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -11,11 +11,20 @@ from .errors import _DataProblem
|
|
|
11
11
|
from .schema_loader import _CompiledSchema, _SchemaLeaf
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
def _safe_repr(value: Any) -> str:
|
|
15
|
+
"""Represent diagnostic data without propagating user __repr__ failures."""
|
|
16
|
+
try:
|
|
17
|
+
return repr(value)
|
|
18
|
+
except Exception:
|
|
19
|
+
# Do not format the value or exception again: either may have a broken repr.
|
|
20
|
+
return "<unrepresentable value>"
|
|
21
|
+
|
|
22
|
+
|
|
14
23
|
def _create_validation_error_dict(field: str, error: str, value: Any) -> dict[str, Any]:
|
|
15
24
|
"""Create a dict for a single validation error.
|
|
16
25
|
|
|
17
|
-
All values
|
|
18
|
-
|
|
26
|
+
All values use safe repr() formatting. If user code raises during repr(),
|
|
27
|
+
a constant placeholder preserves the validation diagnostic.
|
|
19
28
|
|
|
20
29
|
Args:
|
|
21
30
|
field: Field name that caused the validation error.
|
|
@@ -23,12 +32,12 @@ def _create_validation_error_dict(field: str, error: str, value: Any) -> dict[st
|
|
|
23
32
|
value: Invalid value that caused the error.
|
|
24
33
|
|
|
25
34
|
Returns:
|
|
26
|
-
Dict with field, error, and value
|
|
35
|
+
Dict with field, error, and value as safely represented strings.
|
|
27
36
|
"""
|
|
28
37
|
return {
|
|
29
|
-
"field":
|
|
30
|
-
"error":
|
|
31
|
-
"value":
|
|
38
|
+
"field": _safe_repr(field),
|
|
39
|
+
"error": _safe_repr(error),
|
|
40
|
+
"value": _safe_repr(value),
|
|
32
41
|
}
|
|
33
42
|
|
|
34
43
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|