Data Validation

AIOAPI relies on pydantic for data validation. To know how to work with pydantic and to get know all about its features please follow official documentation.

Below you can find a simple example of pydantics model declaration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from datetime import datetime
from typing import List

from pydantic import BaseModel


class User(BaseModel):
    id: int
    name = 'John Doe'
    signup_ts: datetime = None
    friends: List[int] = []