Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions protovalidate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from __future__ import annotations

from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any

from ._errors import CompilationError, EvaluationError, ValidationError
from ._gen.buf.validate.validate_pb import (
Expand All @@ -42,7 +42,7 @@


def validate(
message: Message | google_message.Message, *, fail_fast: bool = False
message: Message[Any] | google_message.Message, *, fail_fast: bool = False
) -> None:
"""Validates the given message against the static rules defined in the message's descriptor using a shared validator.

Expand All @@ -60,7 +60,7 @@ def validate(


def collect_violations(
message: Message | google_message.Message, *, fail_fast: bool = False
message: Message[Any] | google_message.Message, *, fail_fast: bool = False
) -> list[Violation]:
"""Collects the violations for the given message against the static rules defined in the message's descriptor using a shared validator.

Expand Down
4 changes: 2 additions & 2 deletions protovalidate/_protovalidate.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ impl<'a, 'py> FromPyObject<'a, 'py> for PbMessage<'a, 'py> {
type Error = Infallible;

const INPUT_TYPE: PyStaticExpr = type_hint_union!(
type_hint_identifier!("protobuf", "Message"),
type_hint_subscript!(
type_hint_identifier!("protobuf", "Message"),
type_hint_identifier!("typing", "Any")
),
type_hint_identifier!("google.protobuf.message", "Message")
);

Expand Down
Loading