https://github.com/guionardo/py-base-model
Base model for JSON data
https://github.com/guionardo/py-base-model
json modeling python
Last synced: 5 months ago
JSON representation
Base model for JSON data
- Host: GitHub
- URL: https://github.com/guionardo/py-base-model
- Owner: guionardo
- Created: 2020-03-02T00:45:29.000Z (over 6 years ago)
- Default Branch: develop
- Last Pushed: 2024-07-10T00:28:22.000Z (about 2 years ago)
- Last Synced: 2025-03-03T06:43:29.109Z (over 1 year ago)
- Topics: json, modeling, python
- Language: Python
- Homepage:
- Size: 75.2 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PY BASE MODEL
[](https://codecov.io/gh/guionardo/py-base-model)
Model data validator
## Examples
### Model with primitive type attributes
``` Python
from base_model.base_model import BaseModel
class PrimitiveFieldsModel(BaseModel):
id: int
name: str
active: bool
size: float
```
### Model with time type attributes
``` Python
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
``` Python
from typing import List
from base_model.base_model import BaseModel
class ListFieldsModel(BaseModel):
names: List[str]
ages: List[int]
enables: List[bool]
```