apexdevkit 1.6.3__tar.gz → 1.6.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.
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/PKG-INFO +1 -1
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/error.py +6 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/fastapi/builder.py +6 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/fastapi/dependable.py +6 -1
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/pyproject.toml +1 -1
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/LICENSE +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/README.md +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/fastapi/router.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/http/httpx.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/repository/base.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/repository/connector.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/repository/in_memory.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/repository/interface.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.6.3 → apexdevkit-1.6.4}/apexdevkit/testing/rest.py +0 -0
|
@@ -3,7 +3,9 @@ from dataclasses import dataclass, field
|
|
|
3
3
|
from typing import Any, Self
|
|
4
4
|
|
|
5
5
|
from fastapi import APIRouter, FastAPI
|
|
6
|
+
from starlette.responses import JSONResponse
|
|
6
7
|
|
|
8
|
+
from apexdevkit.error import ApiError
|
|
7
9
|
from apexdevkit.fastapi.service import RestfulService
|
|
8
10
|
|
|
9
11
|
|
|
@@ -12,6 +14,10 @@ class FastApiBuilder:
|
|
|
12
14
|
app: FastAPI = field(default_factory=FastAPI)
|
|
13
15
|
|
|
14
16
|
def build(self) -> FastAPI:
|
|
17
|
+
self.app.add_exception_handler(
|
|
18
|
+
ApiError,
|
|
19
|
+
lambda request, exc: JSONResponse(content=exc.data, status_code=exc.code),
|
|
20
|
+
)
|
|
15
21
|
return self.app
|
|
16
22
|
|
|
17
23
|
def with_title(self, value: str) -> Self:
|
|
@@ -4,7 +4,9 @@ from typing import Annotated, Any, Callable, Protocol, Self
|
|
|
4
4
|
from fastapi import Depends, Path
|
|
5
5
|
from fastapi.requests import Request
|
|
6
6
|
|
|
7
|
+
from apexdevkit.error import ApiError, DoesNotExistError
|
|
7
8
|
from apexdevkit.fastapi import RestfulServiceBuilder
|
|
9
|
+
from apexdevkit.fastapi.response import RestfulResponse
|
|
8
10
|
from apexdevkit.fastapi.service import RestfulService
|
|
9
11
|
from apexdevkit.testing import RestfulName
|
|
10
12
|
|
|
@@ -44,7 +46,10 @@ class ParentDependency:
|
|
|
44
46
|
ParentId = Annotated[str, Path(alias=self.parent.singular + "_id")]
|
|
45
47
|
|
|
46
48
|
def _(builder: Builder, parent_id: ParentId) -> RestfulServiceBuilder:
|
|
47
|
-
|
|
49
|
+
try:
|
|
50
|
+
return builder.with_parent(parent_id)
|
|
51
|
+
except DoesNotExistError as e:
|
|
52
|
+
raise ApiError(404, RestfulResponse(self.parent).not_found(e))
|
|
48
53
|
|
|
49
54
|
return Annotated[RestfulServiceBuilder, Depends(_)]
|
|
50
55
|
|
|
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
|