How to materialize attrs data class from JSON schema defined by JSL document
问题 Assuming you using Python JSL library for defining JSON schema of your data and you using attrs library for quick definition of your DTO. How can you easily validate data structure against its JSON schema definition (as jsl.Document class) and reify it into attrs instance conforming to its JSL definition without extra boilerplate? Because creating JSL documents and duplicate their definitions just to have a corresponding attrs DTO doesn’t feel to be the right way. 回答1: Define a function to