-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathschemas.py
More file actions
32 lines (27 loc) · 1.03 KB
/
schemas.py
File metadata and controls
32 lines (27 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from typing import Iterable, Optional, Type, Union
from fastapi import APIRouter
from pydantic import BaseModel, ConfigDict
from fastapi_jsonapi.data_typing import TypeModel, TypeSchema
from fastapi_jsonapi.views import Operation, ViewBase
class ResourceData(BaseModel):
model_config = ConfigDict(
arbitrary_types_allowed=True,
)
path: Union[str, list[str]]
router: Optional[APIRouter]
tags: list[str]
view: Type[ViewBase]
model: Type[TypeModel]
source_schema: Type[TypeSchema]
schema_in_post: Optional[Type[BaseModel]]
schema_in_post_data: Type[BaseModel]
schema_in_patch: Optional[Type[BaseModel]]
schema_in_patch_data: Type[BaseModel]
detail_response_schema: Type[BaseModel]
list_response_schema: Type[BaseModel]
pagination_default_size: Optional[int] = 25
pagination_default_number: Optional[int] = 1
pagination_default_offset: Optional[int] = None
pagination_default_limit: Optional[int] = None
operations: Iterable[Operation] = ()
ending_slash: bool = True