Skip to content

Commit

Permalink
fix anchor type def
Browse files Browse the repository at this point in the history
  • Loading branch information
elsholz committed Dec 28, 2023
1 parent bde68c5 commit c8c88e7
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions api/code/metroplanner_api/type_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ class Styling(BaseModel):
font_size: pydantic.confloat(gt=0.1, lt=10)


class Span(BaseModel):
coords: Point
width: NonNegativeIntOrFloat
height: NonNegativeIntOrFloat


class Label(BaseModel):
label_class: pydantic.constr(
pattern=(
Expand All @@ -71,8 +77,9 @@ class Label(BaseModel):
)
) = "right"
text: str
anchor: Anchor
styling: Optional[Styling]
## anchor: Anchor
anchor: Union[Span, Anchor]
styling: Optional[Styling] = None


class Marker(BaseModel):
Expand Down Expand Up @@ -103,12 +110,6 @@ class Line(BaseModel):
connections: List[Connection]


class Span(BaseModel):
coords: Point
width: NonNegativeIntOrFloat
height: NonNegativeIntOrFloat


class IndependentLabel(BaseModel):
## anchor: Anchor
anchor: Union[Span, Anchor]
Expand Down

0 comments on commit c8c88e7

Please sign in to comment.