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, validate_all
p = Person(name="Foo")
try:
validate(p)
except ValidationFailed as err:
print(err) # p.id is not greater than 999
try:
validate_all(p)
except ValidationFailed as err:
print(err)
# p.id is not greater than 999
# p.email is not a valid email
# p.name pattern does not match ^[A-Za-z]+( [A-Za-z]+)*$
# home is required.
Metadata
Release files for protoc-gen-validate 1.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| protoc_gen_validate-1.3.3.tar.gz | 18.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| protoc_gen_validate-1.3.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.2 kB
Release files / protoc_gen_validate-1.3.3.tar.gz
| Download URL | protoc_gen_validate-1.3.3.tar.gz |
|---|---|
| Size | 18.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76c1cea6c2b1290fc2a266b7d19f44cdcc1dc496236b760db1a50e1672d6c978
|
|
BLAKE2b-256 checksum How to use checksums |
8efc24e9345f017d3e9d7fe2a9faa89fc973db7b3ccaecd54815cb6ee46c49d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / protoc_gen_validate-1.3.3-py3-none-any.whl
| Download URL | protoc_gen_validate-1.3.3-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da57131e2315f2b40a5ad4c75ce5352dbd8edc18a0787557895e1ebd2d74b883
|
|
BLAKE2b-256 checksum How to use checksums |
71d047aee72553d71e142418aa89da128ae9cd1dcb57fafea56832641d05a97d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|