maleo-schemas 0.0.3__py3-none-any.whl → 0.0.5__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.
maleo/schemas/response.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from pydantic import BaseModel, Field
2
- from typing import Dict, Generic, List, Literal, Optional, TypeVar, Union
2
+ from typing import Dict, Generic, List, Literal, Optional, Type, TypeVar, Union
3
3
  from maleo.dtos.data import DataPair, GenericDataT, DataT
4
4
  from maleo.dtos.descriptor import (
5
5
  ErrorDescriptor,
@@ -54,7 +54,6 @@ from maleo.enums.error import Code as ErrorCode
54
54
  from maleo.enums.success import Code as SuccessCode
55
55
  from maleo.mixins.general import SuccessT, Success, CodeT, Descriptor
56
56
  from maleo.types.base.any import OptionalAny
57
- from maleo.types.base.dict import StringToAnyDict
58
57
 
59
58
 
60
59
  class Response(
@@ -181,7 +180,34 @@ class ServiceUnavailableResponse(
181
180
  pass
182
181
 
183
182
 
184
- OTHER_RESPONSES: Dict[Union[int, str], StringToAnyDict] = {
183
+ ERROR_RESPONSE_MAP: Dict[ErrorCode, Type[ErrorResponse]] = {
184
+ ErrorCode.BAD_REQUEST: BadRequestResponse,
185
+ ErrorCode.UNAUTHORIZED: UnauthorizedResponse,
186
+ ErrorCode.FORBIDDEN: ForbiddenResponse,
187
+ ErrorCode.NOT_FOUND: NotFoundResponse,
188
+ ErrorCode.METHOD_NOT_ALLOWED: MethodNotAllowedResponse,
189
+ ErrorCode.CONFLICT: ConflictResponse,
190
+ ErrorCode.UNPROCESSABLE_ENTITY: UnprocessableEntityResponse,
191
+ ErrorCode.TOO_MANY_REQUESTS: TooManyRequestsResponse,
192
+ ErrorCode.INTERNAL_SERVER_ERROR: InternalServerErrorResponse,
193
+ ErrorCode.DATABASE_ERROR: DatabaseErrorResponse,
194
+ ErrorCode.NOT_IMPLEMENTED: NotImplementedResponse,
195
+ ErrorCode.BAD_GATEWAY: BadGatewayResponse,
196
+ ErrorCode.SERVICE_UNAVAILABLE: ServiceUnavailableResponse,
197
+ }
198
+
199
+
200
+ OTHER_RESPONSES: Dict[
201
+ Union[int, str],
202
+ Dict[
203
+ str,
204
+ Union[
205
+ str,
206
+ Type[ErrorResponse],
207
+ List[Type[ErrorResponse]],
208
+ ],
209
+ ],
210
+ ] = {
185
211
  400: {
186
212
  "description": "Bad Request Response",
187
213
  "model": BadRequestResponse,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo-schemas
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: Schemas package for MaleoSuite
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: Proprietary
@@ -37,11 +37,11 @@ Requires-Dist: httpx>=0.28.1
37
37
  Requires-Dist: identify>=2.6.13
38
38
  Requires-Dist: idna>=3.10
39
39
  Requires-Dist: importlib_metadata>=8.7.0
40
- Requires-Dist: maleo-constants>=0.0.4
41
- Requires-Dist: maleo-dtos>=0.0.2
40
+ Requires-Dist: maleo-constants>=0.0.5
41
+ Requires-Dist: maleo-dtos>=0.0.3
42
42
  Requires-Dist: maleo-enums>=0.0.6
43
43
  Requires-Dist: maleo-logging>=0.0.4
44
- Requires-Dist: maleo-mixins>=0.0.9
44
+ Requires-Dist: maleo-mixins>=0.0.10
45
45
  Requires-Dist: maleo-types-base>=0.0.2
46
46
  Requires-Dist: maleo-types-controllers>=0.0.1
47
47
  Requires-Dist: maleo-types-enums>=0.0.4
@@ -1,14 +1,14 @@
1
1
  maleo/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  maleo/schemas/request.py,sha256=1tFUZyr6kofpNHVM5h1Qx9TCHt4EqS_hfIZlADuaUI0,733
3
- maleo/schemas/response.py,sha256=BxB8e9sNWzRUnlMiuF5yNAqcX5mzGSkAh0y3_7dlA4s,9067
3
+ maleo/schemas/response.py,sha256=WnyeRxaFoGK-wj_SAyY-xMC1Hm7NjIb3J4JC-u8w2-I,9916
4
4
  maleo/schemas/operation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  maleo/schemas/operation/action.py,sha256=LjR7KQBpB_oA64iFT4WGvnA0IrwXW4v0sI35o3vlY5Y,293
6
6
  maleo/schemas/operation/base.py,sha256=yW9UUEevwEmKc-DktYmrXgBzWVksSMCOzMWeAzEDtww,7262
7
7
  maleo/schemas/operation/request.py,sha256=t_bTGcihjmg9a2BBP2f5q6--ed6WA4jjI1WRIxSp_Ds,3225
8
8
  maleo/schemas/operation/resource.py,sha256=wf1bDa97O0W9-QXjKXrkqFqeHTQuWV_RWc2vMLhRDvI,27771
9
9
  maleo/schemas/operation/system.py,sha256=nZgRwp2cc6DLqpl8-notwJjZTkedfBa_72sY_HbcBk4,1865
10
- maleo_schemas-0.0.3.dist-info/licenses/LICENSE,sha256=aftGsecnk7TWVX-7KW94FqK4Syy6YSZ8PZEF7EcIp3M,2621
11
- maleo_schemas-0.0.3.dist-info/METADATA,sha256=_3nYGWpFpliWp46ot-eyy1O430CE6VsaXFLv47PQFnQ,3357
12
- maleo_schemas-0.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
- maleo_schemas-0.0.3.dist-info/top_level.txt,sha256=3Tpd1siVsfYoeI9FEOJNYnffx_shzZ3wsPpTvz5bljc,6
14
- maleo_schemas-0.0.3.dist-info/RECORD,,
10
+ maleo_schemas-0.0.5.dist-info/licenses/LICENSE,sha256=aftGsecnk7TWVX-7KW94FqK4Syy6YSZ8PZEF7EcIp3M,2621
11
+ maleo_schemas-0.0.5.dist-info/METADATA,sha256=c4zu1rigZRsmRwrk68iewtcipsQgk8XMMGgfd9Y41Uc,3358
12
+ maleo_schemas-0.0.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
+ maleo_schemas-0.0.5.dist-info/top_level.txt,sha256=3Tpd1siVsfYoeI9FEOJNYnffx_shzZ3wsPpTvz5bljc,6
14
+ maleo_schemas-0.0.5.dist-info/RECORD,,