Re:Show HN: Pydantic – Data validation using Python 3.6 type...
by svisser on Saturday June 03, 2017 @01:55PM
(#14477521)
For those looking to validate dictionaries / JSON responses in Python, the voluptuous library works quite well: http://github.com/alecthomas/voluptuous. It also works for lists and other data types.
[ Parent
| on HN ]
Re:Show HN: Pydantic – Data validation using Python 3.6 type...
by Varriount on Sunday June 04, 2017 @06:21PM
(#14483956)
I use a fork/successor library, good[0], for configuration validation. I've especially liked the data transformation it can do (I can easily allow a configuration entry to be a single value, or list of values, and transform that to always be a list)
Re:Show HN: Pydantic – Data validation using Python 3.6 type...
by user5994461 on Saturday June 03, 2017 @02:45PM
(#14477798)
JSON has a well defined schema system that works across languages. http://json-schema.org/
Python comes with the jsonschema module out of the box.
Re:Show HN: Pydantic – Data validation using Python 3.6 type...
by calvins on Saturday June 03, 2017 @02:52PM
(#14477840)
What do you mean by 'out of the box'? jsonschema needs to be installed. It's not in the stdlib.
Re:Show HN: Pydantic – Data validation using Python 3.6 type...
by StavrosK on Saturday June 03, 2017 @02:48PM
(#14477813)
That's rather verbose, though. I prefer the much more functional "schema" library:
Re:Show HN: Pydantic – Data validation using Python 3.6 type...
by ris on Sunday June 04, 2017 @08:00AM
(#14480972)
Thing is, none of these are language agnostic. jsonschema is the only one that makes an attempt at that.
It's a slight pity that the python jsonschema package doesn't support some of the more powerful recent features though.