Gogs bef6e57d0d first commit 1 mēnesi atpakaļ
..
protoc_gen_validate bef6e57d0d first commit 1 mēnesi atpakaļ
BUILD bef6e57d0d first commit 1 mēnesi atpakaļ
README.md bef6e57d0d first commit 1 mēnesi atpakaļ
pyproject.toml bef6e57d0d first commit 1 mēnesi atpakaļ
requirements.in bef6e57d0d first commit 1 mēnesi atpakaļ
setup.cfg bef6e57d0d first commit 1 mēnesi atpakaļ

README.md

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)