File tree 1 file changed +14
-1
lines changed
api/src/opentrons/protocol_engine/types
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 3
3
from dataclasses import dataclass
4
4
from datetime import datetime
5
5
from typing import Optional , List
6
- from pydantic import BaseModel , model_serializer
6
+ from pydantic import BaseModel , model_serializer , field_validator
7
7
8
8
9
9
class SimulatedProbeResult (BaseModel ):
@@ -104,6 +104,19 @@ class ProbedVolumeInfo(BaseModel):
104
104
class WellInfoSummary (BaseModel ):
105
105
"""Payload for a well's liquid info in StateSummary."""
106
106
107
+ @field_validator ("probed_height" , "probed_volume" , mode = "before" )
108
+ @classmethod
109
+ def validate_simulated_probe_result (
110
+ cls , input_val : str | None
111
+ ) -> LiquidTrackingType | None :
112
+ """Return the appropriate input to WellInfoSummary from json data."""
113
+ if not input_val :
114
+ return None
115
+ if input_val .isdigit ():
116
+ return float (input_val )
117
+ else :
118
+ return SimulatedProbeResult ()
119
+
107
120
labware_id : str
108
121
well_name : str
109
122
loaded_volume : Optional [float ] = None
You can’t perform that action at this time.
0 commit comments