u-toolkit 0.1.8__py3-none-any.whl → 0.1.10__py3-none-any.whl
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.
- u_toolkit/fastapi/exception.py +8 -1
- u_toolkit/fastapi/responses.py +2 -1
- {u_toolkit-0.1.8.dist-info → u_toolkit-0.1.10.dist-info}/METADATA +1 -1
- {u_toolkit-0.1.8.dist-info → u_toolkit-0.1.10.dist-info}/RECORD +6 -6
- {u_toolkit-0.1.8.dist-info → u_toolkit-0.1.10.dist-info}/WHEEL +0 -0
- {u_toolkit-0.1.8.dist-info → u_toolkit-0.1.10.dist-info}/entry_points.txt +0 -0
u_toolkit/fastapi/exception.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import inspect
|
2
2
|
from collections.abc import Callable, Sequence
|
3
|
-
from typing import Any, Generic, Literal, TypeVar, cast
|
3
|
+
from typing import Any, Generic, Literal, Protocol, TypeVar, cast
|
4
4
|
|
5
5
|
from fastapi import Response, status
|
6
6
|
from fastapi.responses import JSONResponse, ORJSONResponse
|
@@ -36,6 +36,13 @@ class EndpointError(WrapperError[BaseModelT], Generic[BaseModelT]):
|
|
36
36
|
return cls(error=model)
|
37
37
|
|
38
38
|
|
39
|
+
class HTTPErrorInterface(Protocol):
|
40
|
+
status: int
|
41
|
+
|
42
|
+
@classmethod
|
43
|
+
def response_class(cls) -> type[BaseModel]: ...
|
44
|
+
|
45
|
+
|
39
46
|
class NamedHTTPError(Exception, Generic[WrapperErrorT, BaseModelT]):
|
40
47
|
status: int = status.HTTP_400_BAD_REQUEST
|
41
48
|
code: str | None = None
|
u_toolkit/fastapi/responses.py
CHANGED
@@ -13,7 +13,7 @@ def _merge_responses(
|
|
13
13
|
model_class = response.get("model")
|
14
14
|
if status in source:
|
15
15
|
source_model_class = source[status].get("model")
|
16
|
-
if source_model_class
|
16
|
+
if source_model_class and model_class:
|
17
17
|
target[status]["model"] = model_class | source_model_class
|
18
18
|
|
19
19
|
for status, response in source.items():
|
@@ -59,6 +59,7 @@ def build_responses(*responses: Response):
|
|
59
59
|
status = arg
|
60
60
|
else:
|
61
61
|
errors.append(arg)
|
62
|
+
continue
|
62
63
|
|
63
64
|
result[status] = {"model": response}
|
64
65
|
|
@@ -13,11 +13,11 @@ u_toolkit/signature.py,sha256=-Q6n28PYBYYdd2OXBKESeVkL2rYpV6EaY3IVwQmzezQ,2161
|
|
13
13
|
u_toolkit/fastapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
14
|
u_toolkit/fastapi/cbv.py,sha256=gtNhV8mQAEQNf9uIwyjlrA-ZbVwLeJenJ-f2G2Co1SE,10808
|
15
15
|
u_toolkit/fastapi/config.py,sha256=kGpokR9XXr1KxMA1GVKYkCdKwqIQAIwOJ-v6sGbqzAQ,267
|
16
|
-
u_toolkit/fastapi/exception.py,sha256=
|
16
|
+
u_toolkit/fastapi/exception.py,sha256=P9apEEQvbBMmffiHX57768gmemMeAy69-nb-1JQZAZE,4624
|
17
17
|
u_toolkit/fastapi/helpers.py,sha256=BCMMLxa1c6BMA_rKq-hCi0iyEjrR3Z5rPMeTvgaVJB0,447
|
18
18
|
u_toolkit/fastapi/lifespan.py,sha256=W1TwWymW7xtmntx59QBC4LQ6xQr3L7yuMMGj4U8hhTQ,1813
|
19
19
|
u_toolkit/fastapi/pagination.py,sha256=yOgEDUT04m_mZ0cPliuDbUHLFnmxGAmr5PyZlwfjT_s,1940
|
20
|
-
u_toolkit/fastapi/responses.py,sha256=
|
20
|
+
u_toolkit/fastapi/responses.py,sha256=alXUuFK9g1xwkw7V_gpeJFyWuGTHSh-fuuWTuaG8of8,1765
|
21
21
|
u_toolkit/pydantic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
u_toolkit/pydantic/fields.py,sha256=9I8Jwek_oNn_niI98ZWaSPEUYIl5mw24YgbnpcEtgZk,839
|
23
23
|
u_toolkit/pydantic/models.py,sha256=Dqp3HnPlUU7ZpfBbYbERfcrLUb2CBJKHySRvM1Rv3HE,1101
|
@@ -30,7 +30,7 @@ u_toolkit/sqlalchemy/type_vars.py,sha256=m2VeV41CBIK_1QX3w2kgz-n556sILAGZ-Kaz3TD
|
|
30
30
|
u_toolkit/sqlalchemy/orm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
31
|
u_toolkit/sqlalchemy/orm/fields.py,sha256=3zoYil23I6YLtc_59aHDt9w5l1NBTkePT9AfXI3DMiY,593
|
32
32
|
u_toolkit/sqlalchemy/orm/models.py,sha256=V8vf4ps3phAmwxyaFYK7pw8Igz7h097o4QBjKB0gwC8,705
|
33
|
-
u_toolkit-0.1.
|
34
|
-
u_toolkit-0.1.
|
35
|
-
u_toolkit-0.1.
|
36
|
-
u_toolkit-0.1.
|
33
|
+
u_toolkit-0.1.10.dist-info/METADATA,sha256=NWFuzJQXuyvpF3ef2r8mZsW8HBPi5CkPv2Y09UWv0bc,366
|
34
|
+
u_toolkit-0.1.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
35
|
+
u_toolkit-0.1.10.dist-info/entry_points.txt,sha256=hTfAYCd5vvRiqgnJk2eBsoRIiIVB9pK8WZm3Q3jjKFU,45
|
36
|
+
u_toolkit-0.1.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|