Skip to content
Snippets Groups Projects
Commit 177c3d32 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Bugfix: enabling validTimeStart to be serialized

parent 08933ab3
No related branches found
No related tags found
No related merge requests found
Pipeline #739 failed
......@@ -25,7 +25,7 @@ along with VIPSCore-Python-Common. If not, see <http://www.nibio.no/licenses/>.
from datetime import datetime
from shapely.geometry import Point, Polygon
from pydantic import BaseModel, validator, constr, Field
from typing import Any, Union, ClassVar, Optional
from typing import Any, ClassVar, Optional
import pytz
class Result(BaseModel):
......@@ -33,7 +33,7 @@ class Result(BaseModel):
Represents a set of DSS model result values for a given point in space (Point, Polygon, MultiPolygon) and time (Period or immediate)
"""
valid_time_start: datetime = Field(alias="validTimeStart")
valid_time_end: Optional[datetime] = Field(alias="validTimeStart")
valid_time_end: Optional[datetime] = Field(alias="validTimeEnd")
valid_geometry: Optional[Any] = Field(alias="validGeometry")
warning_status: int = Field(alias="warningStatus")
all_values: dict = Field(alias="allValues")
......@@ -76,6 +76,9 @@ class ModelConfiguration(BaseModel):
model_id: constr(min_length=10, max_length=10) = Field(alias="modelId")
config_parameters: dict = Field(alias="configParameters")
class Config:
allow_population_by_field_name = True
# Can we do this and still serialize the object??
def get_config_parameter_as_date(self, param_name: str, required=True) -> datetime:
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment