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.1.tar.gz
(16.6 kB
view hashes)
Built Distribution
Close
Hashes for protoc-gen-validate-0.4.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 137bebd2d423bef9378a8e5558d4da5fe2a7075921db2067513294775f48007f |
|
MD5 | 7220ec7ee831b89435610fc8e529c32e |
|
BLAKE2b-256 | 7acefb851a5450c68f0f886b753fcd8882fab2481026b691df1a120fd77a0ad5 |
Close
Hashes for protoc_gen_validate-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c55ea79ac8fb20beceb687c284fff974f3a208f3838a2732ceddf38d047577af |
|
MD5 | c19a8a01fdd3735750075767b56c1123 |
|
BLAKE2b-256 | 08ac8d7680311fcc9da4f9bb76a0888413fff13e098198a644cafab02271ae26 |