apexdevkit 1.25.1__tar.gz → 1.25.2__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.25.1 → apexdevkit-1.25.2}/PKG-INFO +1 -1
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/fastapi/router.py +16 -2
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/fastapi/schema.py +6 -7
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/pyproject.toml +1 -1
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/LICENSE +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/README.md +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/date.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/environment.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/error.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/fastapi/dependable.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/fastapi/name.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/fluent.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/http/httpx/__init__.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/http/httpx/client.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/http/httpx/hooks.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/id.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/key_fn.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/query/__init__.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/query/generator.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/query/query.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/repository/base.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/repository/connector.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/repository/decorator.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/repository/in_memory.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/repository/interface.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/repository/mssql.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/repository/repository.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/repository/sql.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/repository/sqlite.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/server.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/synchronization.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/testing/rest.py +0 -0
- {apexdevkit-1.25.1 → apexdevkit-1.25.2}/apexdevkit/value.py +0 -0
|
@@ -60,10 +60,23 @@ class RestfulRouter:
|
|
|
60
60
|
return "/{" + self.id_alias + "}"
|
|
61
61
|
|
|
62
62
|
def with_fields(self, value: SchemaFields) -> Self:
|
|
63
|
-
self._schema = RestfulSchema(
|
|
63
|
+
self._schema = RestfulSchema(
|
|
64
|
+
name=self.name,
|
|
65
|
+
fields=value,
|
|
66
|
+
generator=self._schema_generator,
|
|
67
|
+
)
|
|
64
68
|
|
|
65
69
|
return self
|
|
66
70
|
|
|
71
|
+
@property
|
|
72
|
+
def _schema_generator(self) -> Schema:
|
|
73
|
+
if self.parent:
|
|
74
|
+
return Schema(
|
|
75
|
+
self.parent.singular.capitalize() + self.name.singular.capitalize()
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return Schema(self.name.singular.capitalize())
|
|
79
|
+
|
|
67
80
|
def with_tag(self, value: list[str | Enum]) -> Self:
|
|
68
81
|
self.router.tags = value
|
|
69
82
|
|
|
@@ -157,7 +170,8 @@ class RestfulRouter:
|
|
|
157
170
|
self.resource.read_many(
|
|
158
171
|
Service=self._resolve(dependency),
|
|
159
172
|
QueryParams=Annotated[
|
|
160
|
-
Schema(self.name).optional_schema_for("ReadMany", query),
|
|
173
|
+
Schema(self.name.singular).optional_schema_for("ReadMany", query),
|
|
174
|
+
Query(),
|
|
161
175
|
],
|
|
162
176
|
),
|
|
163
177
|
methods=["GET"],
|
|
@@ -45,6 +45,7 @@ class SchemaFields(ABC):
|
|
|
45
45
|
class RestfulSchema:
|
|
46
46
|
name: RestfulName
|
|
47
47
|
fields: SchemaFields
|
|
48
|
+
generator: "Schema"
|
|
48
49
|
|
|
49
50
|
def __post_init__(self) -> None:
|
|
50
51
|
schema = self._schema_for("", self.fields.readable())
|
|
@@ -66,7 +67,7 @@ class RestfulSchema:
|
|
|
66
67
|
|
|
67
68
|
def _schema_for(self, action: str, fields: dict[str, Any]) -> type[BaseModel]:
|
|
68
69
|
if action not in self.schemas:
|
|
69
|
-
self.schemas[action] =
|
|
70
|
+
self.schemas[action] = self.generator.schema_for(action, fields)
|
|
70
71
|
|
|
71
72
|
return self.schemas[action]
|
|
72
73
|
|
|
@@ -177,16 +178,16 @@ class RestfulSchema:
|
|
|
177
178
|
|
|
178
179
|
@dataclass(frozen=True)
|
|
179
180
|
class Schema:
|
|
180
|
-
|
|
181
|
+
resource: str
|
|
181
182
|
|
|
182
183
|
def schema_for(self, action: str, fields: dict[str, Any]) -> type[BaseModel]:
|
|
183
|
-
return self._nested_schema_for(self.
|
|
184
|
+
return self._nested_schema_for(self.resource + action, fields)
|
|
184
185
|
|
|
185
186
|
def optional_schema_for(
|
|
186
187
|
self, action: str, fields: dict[str, Any]
|
|
187
188
|
) -> type[BaseModel]:
|
|
188
189
|
return create_model(
|
|
189
|
-
self.
|
|
190
|
+
self.resource + action,
|
|
190
191
|
**{
|
|
191
192
|
field_name: (field_type | None, None)
|
|
192
193
|
for field_name, field_type in fields.items()
|
|
@@ -199,9 +200,7 @@ class Schema:
|
|
|
199
200
|
for field_name, field_type in fields.items():
|
|
200
201
|
if isinstance(field_type, dict):
|
|
201
202
|
model_fields[field_name] = (
|
|
202
|
-
self._nested_schema_for(
|
|
203
|
-
name.capitalize() + field_name.capitalize(), field_type
|
|
204
|
-
),
|
|
203
|
+
self._nested_schema_for(name + field_name.capitalize(), field_type),
|
|
205
204
|
...,
|
|
206
205
|
)
|
|
207
206
|
else:
|
|
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
|