Skip to content

Commit

Permalink
Add to_string to model, gave Ephys Link response models defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
kjy5 committed Mar 20, 2024
1 parent 621079b commit 8edfa68
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
28 changes: 14 additions & 14 deletions src/vbl_aquarium/models/ephys_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ class GetManipulatorsResponse(VBLBaseModel):
:type error: str
"""

manipulators: list[str]
num_axes: int
dimensions: Vector3
error: str
manipulators: list[str] = []
num_axes: int = 0
dimensions: Vector3 = Vector3()
error: str = ""


class PositionalResponse(VBLBaseModel):
Expand All @@ -91,8 +91,8 @@ class PositionalResponse(VBLBaseModel):
:type position: Vector4
"""

position: Vector4
error: str
position: Vector4 = Vector4()
error: str = ""


class AngularResponse(VBLBaseModel):
Expand All @@ -102,8 +102,8 @@ class AngularResponse(VBLBaseModel):
:type angles: Vector3
"""

angles: Vector3
error: str
angles: Vector3 = Vector3()
error: str = ""


class ShankCountResponse(VBLBaseModel):
Expand All @@ -115,8 +115,8 @@ class ShankCountResponse(VBLBaseModel):
:type error: str
"""

shank_count: int
error: str
shank_count: int = 0
error: str = ""


class DriveToDepthResponse(VBLBaseModel):
Expand All @@ -128,8 +128,8 @@ class DriveToDepthResponse(VBLBaseModel):
:type error: str
"""

depth: float
error: str
depth: float = 0
error: str = ""


class BooleanStateResponse(VBLBaseModel):
Expand All @@ -141,5 +141,5 @@ class BooleanStateResponse(VBLBaseModel):
:type error: str
"""

state: bool
error: str
state: bool = False
error: str = ""
5 changes: 4 additions & 1 deletion src/vbl_aquarium/utils/vbl_base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ class VBLBaseModel(BaseModel):
Configured to use PascalCase for field names and be immutable.
"""

model_config = ConfigDict(alias_generator=to_pascal, frozen=True)
model_config = ConfigDict(alias_generator=to_pascal, frozen=True, populate_by_name=True)

def to_string(self) -> str:
return self.model_dump_json(by_alias=True)

0 comments on commit 8edfa68

Please sign in to comment.