mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-03-16 03:26:18 +00:00
fix: pydantic extra keywords deprecated (#753)
Pydantic deprecates using extra keyword arguments on Field. Used json_schema_extra instead. Deprecated in Pydantic V2.0 to be removed in V3.0. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
@@ -24,26 +24,34 @@ class MeasurementCommonSettings(SettingsBaseModel):
|
||||
|
||||
load_emr_keys: Optional[list[str]] = Field(
|
||||
default=None,
|
||||
description="The keys of the measurements that are energy meter readings of a load [kWh].",
|
||||
examples=[["load0_emr"]],
|
||||
json_schema_extra={
|
||||
"description": "The keys of the measurements that are energy meter readings of a load [kWh].",
|
||||
"examples": [["load0_emr"]],
|
||||
},
|
||||
)
|
||||
|
||||
grid_export_emr_keys: Optional[list[str]] = Field(
|
||||
default=None,
|
||||
description="The keys of the measurements that are energy meter readings of energy export to grid [kWh].",
|
||||
examples=[["grid_export_emr"]],
|
||||
json_schema_extra={
|
||||
"description": "The keys of the measurements that are energy meter readings of energy export to grid [kWh].",
|
||||
"examples": [["grid_export_emr"]],
|
||||
},
|
||||
)
|
||||
|
||||
grid_import_emr_keys: Optional[list[str]] = Field(
|
||||
default=None,
|
||||
description="The keys of the measurements that are energy meter readings of energy import from grid [kWh].",
|
||||
examples=[["grid_import_emr"]],
|
||||
json_schema_extra={
|
||||
"description": "The keys of the measurements that are energy meter readings of energy import from grid [kWh].",
|
||||
"examples": [["grid_import_emr"]],
|
||||
},
|
||||
)
|
||||
|
||||
pv_production_emr_keys: Optional[list[str]] = Field(
|
||||
default=None,
|
||||
description="The keys of the measurements that are PV production energy meter readings [kWh].",
|
||||
examples=[["pv1_emr"]],
|
||||
json_schema_extra={
|
||||
"description": "The keys of the measurements that are PV production energy meter readings [kWh].",
|
||||
"examples": [["pv1_emr"]],
|
||||
},
|
||||
)
|
||||
|
||||
## Computed fields
|
||||
@@ -78,7 +86,7 @@ class Measurement(SingletonMixin, DataImportMixin, DataSequence):
|
||||
"""
|
||||
|
||||
records: list[MeasurementDataRecord] = Field(
|
||||
default_factory=list, description="list of measurement data records"
|
||||
default_factory=list, json_schema_extra={"description": "list of measurement data records"}
|
||||
)
|
||||
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
|
||||
Reference in New Issue
Block a user