From 9fb073f2ac016d015b1b30c0ed9d8d84013552c6 Mon Sep 17 00:00:00 2001 From: Chris Mutel Date: Sat, 15 Jun 2024 16:09:31 +0200 Subject: [PATCH] Enable alias field for `reference product` --- bw_interface_schemas/lci.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bw_interface_schemas/lci.py b/bw_interface_schemas/lci.py index 555dedc..cf25e8b 100644 --- a/bw_interface_schemas/lci.py +++ b/bw_interface_schemas/lci.py @@ -82,17 +82,19 @@ class Process(Node): class ProcessWithReferenceProduct(Process): """Chimaera which serves as both a product and a process in the graph.""" - # Was previously "reference product", need the underscore here + # Use `ProcessWithReferenceProduct.model_dump(by_alias=True)` + # to get a dictionary using the alias field reference_product: str = Field(alias="reference product") # Optional name for the amount of reference product produced. # Duplicates information in the exchanges. # Should be net amount. production_amount: Optional[float] = None # Properties for reference product - properties: dict[str, Union[float, int]] + properties: Optional[dict[str, Union[float, int]]] = None - class Config: - populate_by_name = True + model_config = ConfigDict( + populate_by_name=False, + ) class Product(Node):