Created
November 1, 2020 21:12
-
-
Save MartinThoma/3a6ed78f6f8140a8ccebc20b08d49e0b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person(BaseModel): | |
id: PersonId | |
name: str | |
bank_account: Decimal | |
birthdate: datetime.date | |
friends: Optional[List[PersonId]] = None | |
class Config: | |
allow_population_by_field_name = True | |
# We use the Python attribute 'bank_account', | |
# but read/write the JSON 'bankAccount' | |
fields = {"bank_account": "bankAccount"} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment