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
Let's look into a somewhat common use-case: an entity has a list of other instances as its components. For example, let's take an Invoice entity with a list of InvoiceFields. Elements of this list can be modeled with a ValueObject model (an "inline" submodel, represented by PostgreSQL JSONB column) or with a sub-entity (represented by a separate table and attached to an Invoice by a foreign key). Either way, both InvoiceRepository and Invoice should be unaware of the choice of modeling type.
classInvoice(Entity):
fields: t.List['InvoiceField'] =related(field='invoice', nullable=False)
classInvoiceField(Entity): # or a ValueObjectinvoice: Invoicequantity: intproduct: Product
Next, there's a Factory that models the complexity of the creation of an Invoice instance. Let's use MarshmallowFactory for that, and we won't use any implicit field generation.
The text was updated successfully, but these errors were encountered: