schema
schema copied to clipboard
Add decorators to the library so functions/methods param can be automatically validated or raise SchemaError if invalid.
I would like to suggest the following feature of adding decorators to the library so functions/methods param can be automatically validated or raise SchemaError if invalid. This would allow to factor out the validation logic from within the method. If this sounds like a good idea more than happy to submit an implementation ?
Hmm, could you write an example of how you think it should look? It sounds like a good idea but the implementation can get hairy.
Hey @bernalrs , I ended up having the same idea today and had a first go, I put my initial snippets up at https://gist.github.com/MathieuDuponchelle/1c3b6c43b565e4c4a998a7f44e84fae3 .
While we certainly wouldn't want to do that kind of thing for every and all function in a program, it will certainly help me a lot in cleaning up input to python API I might be developing.