PGV for python via just-in-time code generation
Project description
Protoc-gen-validate (PGV)
While protocol buffers effectively guarantee the types of structured data,
they cannot enforce semantic rules for values. This package is a python implementation
of protoc-gen-validate, which allows for runtime validation of various
semantic assertions expressed as annotations on the protobuf schema. The syntax for all available annotations is
in validate.proto
. Implemented Python annotations are listed in the rules comparison.
Example
from entities_pb2 import Person
from protoc_gen_validate.validator import validate, ValidationFailed
p = Person(first_name="Foo", last_name="Bar", age=42)
try:
validate(p)
except ValidationFailed as err:
print(err)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
protoc-gen-validate-0.4.2.tar.gz
(16.6 kB
view hashes)
Built Distribution
Close
Hashes for protoc-gen-validate-0.4.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2848ccf6e63db19d0171d80af149e1fe190e2483d2a1675283718bce1745252 |
|
MD5 | 6d5f29824796782f3eb8fe8d9ff6bc91 |
|
BLAKE2b-256 | 593584d7209020da3732e8706b4cf7754abaff6ca6720122a5bea2a82e1356a0 |
Close
Hashes for protoc_gen_validate-0.4.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3fa971d27381b804df9d3f79033393e48afc6d8f598e40216d10f3dbdf84823 |
|
MD5 | 0fb95c9b802bdfbe8b35dca0308fa93f |
|
BLAKE2b-256 | 700ac68b32080aa84e2a4814bcae2f113a77e3b430530553c82f3421f7812886 |