Skip to content

Commit e4afdfe

Browse files
author
Ronen Hilewicz
committed
Support protovalidate
1 parent 26fe7bd commit e4afdfe

16 files changed

+1287
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ __pycache__
77
.pytest_cache
88
.vscode
99
.coverage
10+
.python-version

magefiles/magefile.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ func gen(bufImage, fileSources string) error {
9999
for bufImage, clientFiles := range files {
100100
err = buf.Run(
101101
buf.AddArg("generate"),
102+
buf.AddArg("--include-imports"),
102103
buf.AddArg("--template"),
103104
buf.AddArg(filepath.Join("buf", "buf.gen.yaml")),
104105
buf.AddArg(bufImage),

poetry.lock

Lines changed: 189 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,15 @@ packages = [
3030

3131
[tool.poetry.dependencies]
3232
python = ">=3.8"
33-
grpcio = ">=1.58.0"
33+
grpcio = "^1.49.0"
3434
typing-extensions = ">=3.10.0"
35+
protobuf = "^4.21.0"
36+
protovalidate = { version = "^0.3.0", python = ">=3.11"}
3537

3638
[tool.poetry.dev-dependencies]
37-
black = "^23.10.1"
38-
isort = "^5.10.1"
39+
black = "^23.11.0"
40+
isort = "^5.10.0"
41+
pyright = "^1.1.0"
3942

4043
[tool.mypy]
4144
explicit_package_bases = true

src/buf/validate/expression_pb2.py

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from google.protobuf.internal import containers as _containers
2+
from google.protobuf import descriptor as _descriptor
3+
from google.protobuf import message as _message
4+
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
5+
6+
DESCRIPTOR: _descriptor.FileDescriptor
7+
8+
class Constraint(_message.Message):
9+
__slots__ = ("id", "message", "expression")
10+
ID_FIELD_NUMBER: _ClassVar[int]
11+
MESSAGE_FIELD_NUMBER: _ClassVar[int]
12+
EXPRESSION_FIELD_NUMBER: _ClassVar[int]
13+
id: str
14+
message: str
15+
expression: str
16+
def __init__(self, id: _Optional[str] = ..., message: _Optional[str] = ..., expression: _Optional[str] = ...) -> None: ...
17+
18+
class Violations(_message.Message):
19+
__slots__ = ("violations",)
20+
VIOLATIONS_FIELD_NUMBER: _ClassVar[int]
21+
violations: _containers.RepeatedCompositeFieldContainer[Violation]
22+
def __init__(self, violations: _Optional[_Iterable[_Union[Violation, _Mapping]]] = ...) -> None: ...
23+
24+
class Violation(_message.Message):
25+
__slots__ = ("field_path", "constraint_id", "message", "for_key")
26+
FIELD_PATH_FIELD_NUMBER: _ClassVar[int]
27+
CONSTRAINT_ID_FIELD_NUMBER: _ClassVar[int]
28+
MESSAGE_FIELD_NUMBER: _ClassVar[int]
29+
FOR_KEY_FIELD_NUMBER: _ClassVar[int]
30+
field_path: str
31+
constraint_id: str
32+
message: str
33+
for_key: bool
34+
def __init__(self, field_path: _Optional[str] = ..., constraint_id: _Optional[str] = ..., message: _Optional[str] = ..., for_key: bool = ...) -> None: ...
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2+
"""Client and server classes corresponding to protobuf-defined services."""
3+
import grpc
4+

0 commit comments

Comments
 (0)