It looks similar to voluptuous. Browsing READMEs, the other three examples expose their own library level representations for primitive types (e.g. Field.int() or {"type": "int"} instead of the primitive Python type int).
Everytime i see one of those i always wonder if they heard of marshmallow. I mean it's like creating a requests competitor really. It's an interesting exercice but the chances to be relevant are very low.
Exactly my thought about json-schema, as I use it extensively in both Python and C++ (excellent library valijson [0]).
Not all Python objects are json-serializable by default, so the ideal solution (for me) would be json-schema with simple syntax for adding custom type validators.
It's tedious if you wanna validate a complex structure. Most of these libraries are meant to validate stuff that is user input. Imagine I load a complex input from a configuration file into a nested dict and checking it, that'd be really tedious to do manually. A couple checks here or there are ok, but they get confusing and difficult to maintain very quickly. Stuff like optional values, enumerated values etc are also not much fun.
Also error messages for the user. I've mostly used Voluptuous, but it provides much easier to understand error messages.
I wrote something similar for Ruby/Rails parameter validation. All of the solutions that were around at the time weren’t what I was looking for. It ends up looking like: https://gist.github.com/ezekg/f525a9d006c97cbcba231aa43e5ac9.... Is that something people would be interested in me open sourcing?
[+] [-] fermigier|8 years ago|reply
- https://github.com/alecthomas/voluptuous
- https://github.com/schematics/schematics
- https://github.com/pyeve/cerberus
- https://github.com/fuhrysteve/marshmallow-jsonschema
[+] [-] shazzy|8 years ago|reply
https://github.com/shezadkhan137/required
It makes it easier to expresses complex inter-field validation rules, and is meant to be used with other validation libraries.
[+] [-] chucksmash|8 years ago|reply
[+] [-] xapata|8 years ago|reply
Similar design to Voluptuous, but it also supports a destructuring bind instead of just validation.
[+] [-] carapace|8 years ago|reply
[+] [-] BerislavLopac|8 years ago|reply
[+] [-] fermigier|8 years ago|reply
- https://awesome-python.com/#data-validation
[+] [-] logronoide|8 years ago|reply
[+] [-] StavrosK|8 years ago|reply
[+] [-] sametmax|8 years ago|reply
[+] [-] houzi|8 years ago|reply
[+] [-] aldanor|8 years ago|reply
To me, that's a complete showstopper.
[+] [-] mathgenius|8 years ago|reply
[+] [-] craigds|8 years ago|reply
I don't think those are in the same league
[+] [-] vram22|8 years ago|reply
https://pypi.python.org/pypi/jsonschema
A post showing a simple use of it:
Using JSON Schema with Python to validate JSON data:
https://jugad2.blogspot.in/2015/12/using-json-schema-with-py...
[+] [-] ansgri|8 years ago|reply
Not all Python objects are json-serializable by default, so the ideal solution (for me) would be json-schema with simple syntax for adding custom type validators.
[0] https://github.com/tristanpenman/valijson
[+] [-] Dowwie|8 years ago|reply
it offers run-time type checking in a variety of ways, is intuitive, and actively maintained
[+] [-] StavrosK|8 years ago|reply
[+] [-] varlock|8 years ago|reply
[+] [-] gh02t|8 years ago|reply
Also error messages for the user. I've mostly used Voluptuous, but it provides much easier to understand error messages.
[+] [-] jdipierro|8 years ago|reply
[+] [-] crdoconnor|8 years ago|reply
http://github.com/crdoconnor/strictyaml
[+] [-] w_t_payne|8 years ago|reply
[+] [-] bitexploder|8 years ago|reply
[+] [-] nolite|8 years ago|reply
[+] [-] ezekg|8 years ago|reply
[+] [-] souenzzo|8 years ago|reply