Skip to content

Commit 4c035d0

Browse files
Update for editions (#174)
Updates protovalidate, adds support for new ignore semantics. The PR is huge but it's mostly gencode; the actual CEL code wasn't too substantially altered. ~~Unfortunately I could not get the tests to pass 100%. There is a minor wrinkle where, I _believe_, the behavior of `has(x.y)` and `x.y` needs to differ (specifically with proto3 optional) but it can not due to the way the interpreter works. It _seems_ like this only impacts some rather small edge cases so I guess we might be able to live with it in the interim. I've just added said tests to the nonconforming list.~~ **Update:** The issues still exist upstream (assuming the issue is valid and not a mistake on my part) but we are now working around it, and tests now pass 100% (sans the existing failures.) All other tests pass and I _believe_ my fixes are correct. The e-mail check was corrected to not support bracketed emails as was done with the Go version.
1 parent 86e4937 commit 4c035d0

File tree

75 files changed

+4721
-1927
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+4721
-1927
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ export PATH := $(BIN):$(PATH)
1111
export GOBIN := $(abspath $(BIN))
1212
# Set to use a different Python interpreter. For example, `PYTHON=python make test`.
1313
PYTHON ?= python3
14-
CONFORMANCE_ARGS ?= --strict --expected_failures=tests/conformance/nonconforming.yaml
14+
CONFORMANCE_ARGS ?= --strict --expected_failures=tests/conformance/nonconforming.yaml --timeout 10s
1515
ADD_LICENSE_HEADER := $(BIN)/license-header \
1616
--license-type apache \
1717
--copyright-holder "Buf Technologies, Inc." \
1818
--year-range "2023"
19-
PROTOVALIDATE_VERSION ?= v0.5.6
19+
PROTOVALIDATE_VERSION ?= v0.7.1
2020

2121
.PHONY: help
2222
help: ## Describe useful make targets

Pipfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ verify_ssl = true
44
name = "pypi"
55

66
[packages]
7-
cel-python = "==0.1.*"
8-
protobuf = "==4.*"
7+
cel-python = "==0.1.5"
8+
protobuf = "==5.*"
99

1010
[dev-packages]
1111
pytest = "*"

Pipfile.lock

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

buf.gen.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: v1
22
plugins:
3-
- plugin: buf.build/protocolbuffers/python:v23.2
3+
- plugin: buf.build/protocolbuffers/python:v27.2
44
out: gen
5-
- plugin: buf.build/protocolbuffers/pyi:v23.2
5+
- plugin: buf.build/protocolbuffers/pyi:v27.2
66
out: gen

buf.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Generated by buf. DO NOT EDIT.
2+
version: v1

gen/buf/validate/conformance/cases/bool_pb2.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,23 @@
1414

1515
# -*- coding: utf-8 -*-
1616
# Generated by the protocol buffer compiler. DO NOT EDIT!
17+
# NO CHECKED-IN PROTOBUF GENCODE
1718
# source: buf/validate/conformance/cases/bool.proto
19+
# Protobuf Python Version: 5.27.2
1820
"""Generated protocol buffer code."""
1921
from google.protobuf import descriptor as _descriptor
2022
from google.protobuf import descriptor_pool as _descriptor_pool
23+
from google.protobuf import runtime_version as _runtime_version
2124
from google.protobuf import symbol_database as _symbol_database
2225
from google.protobuf.internal import builder as _builder
26+
_runtime_version.ValidateProtobufRuntimeVersion(
27+
_runtime_version.Domain.PUBLIC,
28+
5,
29+
27,
30+
2,
31+
'',
32+
'buf/validate/conformance/cases/bool.proto'
33+
)
2334
# @@protoc_insertion_point(imports)
2435

2536
_sym_db = _symbol_database.Default()
@@ -33,13 +44,12 @@
3344
_globals = globals()
3445
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
3546
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'buf.validate.conformance.cases.bool_pb2', _globals)
36-
if _descriptor._USE_C_DESCRIPTORS == False:
37-
38-
DESCRIPTOR._options = None
39-
_BOOLCONSTTRUE.fields_by_name['val']._options = None
40-
_BOOLCONSTTRUE.fields_by_name['val']._serialized_options = b'\272H\004j\002\010\001'
41-
_BOOLCONSTFALSE.fields_by_name['val']._options = None
42-
_BOOLCONSTFALSE.fields_by_name['val']._serialized_options = b'\272H\004j\002\010\000'
47+
if not _descriptor._USE_C_DESCRIPTORS:
48+
DESCRIPTOR._loaded_options = None
49+
_globals['_BOOLCONSTTRUE'].fields_by_name['val']._loaded_options = None
50+
_globals['_BOOLCONSTTRUE'].fields_by_name['val']._serialized_options = b'\272H\004j\002\010\001'
51+
_globals['_BOOLCONSTFALSE'].fields_by_name['val']._loaded_options = None
52+
_globals['_BOOLCONSTFALSE'].fields_by_name['val']._serialized_options = b'\272H\004j\002\010\000'
4353
_globals['_BOOLNONE']._serialized_start=106
4454
_globals['_BOOLNONE']._serialized_end=134
4555
_globals['_BOOLCONSTTRUE']._serialized_start=136

gen/buf/validate/conformance/cases/bool_pb2.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ from typing import ClassVar as _ClassVar, Optional as _Optional
2020
DESCRIPTOR: _descriptor.FileDescriptor
2121

2222
class BoolNone(_message.Message):
23-
__slots__ = ["val"]
23+
__slots__ = ("val",)
2424
VAL_FIELD_NUMBER: _ClassVar[int]
2525
val: bool
2626
def __init__(self, val: bool = ...) -> None: ...
2727

2828
class BoolConstTrue(_message.Message):
29-
__slots__ = ["val"]
29+
__slots__ = ("val",)
3030
VAL_FIELD_NUMBER: _ClassVar[int]
3131
val: bool
3232
def __init__(self, val: bool = ...) -> None: ...
3333

3434
class BoolConstFalse(_message.Message):
35-
__slots__ = ["val"]
35+
__slots__ = ("val",)
3636
VAL_FIELD_NUMBER: _ClassVar[int]
3737
val: bool
3838
def __init__(self, val: bool = ...) -> None: ...

0 commit comments

Comments
 (0)