Skip to main content

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)

Source distribution for protoc-gen-validate 1.3.3
File Size Uploaded
protoc_gen_validate-1.3.3.tar.gz 18.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for protoc-gen-validate 1.3.3
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

1.3.3 This release

2 release files

1.2.1

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page