fastlib-py 0.3.2__tar.gz → 0.3.4__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.
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/PKG-INFO +1 -1
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/__init__.py +1 -3
- {fastlib_py-0.3.2/fastlib/logging → fastlib_py-0.3.4/fastlib/_logging}/handlers.py +1 -1
- fastlib_py-0.3.4/fastlib/logging.py +7 -0
- fastlib_py-0.3.4/fastlib/service/impl/__init__.py +0 -0
- fastlib_py-0.3.4/fastlib/utils/validate_util.py +51 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib_py.egg-info/PKG-INFO +1 -1
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib_py.egg-info/SOURCES.txt +5 -3
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/pyproject.toml +1 -1
- fastlib_py-0.3.2/fastlib/logging/__init__.py +0 -12
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/LICENSE +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/README.md +0 -0
- {fastlib_py-0.3.2/fastlib/mapper → fastlib_py-0.3.4/fastlib/_logging}/__init__.py +0 -0
- {fastlib_py-0.3.2/fastlib/logging → fastlib_py-0.3.4/fastlib/_logging}/config.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/cache/__init__.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/cache/_disk_cache.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/cache/_redis_cache.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/cache/base.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/cache/manager.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/__init__.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/_database_config.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/_security_config.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/_server_config.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/base.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/loader.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/manager.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/registry.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/utils.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/constants.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/contextvars.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/db_engine.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/enums.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/exception/__init__.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/exception/base.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/exception/exception_handler.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/exception/exception_manager.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/i18n/__init__.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/i18n/manager.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/i18n/messages.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/i18n/types.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/i18n/utils.py +0 -0
- {fastlib_py-0.3.2/fastlib/mapper/impl → fastlib_py-0.3.4/fastlib/mapper}/__init__.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/mapper/base_mapper.py +0 -0
- {fastlib_py-0.3.2/fastlib/service → fastlib_py-0.3.4/fastlib/mapper/impl}/__init__.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/mapper/impl/base_mapper_impl.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/middleware/__init__.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/middleware/db_session.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/middleware/i18n.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/middleware/jwt.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/migrate.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/openapi.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/py.typed +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/request.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/response.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/router.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/schema.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/security/__init__.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/security/security.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/security/utils.py +0 -0
- {fastlib_py-0.3.2/fastlib/service/impl → fastlib_py-0.3.4/fastlib/service}/__init__.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/service/base_service.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/service/impl/base_service_impl.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/stream/__init__.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/stream/enums.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/stream/event.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/stream/handler.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/stream/schema.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/stream/sse.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/__init__.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/excel_util.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/file_util.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/http_util.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/ip_util.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/snowflake_util.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/str_util.py +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib_py.egg-info/dependency_links.txt +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib_py.egg-info/requires.txt +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib_py.egg-info/top_level.txt +0 -0
- {fastlib_py-0.3.2 → fastlib_py-0.3.4}/setup.cfg +0 -0
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
|
2
2
|
"""Fastlib Application Libraries Package."""
|
|
3
3
|
|
|
4
|
+
from ._logging.config import LogConfig as LogConfig
|
|
4
5
|
from .config import ConfigManager as ConfigManager
|
|
5
|
-
from .logging import LogConfig as LogConfig
|
|
6
|
-
from .logging import Logger as Logger
|
|
7
6
|
from .openapi import register_offline_openapi as register_offline_openapi
|
|
8
7
|
|
|
9
8
|
__all__ = [
|
|
10
9
|
"ConfigManager",
|
|
11
|
-
"Logger",
|
|
12
10
|
"LogConfig",
|
|
13
11
|
"register_offline_openapi",
|
|
14
12
|
]
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
"""
|
|
3
|
+
Validation service module for Pydantic models.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Optional
|
|
7
|
+
from pydantic import BaseModel, ValidationError
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ValidateService:
|
|
11
|
+
"""A service class providing validation utilities for Pydantic models."""
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def validate(obj: BaseModel) -> Optional[str]:
|
|
15
|
+
"""Validate a Pydantic model instance.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
obj: The Pydantic BaseModel instance to validate.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
Optional[str]: None if validation passes, otherwise a comma-separated string
|
|
22
|
+
of validation error messages.
|
|
23
|
+
"""
|
|
24
|
+
try:
|
|
25
|
+
# Call Pydantic's validation logic (for Pydantic v2.x)
|
|
26
|
+
obj.model_validate() # For v2.x Pydantic
|
|
27
|
+
return None
|
|
28
|
+
except ValidationError as e:
|
|
29
|
+
# Concatenate error messages
|
|
30
|
+
errors = ", ".join(
|
|
31
|
+
[f"{'->'.join(map(str, error['loc']))}: {error['msg']}" for error in e.errors()]
|
|
32
|
+
)
|
|
33
|
+
return errors
|
|
34
|
+
|
|
35
|
+
@staticmethod
|
|
36
|
+
def get_validate_err_msg(e: ValidationError) -> Optional[str]:
|
|
37
|
+
"""Format validation error messages from a ValidationError exception.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
e: The ValidationError exception containing validation errors.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
Optional[str]: A comma-separated string of formatted error messages,
|
|
44
|
+
or None if no errors exist.
|
|
45
|
+
"""
|
|
46
|
+
err_msg = []
|
|
47
|
+
for error in e.errors():
|
|
48
|
+
field = " -> ".join(map(str, error["loc"])) # Field path
|
|
49
|
+
message = error["message"] # Error description
|
|
50
|
+
err_msg.append(f"Error in field '{field}': {message}")
|
|
51
|
+
return ",".join(err_msg)
|
|
@@ -6,6 +6,7 @@ fastlib/constants.py
|
|
|
6
6
|
fastlib/contextvars.py
|
|
7
7
|
fastlib/db_engine.py
|
|
8
8
|
fastlib/enums.py
|
|
9
|
+
fastlib/logging.py
|
|
9
10
|
fastlib/migrate.py
|
|
10
11
|
fastlib/openapi.py
|
|
11
12
|
fastlib/py.typed
|
|
@@ -13,6 +14,9 @@ fastlib/request.py
|
|
|
13
14
|
fastlib/response.py
|
|
14
15
|
fastlib/router.py
|
|
15
16
|
fastlib/schema.py
|
|
17
|
+
fastlib/_logging/__init__.py
|
|
18
|
+
fastlib/_logging/config.py
|
|
19
|
+
fastlib/_logging/handlers.py
|
|
16
20
|
fastlib/cache/__init__.py
|
|
17
21
|
fastlib/cache/_disk_cache.py
|
|
18
22
|
fastlib/cache/_redis_cache.py
|
|
@@ -36,9 +40,6 @@ fastlib/i18n/manager.py
|
|
|
36
40
|
fastlib/i18n/messages.py
|
|
37
41
|
fastlib/i18n/types.py
|
|
38
42
|
fastlib/i18n/utils.py
|
|
39
|
-
fastlib/logging/__init__.py
|
|
40
|
-
fastlib/logging/config.py
|
|
41
|
-
fastlib/logging/handlers.py
|
|
42
43
|
fastlib/mapper/__init__.py
|
|
43
44
|
fastlib/mapper/base_mapper.py
|
|
44
45
|
fastlib/mapper/impl/__init__.py
|
|
@@ -67,6 +68,7 @@ fastlib/utils/http_util.py
|
|
|
67
68
|
fastlib/utils/ip_util.py
|
|
68
69
|
fastlib/utils/snowflake_util.py
|
|
69
70
|
fastlib/utils/str_util.py
|
|
71
|
+
fastlib/utils/validate_util.py
|
|
70
72
|
fastlib_py.egg-info/PKG-INFO
|
|
71
73
|
fastlib_py.egg-info/SOURCES.txt
|
|
72
74
|
fastlib_py.egg-info/dependency_links.txt
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|