Skip to content

Instantly share code, notes, and snippets.

@pmbrull
Created March 14, 2022 19:38
Show Gist options
  • Save pmbrull/972152063fbc469615b8847e6e8d437b to your computer and use it in GitHub Desktop.
Save pmbrull/972152063fbc469615b8847e6e8d437b to your computer and use it in GitHub Desktop.
How to make the most of Pydantic 04
unnecessary_data = {
"name": "Lévy",
"age": 3,
"key": "value", # unnecessary
"key2": "value2", # unnecessary x2
"address": {
"city": "Wonderland",
"zip_code": "ABCDE",
"number": 123
}
}
data = CatRequest.parse_obj(unnecessary_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment