/py-base-model

Base model for JSON data

Primary LanguagePython

PY BASE MODEL

codecov

Model data validator

Examples

Model with primitive type attributes

from base_model.base_model import BaseModel

class PrimitiveFieldsModel(BaseModel):
    id: int
    name: str
    active: bool
    size: float

Model with time type attributes

from datetime import datetime, date, time

from base_model.base_model import BaseModel


class TimeFieldsModel(BaseModel):
    birthday: date
    register: datetime
    alarm: time

Model with list type attributes

from typing import List

from base_model.base_model import BaseModel


class ListFieldsModel(BaseModel):
    names: List[str]
    ages: List[int]
    enables: List[bool]