See e.g.: https://realpython.com/python-pydantic/ or https://stackoverflow.com/questions/69327239/how-to-validate-a-complex-nested-data-structure-with-pydantic