[Pydantic schemas] Provide a better interface to import already specialized models
Resulted from the discussion: clive!90 (comment 127940)
Currently, it is possible to import generic models from schemas.
Unfortunately, this is problematic, because everyone using these models has to specialize them in a specific way. (And there are only two forms of specialization - legacy
and hf26
). And the usage looks like:
from schemas.operations import RecurrentTransferOperation
from schemas.__private.hive_fields_basic_schemas import AssetHbdHF26, AssetHiveHF26
def _create_operation(self) -> RecurrentTransferOperation[AssetHiveHF26, AssetHbdHF26]:
...
The solution is to expose already specialized models outside to make it possible:
(Note that, generic models are not exposed anymore)
from schemas.operations import RecurrentTransferOperationHF26
def _create_operation(self) -> RecurrentTransferOperationHF26:
...
or for someone who needs to import a legacy model:
from schemas.operations_legacy import RecurrentTransferOperationLegacy
def _create_operation(self) -> RecurrentTransferOperationLegacy:
...