Open hassec opened 1 year ago
Yes, the type stub looks pretty wonky. In general this should return the model / dataclass
/ TypedDict
instance which has been validated. There is some complexity on the Rust side which is probably what led to this stub. @adriangb maybe you have an idea how we might be able to improve this?
Maybe it's better to just make the type stub here -> Any
?
@Viicos, maybe a good issue for you, as our resident typing guru.
If the return type changes depending on the provided core schema, SchemaValidator
should ideally be made generic. But if not possible, then Any
is probably the way to go. But I'm not sure in which scenarios the current return type is valid?
If the return type changes depending on the provided core schema, SchemaValidator should ideally be made generic. But if not possible, then Any is probably the way to go.
Agreed re generic, and agreed re Any
for now.
Is it possible that the below type stub is incorrect?
https://github.com/pydantic/pydantic-core/blob/6a139753af85fc7bb6b34f26c1328994506f94ee/python/pydantic_core/_pydantic_core.pyi#L174-L183
In the below example the returned value seems to be
a
of typeA
.