#mathbyteacademy #python
In this video I want to present a really neat approach that one of my students on Udemy came up with to have Pydantic models that will still deserialize invalid data (populated with some value, such as None), as well as provide information about those fields that failed validation.
I didn't think it could be done, so I was very happy to be proved wrong by that person's very elegant solution! This is a technique that I will probably use often moving forward.
It is also a great example of a practical application of wrap validators and model validators. Even if you have no need for partially validated Pydantic models, you should still watch this to get a clear understanding of how wrap validators work and can be leveraged.
Thank you to the author for coming up with this and sharing it on GitHub!
Code for this Video
================
Available in GitHub blog repo: https://github.com/fbaptiste/pythonblog
Direct link: https://tinyurl.com/52en6scd
Original author's GitHub repo: https://github.com/linktoad/pydantic...
My Python Courses
=================
Python 3 Fundamentals (introduction to Python)
https://www.udemy.com/course/python3...
Pydantic V2: Essentials
https://www.udemy.com/course/pydantic...
Python 3 Deep Dive (Part 1 Functional)
https://www.udemy.com/course/python3...
Python 3 Deep Dive (Part 2 Iteration, Generators)
https://www.udemy.com/course/python3...
Python 3 Deep Dive (Part 3 Hash Maps)
https://www.udemy.com/course/python3...
Python 3 Deep Dive (Part 4 OOP)
https://www.udemy.com/course/python3...