You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.
How to check for a field type to be a subtype of generic type? This will be a common question if we allow this, but Python does not allow subclass checks with generic, i.e. the following does not work:
fromtypingimportGeneric, TypeVar, List# raises: TypeError: Subscripted generics cannot be used with class and instance checksissubclass(List[int], List[T])
Consequences of changing the Node base class to GenericModel
It is sometimes useful to restrict types of fields of fields of a node.
Objectives
Pydantic supports this out of the box (see pydantic/pydantic#556 and pydantic/pydantic#595).
Open questions:
Example 1
Example 2
The text was updated successfully, but these errors were encountered: