Summary
Congratulations! You’ve learned about another important aspect of FastAPI: designing and managing data models with Pydantic. You should now be confident about creating models and applying validation at the field level, with built-in options and types, and also by implementing your own validation methods. You also know how to apply validation at the object level to check consistency between several fields. You also learned how to leverage model inheritance to prevent code duplication and repetition while defining your model variations. Finally, you learned how to correctly work with Pydantic model instances in order to transform and update them in an efficient and readable way.
You know almost all the features of FastAPI by now. There is one last very powerful feature for you to learn about: dependency injection. This allows you to define your own logic and values and directly inject them into your path operation functions, as you do for path parameters and payload...