Closed akhundMurad closed 1 year ago
It should work with pydantic classes, that is, anything which supports issubclass
. The problem appears to be not supporting Type[...]
. Some workarounds to try which are similar:
Literal[...]
: which won't match subclassestype(...)
: which will match instances of its metaclass.Thanks for quick response!
Hello! I am trying to use it with
pydantic.BaseModel
and I am facing the issue:Where
ProfileDTO
andUserDTO
are pydantic models.Then I am trying to use this class:
But the library doesn't use the registered method, because it recognizes
typing.Type[UserDTO]
construction likepydantic.main.ModelMetaclass
.Is there some solution for this?