Skip to content

fix: add zod transform to rename "round" to "circle" in pcb_hole#576

Open
64johnlee wants to merge 25 commits into
tscircuit:mainfrom
64johnlee:fix/issue-42
Open

fix: add zod transform to rename "round" to "circle" in pcb_hole#576
64johnlee wants to merge 25 commits into
tscircuit:mainfrom
64johnlee:fix/issue-42

Conversation

@64johnlee
Copy link
Copy Markdown

Fix #42

Add backward-compatible transform in pcb_hole_circle_or_square schema to accept legacy round value and convert it to circle, matching the original fix that was lost during the refactoring in commit e3e5a38.

Changes:

  • Added .enum(["circle", "square", "round"]).default("circle").transform(...) to hole_shape field in pcb_hole_circle_or_square
  • When round is passed, it is automatically converted to circle
  • Exported pcb_hole_circle_or_square schema for direct use

Tests added:

  • pcb_hole_circle_or_square accepts "circle" shape
  • pcb_hole_circle_or_square accepts "square" shape
  • pcb_hole_circle_or_square transforms "round" to "circle"

All 219 tests pass, format clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rename pcb_hole.hole_shape "round" to "circle". Add a zod transform to correctly handle old data

1 participant