Skip to content

Commit

Permalink
fix(api): rename TouchTipParams -> LiquidClassTouchTipParams to avoid…
Browse files Browse the repository at this point in the history
… name conflict (#16848)

# Overview

Liquid classes defined a new class `TouchTipParams` to configure the
touch-tip settings for a liquid. But there's already an existing class
called [`TouchTipParams`](../blob/edge/api/src/opentrons/protocol_engine/commands/touch_tip.py)
that's used as the argument to the Protocol Engine `touchTip` command.
When we generate the [command schema](../blob/edge/shared-data/command/schemas/11.json),
both classes get pulled in, and the names clash.

This PR renames the liquid class `TouchTipParams` to
`LiquidClassTouchTipParams` to avoid the conflict.

## Test Plan and Hands on Testing

I ran `make -C api test`, everything seems to pass.

## Risk assessment

If this breaks anything, it should only affect our team for now.
  • Loading branch information
ddcc4 authored Nov 15, 2024
1 parent 92b5806 commit 112ea83
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ def _validate_params(
return v


class TouchTipParams(BaseModel):
class LiquidClassTouchTipParams(BaseModel):
"""Parameters for touch-tip."""

# Note: Do not call this `TouchTipParams`, because that class name is used by the
# unrelated touchTip command in PE. Both classes are exported to things like the
# command schema JSON files, so the classes can't have the same name.

zOffset: _Number = Field(
...,
description="Offset from the top of the well for touch-tip, in millimeters.",
Expand All @@ -101,14 +105,14 @@ class TouchTipProperties(BaseModel):
"""Shared properties for the touch-tip function."""

enable: bool = Field(..., description="Whether touch-tip is enabled.")
params: Optional[TouchTipParams] = Field(
params: Optional[LiquidClassTouchTipParams] = Field(
None, description="Parameters for the touch-tip function."
)

@validator("params")
def _validate_params(
cls, v: Optional[TouchTipParams], values: Dict[str, Any]
) -> Optional[TouchTipParams]:
cls, v: Optional[LiquidClassTouchTipParams], values: Dict[str, Any]
) -> Optional[LiquidClassTouchTipParams]:
if v is None and values["enable"]:
raise ValueError(
"If enable is true parameters for touch tip must be defined."
Expand Down

0 comments on commit 112ea83

Please sign in to comment.