Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AWS CDKとZodを活用したバリデーションパターン集 / validation patte...
Search
k.goto
May 18, 2023
Programming
7
3.4k
AWS CDKとZodを活用したバリデーションパターン集 / validation patterns with cdk and zod
2023/05/20開催「AWS CDK Conference Japan 2023」での発表資料です。
k.goto
May 18, 2023
Tweet
Share
More Decks by k.goto
See All by k.goto
AWS CDKにおける「再利用性」を考える / aws-cdk-reusability
gotok365
7
2.2k
OSS活動のススメ / oss-activities
gotok365
4
740
AWS CDKコントリビュートTIPS / aws-cdk-contribution-tips
gotok365
5
1.3k
S3バケットを高速で削除・空にするツール「cls3」 / s3-deletion-tool-cls3
gotok365
4
720
AWS CDKで コンテナイメージスキャンを行う 〜ECRとその他の方法〜 / cdk-container-image-scan
gotok365
2
1.3k
スタートアップでこそCDKが活きた〜生産性を向上できた5つの理由〜 / startup-cdk-productivity
gotok365
13
3.9k
AWS CDKで"使う"GoFデザインパターン 〜実際どうなの?〜 / GoF design patterns used with AWS CDK
gotok365
4
1.5k
AWS CDKで学ぶGoFデザインパターン〜IaCにもコード設計〜 / aws dev day cdk gof design patterns
gotok365
12
5.8k
CloudWatch複合アラームでELBの5XXをいい感じに検知しようとしたらうまくいかなかった話 / cloudwatch alarm elb 5xx
gotok365
0
3.3k
Other Decks in Programming
See All in Programming
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
720
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
Symfony Mapper Component
soyuka
2
730
良いユニットテストを書こう
mototakatsu
5
2k
Zoneless Testing
rainerhahnekamp
0
120
Beyond ORM
77web
3
460
Haze - Real time background blurring
chrisbanes
1
510
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
240
CSC305 Lecture 25
javiergs
PRO
0
130
Jakarta EE meets AI
ivargrimstad
0
240
선언형 UI에서의 상태관리
l2hyunwoo
0
150
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
YesSQL, Process and Tooling at Scale
rocio
169
14k
It's Worth the Effort
3n
183
28k
Become a Pro
speakerdeck
PRO
26
5k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Why Our Code Smells
bkeepers
PRO
335
57k
Practical Orchestrator
shlominoach
186
10k
Designing Experiences People Love
moore
138
23k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Optimizing for Happiness
mojombo
376
70k
Transcript
LHPUP าͷςοΫ "84$%,ͱ;PEΛ׆༻ͨ͠ όϦσʔγϣϯύλʔϯू "84$%,$POGFSFODF+BQBO
ࣗݾհ LHPUP w ςοΫϦʔυɾϥʔϝϯ͖ w "84$PNNVOJUZ#VJMEFS %FW5PPMT w าͷςοΫ
ٕज़ϒϩά w ࣗ࡞"84ؔ࿈πʔϧͷ044։ൃ w 5XJUUFS!@TUFQ@UFDI ‣ LHPUP าͷςοΫ
લఏ w $%,5ZQF4DSJQUͰ࣮͍ͯ͠·͢ w όʔδϣϯ ‣ /PEFKT ‣ 5ZQF4DSJQU ‣
"84$%,
;PEͱʁ
;PEͱʁ w 5ZQF4DSJQUͷόϦσʔγϣϯπʔϧ ‣ ϦΫΤετͳͲͷΦϒδΣΫτใΛɺఆٛͨ͠UZQFͷΦϒδΣΫτʹύʔε͢Δ λΠϛϯάͰɺఆٛͨ͠ϧʔϧʹج͍ͮͯόϦσʔγϣϯΛߦ͑Δπʔϧ ‣ 5ZQF ܕ ఆٛͱಉ͡ϑΝΠϧͰόϦσʔγϣϯϧʔϧ͕ॻ͚Δ
;PEͱʁ ɾܕνΣοΫOVNCFS TUSJOH BSSBZʜ ɾΦϓγϣφϧνΣοΫPQUJPOBM ɾۭจࣈνΣοΫNJO ɾ&NBJMܗࣜνΣοΫFNBJM
ɾFUDʜ
$%,ͰόϦσʔγϣϯʁ
$%,ͰόϦσʔγϣϯʁ IUUQTTQFBLFSEFDLDPNHPUPLDELWBMJEBUJPO
BEE7BMJEBUJPO IUUQTEPDTBXTBNB[PODPNDELBQJWEPDT DPOTUSVDUT/PEFIUNMBEEXCSWBMJEBUJPOWBMJEBUJPO ͨ͠όϦσʔγϣϯ͕ DELTZOUI࣌ʹΓ·͢
JOUFSGBDF*7BMJEBUJPO IUUQTEPDTBXTBNB[PODPNDELBQJWEPDTDPOTUSVDUT*7BMJEBUJPOIUNM
ݺͼग़ؔ͠ ͜ΕΛ࡞ͯ͠ όϦσʔγϣϯϧʔϧΛ࣮ .Z7BMJEBUPSͷΠϯελϯεΛੜ UIJTOPEFBEE7BMJEBUJPOʹ͢
ॻ͍ͯΈͨ 7BMJEBUPS w ྫʣ8"'ͷϦʔδϣϯͱείʔϓͷΈ߹ΘͤͷόϦσʔγϣϯ ˞BEE7BMJEBUJPJO͠ͳͯ͘DELEFQMPZ࣌ʹΤϥʔʹͳΔྫͰ͕͢ɺ͋͘·ͰྫͰ͢
ॻ͍ͯΈͨ 4UBDL w ελοΫΫϥεͰόϦσʔγϣϯ 7BMJEBUPS Λ͢ ͨͬͨߦʂ *GUSZ UISPXOFX&SSPS ͱ͔͍Βͳ͍ʂ
࣮ߦͯ͠Έͨ DELTZOUI .Z7BMJEBUPSWBMJEBUF Ͱ SFHJPO͕zVTFBTUzͰͳ͍ͱΤϥʔʹ͢ΔΑ͏όϦσʔγϣϯͯ͋͠Δ &SSPS7BMJEBUJPOGBJMFEXJUIUIFGPMMPXJOHFSSPST <$EL"EE7BMJEBUJPO4UBDL>3FHJPONVTUCFVTFBTUXIFO$-06%'30/5
ෳΤϥʔͷݕ w Γ͕TUSJOH<>ͳͷͰɺෳͷΤϥʔΛݕɾग़ྗͰ͖Δ &SSPS7BMJEBUJPOGBJMFEXJUIUIFGPMMPXJOHFSSPST <$EL"EE7BMJEBUJPO4UBDL>5FTU&SSPS <$EL"EE7BMJEBUJPO4UBDL>5FTU&SSPS ʢ༻ྫʣ ελοΫʹͨ͠֎෦ύϥϝʔλ Ͱҧͨ͠ύϥϝʔλΛશ෦ग़ྗ
"84$%,ͱ;PEΛ׆༻ͨ͠ όϦσʔγϣϯύλʔϯूʁ
$%,ͷ7BMJEBUJPOʹ ;PEΛ׆༻ͯ͠Έ·ͨ͠
ίʔυߏ MJC ᵓᴷᴷBQQSVOOFSTQFDUZQFUT ᵓᴷᴷDEL[PEWBMJEBUJPOQBUUFSOTTUBDLUT ᵓᴷᴷDPO fi HUT ᵓᴷᴷTUBDLJOQVUUT ᵋᴷᴷTUBDLWBMJEBUPSUT ࠷ޙʹͭ͢
ελοΫΫϥε 7BMJEBUPSΫϥε ελοΫʹ͢όϦσʔτରύϥϝʔλ ;PEͰεΩʔϚఆٛ
ελοΫΫϥε 7BMJEBUPSͷΠϯελϯεΛੜͯ͠ BEE7BMJEBUJPOʹ͢
7BMJEBUPSΫϥε ;PEͰόϦσʔτ TUBDL*OQVU4DIFNBม͕ޙͰ ఆٛ͢Δ;PEεΩʔϚม
;PEεΩʔϚ ܕ UZQF εΩʔϚ͔Βύϥϝʔλ༻ DPO fi Hͷܕ͕ు͚Δʂ όϦσʔγϣϯϧʔϧ
DPOGJH ύϥϝʔλ ;PEεΩʔϚ͔Β ు͍ͨܕΛ͍ճ͠
͔͜͜Β
࣮ࡍͷόϦσʔγϣϯύλʔϯ ʹೖΓ·͢
;PEεΩʔϚͱDPOGJHΛ ม͍͖͑ͯ·͢ ʢελοΫΫϥεͱ7BMJEBUPSΫϥεݻఆʣ
όϦσʔγϣϯύλʔϯ w ᶃجຊతͳόϦσʔγϣϯ w ᶄศརͳόϦσʔγϣϯ w ᶅਖ਼نදݱͳόϦσʔγϣϯ w ᶆΧελϜͳόϦσʔγϣϯ DVTUPN
w ᶇΧελϜͳόϦσʔγϣϯ SF fi OF
ᶃجຊతͳόϦσʔγϣϯ
ᶃجຊ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F NFTTBHF/VNCFSNVTUCFHSFBUFSUIBO QBUI <DQV>^ > OBNF;PE&SSPS^ DELTZOUI
ᶄศརͳόϦσʔγϣϯ
ᶄศརͳόϦσʔγϣϯ 63-ܗࣜ ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶄศརͳόϦσʔγϣϯ &.BJMܗࣜ ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶄศརͳόϦσʔγϣϯ *1ܗࣜ *1W *1WͲͪΒରԠ ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶄศརͳόϦσʔγϣϯ DPO fi HUT
ᶄศརͳόϦσʔγϣϯ Θ͟ͱΤϥʔʹ͢Δ
ᶄศརͳόϦσʔγϣϯ &SSPS7BMJEBUJPOGBJMFEXJUIUIFGPMMPXJOHFSSPST <EFWBQQHPUP$EL;PE7BMJEBUJPO1BUUFSOT4UBDL>\JTTVFT< \WBMJEBUJPOVSM DPEFJOWBMJE@TUSJOH NFTTBHF*OWBMJEVSM QBUI<JODPNJOH8FCIPPL6SM>^ \WBMJEBUJPOFNBJM DPEFJOWBMJE@TUSJOH
NFTTBHF*OWBMJEFNBJM QBUI<TFOEFS"EESFTT>^ \WBMJEBUJPOJQ DPEFJOWBMJE@TUSJOH NFTTBHF*OWBMJEJQ QBUI<JQ8IJUF-JTU >^ \WBMJEBUJPOJQ DPEFJOWBMJE@TUSJOH NFTTBHF*OWBMJEJQ QBUI<JQ8IJUF-JTU >^ > OBNF;PE&SSPS^ DELTZOUI
ᶅਖ਼نදݱͳόϦσʔγϣϯ
ᶅਖ਼نදݱͳόϦσʔγϣϯ ਖ਼نදݱDSPO ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶅਖ਼نදݱͳόϦσʔγϣϯ ਖ਼نදݱ"3/ 4/45PQJD ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶅਖ਼نදݱͳόϦσʔγϣϯ ਖ਼نදݱ"3/ ౦ژϦʔδϣϯͷ4/45PQJD ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶅਖ਼نදݱͳόϦσʔγϣϯ ਖ਼نදݱ"3/ 4όέοτˡӳࣈখจࣈͱ͔ ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶅਖ਼نදݱͳόϦσʔγϣϯ DPO fi HUT
ᶅਖ਼نදݱͳόϦσʔγϣϯ Θ͟ͱΤϥʔʹ͢Δ
ᶅਖ਼نදݱͳόϦσʔγϣϯ &SSPS7BMJEBUJPOGBJMFEXJUIUIFGPMMPXJOHFSSPST <EFWBQQHPUP$EL;PE7BMJEBUJPO1BUUFSOT4UBDL>\JTTVFT< \WBMJEBUJPOSFHFY DPEFJOWBMJE@TUSJOH NFTTBHF*OWBMJE QBUI<TDIFEVMF&YQSFTTJPO>^ \WBMJEBUJPOSFHFY DPEFJOWBMJE@TUSJOH
NFTTBHF*OWBMJE QBUI<TOT5PQJD"SO>^ \WBMJEBUJPOSFHFY DPEFJOWBMJE@TUSJOH NFTTBHF*OWBMJE QBUI<TOT5PQJD5PLZP"SO>^ \WBMJEBUJPOSFHFY DPEFJOWBMJE@TUSJOH NFTTBHF*OWBMJE QBUI<CVDLFU"SO>^ > OBNF;PE&SSPS^ DELTZOUI
ᶆΧελϜͳόϦσʔγϣϯ DVTUPN
ᶆΧελϜͳόϦσʔγϣϯ DVTUPN ࣗલͷܕఆٛ ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶆΧελϜͳόϦσʔγϣϯ DVTUPN DPO fi HUT
ᶆΧελϜͳόϦσʔγϣϯ DVTUPN ΤσΟλͰܕΤϥʔݕ εϖʔε࿙Ε
ᶆΧελϜͳόϦσʔγϣϯ DVTUPN ΤσΟλͰΧʔιϧͯΔͱܕใग़ྗ
ᶇΧελϜͳόϦσʔγϣϯ SFGJOF
ᶇΧελϜͳόϦσʔγϣϯ SFGJOF ࠨɿೖྗՄೳͷεΩʔϚఆٛɿVOJPO ӈɿΧελϜͳόϦσʔγϣϯϩδοΫ εϖοΫΈ߹Θͤ ఆٛSF fi OF ;PEεΩʔϚ ܕ
BQQSVOOFSTQFDUZQFUT
ᶇΧελϜͳόϦσʔγϣϯ SFGJOF ΧελϜϩδοΫΛఆٛ SF fi OF ͨ͠εΩʔϚΛࢦఆ ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶇΧελϜͳόϦσʔγϣϯ SFGJOF DPO fi HUT
ᶇΧελϜͳόϦσʔγϣϯ SFGJOF ΤσΟλͰΧʔιϧͯΔͱೖྗՄೳ͕ग़ྗ SF fi OFͰͳ͘VOJPOͷػೳ
ᶇΧελϜͳόϦσʔγϣϯ SFGJOF ΤσΟλͰೖྗͷิ͕Մೳ SF fi OFͰͳ͘VOJPOͷػೳ
ᶇΧελϜͳόϦσʔγϣϯ SFGJOF Θ͟ͱҧ͢ΔΈ߹ΘͤΛఆٛ
ᶇΧελϜͳόϦσʔγϣϯ SFGJOF &SSPS7BMJEBUJPOGBJMFEXJUIUIFGPMMPXJOHFSSPST <EFWBQQHPUP$EL;PE7BMJEBUJPO1BUUFSOT4UBDL>\JTTVFT< \DPEFDVTUPN NFTTBHF*OWBMJE$16BOE.FNPSZDPNCJOBUJPO QBUI<BQQ3VOOFS4QFD>^ > OBNF;PE&SSPS^ DELTZOUI
SF fi OFʹΑΔΧελϜͳόϦσʔγϣϯʂ
όϦσʔγϣϯύλʔϯ w ᶃجຊతͳόϦσʔγϣϯ w ᶄศརͳόϦσʔγϣϯ w ᶅਖ਼نදݱͳόϦσʔγϣϯ w ᶆΧελϜͳόϦσʔγϣϯ DVTUPN
w ᶇΧελϜͳόϦσʔγϣϯ SF fi OF
"84$%,ͱ;PEͰ όϦσʔγϣϯ͍͖ͯ͠·͠ΐ͏
ࢀߟɿ(JU)VC ࠓͷίʔυ w DEL[PEWBMJEBUJPOQBUUFSOT ‣ IUUQTHJUIVCDPNHPUPLDEL[PEWBMJEBUJPOQBUUFSOT
ࢀߟɿϒϩάهࣄ าͷςοΫ w "84$%,ͰόϦσʔγϣϯΛߦ͏ BEE7BMJEBUJPO ‣ IUUQTHPUPLIBUFOBCMPHDPNFOUSZDELBEEWBMJEBUJPO w 5ZQF4DSJQUͷ$%,ελοΫΛ;PEͰόϦσʔγϣϯ͢Δ
‣ IUUQTHPUPLIBUFOBCMPHDPNFOUSZUTDEL[PEWBMJEBUJPO w $%,ͷ֎෦ύϥϝʔλʹܕ͚ͩͰͳ੍͔͚͘Δ ‣ IUUQTHPUPLIBUFOBCMPHDPNFOUSZDELQBSBNFUFSUZQFWBMJEBUJPO
એɿࣗ࡞"84ؔ࿈πʔϧ044 w EFMTUBDL"84$MPVE'PSNBUJPOελοΫڧ੍আπʔϧ ‣ IUUQTHPUPLIBUFOBCMPHDPNFOUSZEFMTUBDL w DMT4όέοτߴআɾۭʹ͢Δπʔϧ όʔδϣχϯάରԠ ‣
IUUQTHPUPLIBUFOBCMPHDPNFOUSZDMT w MBNWFS-BNCEBϥϯλΠϜόʔδϣϯݕࡧπʔϧ Ϧʔδϣϯԣஅ ‣ IUUQTHPUPLIBUFOBCMPHDPNFOUSZMBNWFS
એɿొஃ w ݄ +"846(43&ࢧ෦ ‣ ʰ$MPVE8BUDIෳ߹ΞϥʔϜͰ&-#ͷ99Λॏෳͳ͠ݕ͠Α͏ͱͨ͠Β͏·͘ ͍͔ͳ͔ͬͨʱ w
d"84%FW%BZ5PLZP ࿈ଓ ‣ ʰ"84$%,ͰֶͿ(P'σβΠϯύλʔϯʙ*B$ʹίʔυઃܭʙʱ
5IBOL:PV LHPUP าͷςοΫ