Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Zodのデータ変換が便利すぎた。 しかし使いすぎで苦しくなっていった話
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Melonps
May 09, 2026
Technology
87
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Zodのデータ変換が便利すぎた。 しかし使いすぎで苦しくなっていった話
フロントエンドカンファレンス名古屋のLT登壇資料です。
Melonps
May 09, 2026
More Decks by Melonps
See All by Melonps
コーディングエージェントはTypeScriptの 型エラーをどう自己修正しているのか
melonps
4
810
さくらのAI Engineから始める クラウドネイティブ意識
melonps
0
320
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
720
OpenTelemetryで“見えるIoT”を目指したら クラウドネイティブの奥深さに直面した
melonps
0
95
LangChainについてのサーベイ
melonps
0
220
CloudSeed
melonps
0
200
Other Decks in Technology
See All in Technology
[Kiro Meetup #7] Kiro Crew Dive Deep
konippi
0
120
データ_AIの事業の勝敗をわけるもの
nek0128
1
470
開発投資の期待値を上げるプロダクトロードマップづくり ~プロダクトエンジニアが越境して事業を伸ばす~
kekekenta
1
240
アプリログインとWeb認証基盤をつなぐ ASWebAuthenticationSession 作法
shimastripe
1
370
ScotSecure West 2026 - Glasgow
raybugg
0
150
Why Agent Cost Needs Observability
nttcom
0
120
エージェントはローカル、検証はMicroVM — Lambda MicroVMsでつくるServerless CI
fujioka6789
3
660
越境するなら専門用語を使うな高校校歌 / If you wanna cross border, you shouldn't use jargon
vtryo
0
150
AIエージェントの権限管理 3: Agentic RAG の Fine grained access control 編
ren8k
0
180
AIエージェントを最高のパートナーに育てる方法|評価と判断軸を育てる5つのステップ
koichiaoki
1
160
10Xに技術的負債をもたらした「2つの境界の歪み」その構造と解消への営み
10xinc
0
2.3k
SREの視点で考えるSIEM活用術 〜AWS環境でのセキュリティ強化〜
cscengineer
PRO
0
160
Featured
See All Featured
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Bash Introduction
62gerente
615
220k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
460
Practical Orchestrator
shlominoach
192
12k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
500
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
Chasing Engaging Ingredients in Design
codingconduct
0
320
[RailsConf 2023] Rails as a piece of cake
palkan
59
7k
Transcript
Zodのデータ変換が便利すぎた。 しかし使いすぎで苦しくなっていった話 パナソニック エレクトリックワークス株式会社 筧 万里 1 フロントエンドカンファレンス名古屋 2026 LT
自己紹介 2 BANRI KAKEHI(@Melonps_) ◦ 家庭用燃料電池「エネファーム」のSRE ◦ クラウドネイティブ会議実行委員 ◦ Yamada
UIのメンテナー エネファーム
スキーマ定義にどこまで書くか? ◎Zodで型定義とバリデーションと両立させて使う形が多い 3 const UserSchema = z.object({ name: z.string(), age:
z.number().min(0), email: z.email(), }); const result = UserSchema.safeParse({ name: "太郎", age: 1000, email: "
[email protected]
", }); console.log(result.success, result.data) スキーマ定義(TS) パースによるランタイムでの検証 APIレスポンスの検証やフォーム入力制御で活躍
データ変換ツールとしても進化してきた .transform():バリデーション後に型変換 4 const NameLengthSchema = z.string().transform((val) => val.length); type
Input = z.input<typeof NameLengthSchema>; type Output = z.output<typeof NameLengthSchema>; .pipe():変換後の値に再バリデーション const SafeStringToNumber = z.string() .transform((value) => Number(value)) .pipe(z.number().min(0).max(100)); numberが確定 0~100が確定
何でこれが苦しくなるの? 5 データ変換を使い倒して 便利だった実装と苦しくなっていった実装
便利だった 便利だった実装:APIレスポンスの入り口 6 const EventSchema = z.object({ startAt: z.iso.datetime().transform((val) =>
new Date(val)), endAt: z.iso.datetime().transform((val) => new Date(val)), }).refine((data) => data.endAt.getTime() > data.startAt.getTime(), { message: "終了時刻は開始時刻より後に設定してください", path: ["endAt"], }); ◎APIから得たデータの論理と型の検証をする 論理の保証 ルールの整備がないままtransform化が進んでいった Date型へ変換
苦しくなった const EventSchema = z.object({ startAt: z.iso.datetime().transform((val) => new Date(val)),
endAt: z.iso.datetime().transform((val) => new Date(val)), attendees: z.array(z.object({ name: z.string(), role: z.string() })), }).transform((event) => ({ ...event, duration: event.endAt.getTime() - event.startAt.getTime(), activeAttendees: event.attendees.filter((a) => a.role !== "observer"), })); 苦しくなっていった実装 7 ◎データクレンジングや表示用の変換を持ち始めた →スキーマを追加するごとに、テストや議論が必要な状態に... 表示用の変換 useFormに渡す型はIn?Out? フィルタリング
どうすれば良かったのか? 8 ビジネスロジック ◎外部の不確実性から守るため、スキーマを境界の入り口とするべき ◦ 複数の境界をまたぐ変換は不適切 ◦ 同じ境界の中であれば、関数に切り出すべき Functional Core
Mutable Shell
こう整理して挑戦中です 9 ◎スキーマを定義する前のチェックリスト リファクタ案やブランド型の話もしたかった... ◦ ①:「何と何の境界」を担っているか説明できるか? ◦ ②:外→内への境界か、内→内への境界か?(後者なら関数に切り出す) ◦ ③:一つだけの境界を対象としているか?
ご清聴ありがとうございました!
None