UPDATE
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Generic, TypeAlias, TypeVar
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
JsonValue: TypeAlias = Any
|
||||
JsonObject: TypeAlias = dict[str, Any]
|
||||
JsonList: TypeAlias = list[Any]
|
||||
|
||||
T = TypeVar('T')
|
||||
|
||||
|
||||
class SchemaModel(BaseModel):
|
||||
model_config = ConfigDict(extra='allow', populate_by_name=True)
|
||||
|
||||
|
||||
class ApiEnvelope(SchemaModel, Generic[T]):
|
||||
code: int
|
||||
msg: str
|
||||
data: T
|
||||
|
||||
|
||||
class RouteContract(SchemaModel):
|
||||
method: str
|
||||
path: str
|
||||
request_model: str
|
||||
response_model: str
|
||||
|
||||
|
||||
class EmptyRequest(SchemaModel):
|
||||
pass
|
||||
Reference in New Issue
Block a user