forked from OCA/rest-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemas.py
More file actions
19 lines (12 loc) · 676 Bytes
/
schemas.py
File metadata and controls
19 lines (12 loc) · 676 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from typing import Annotated, Generic, TypeVar
from extendable_pydantic import StrictExtendableBaseModel
from pydantic import Field
T = TypeVar("T")
class PagedCollection(StrictExtendableBaseModel, Generic[T]):
"""A paged collection of items"""
# This is a generic model. The type of the items is defined by the generic type T.
# It provides you a common way to return a paged collection of items of
# extendable models. It's based on the StrictExtendableBaseModel to ensure
# a strict validation when used within the odoo fastapi framework.
count: Annotated[int, Field(..., description="The count of items into the system")]
items: list[T]