New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support variadic generics #5804
Comments
Any news on this front? |
Working on it now. I think there may be some issues with the existing xfailing tests for this stuff, and it's a bit more complicated than I expected, but making progress.. |
I think we'll need to modify pydantic-core to support a tuple schema with a variable-length item in the "middle"; right now, I believe the tuple-positional schema only supports variable-number of "tail" items, but in https://peps.python.org/pep-0646/ it is clearly supported to have any number of specific parameters at the start and/or end of the tuple. I would propose that we actually unify the class TupleSchema(TypedDict, total=False):
type: Required[Literal['tuple']]
leading_items_schema: List[CoreSchema]
trailing_items_schema: List[CoreSchema]
variadic_schema: CoreSchema
min_variadic_length: int
max_variadic_length: int
strict: bool
ref: str
metadata: Any
serialization: IncExSeqOrElseSerSchema |
We eventually want to support variadic generics.
There are already some tests for the desired behavior (thanks @caniko).
I'm creating this issue for tracking purposes as I have closed #5351.
The text was updated successfully, but these errors were encountered: