Closed benedikt-bartscher closed 1 month ago
I don't see much point in enabling this when PEP-649 is just round the corner
using typing.310 and pydantic_dataclasses generated this:
@dataclass(eq=False, repr=False)
class Message(betterproto.Message):
selection_request: "SelectionRequest" | None = betterproto.message_field(
1, optional=True, group="message"
)
machine_event: "MachineEvent" | None = betterproto.message_field(
2, optional=True, group="message"
)
@model_validator(mode="after")
def check_oneof(cls, values):
return cls._validate_field_groups(values)
pyright
/home/***/gen/hello/v1/__init__.py
/home/***/gen/hello/v1/__init__.py:41:24 - error: Union syntax cannot be used with string operand; use quotes around entire expression (reportGeneralTypeIssues)
/home/***/gen/hello/v1/__init__.py:44:20 - error: Union syntax cannot be used with string operand; use quotes around entire expression (reportGeneralTypeIssues)
Ah well that's just a bug with the processing. In the meantime, you can generate the imports differently. See the Configuration typing imports section of README
Summary
Add support for future annotations
What is the feature request for?
The core library
The Problem
Currently future annotations are not supported. All custom type annotations are rendered as strings.
The Ideal Solution
Add a flag to enable future annotations
The Current Solution
No response