Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions protovalidate/internal/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import celpy
from celpy import celtypes
from google.protobuf import any_pb2, descriptor, duration_pb2, message, message_factory
from google.protobuf import any_pb2, descriptor, duration_pb2, message, message_factory, timestamp_pb2

from buf.validate import validate_pb2
from protovalidate.config import Config
Expand All @@ -37,8 +37,10 @@ def make_duration(msg: duration_pb2.Duration) -> celtypes.DurationType:
)


def make_timestamp(msg: duration_pb2.Duration) -> celtypes.TimestampType:
return celtypes.TimestampType(1970, 1, 1) + make_duration(msg)
def make_timestamp(msg: timestamp_pb2.Timestamp) -> celtypes.TimestampType:
return celtypes.TimestampType(1970, 1, 1) + make_duration(
duration_pb2.Duration(seconds=msg.seconds, nanos=msg.nanos)
)


def unwrap(msg: message.Message) -> celtypes.Value:
Expand Down