-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
pydantic_models.py
50 lines (38 loc) · 926 Bytes
/
pydantic_models.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -*- coding: utf-8 -*-
"""
Pydantic Response models for each endpoint.
"""
from pydantic import UUID4, BaseModel, EmailStr
class Password(BaseModel):
"""
Type Check valid Python string returned.
"""
# Keeping this simple. May create a Union to check for valid MD5 hashed
# string is returned.
password: str
class Address(BaseModel):
"""
Nested submodule for Person's Pydantic model.
"""
# Not checking for valid U.S. streets, cities or zip codes. Ain't nobody
# got time for that! Trusting Mimesis on that.
street: str
city: str
zipcode: str
class Person(BaseModel):
"""
Type check valid Persons is returned.
"""
id: UUID4
name: str
surname: str
email: EmailStr
age: int
username: str
occupation: str
address: Address
class Emoji(BaseModel):
"""
Type check Respone Model for emoji.
"""
emoji: str