In typical hexagonal architecture you are very likely to want to use the DTOs in the application layer while the litestar would only live in the infrastructure layer.
from litestar.dto import DTOData
class ProductService:
def create_product(self, product_dto: DTOData[ProductModel]) -> ProductModel:
product_model= product_dto.create_instance(
id=ProductId(uuid4()),
creation_ts=self.time_service.now(),
)
return self.product_repo.store_product(product_model)
litestar.dto
in import section pretty much ties us to use the litestar as a whole. We have to pretty much install whole litestar so using other APIs with litestar.dto is not plausible because whole litestar has to be installed anyway.dto
to something less generic.Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too