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.3k
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
6
1.7k
OSS活動のススメ / oss-activities
gotok365
4
570
AWS CDKコントリビュートTIPS / aws-cdk-contribution-tips
gotok365
5
1.1k
S3バケットを高速で削除・空にするツール「cls3」 / s3-deletion-tool-cls3
gotok365
4
620
AWS CDKで コンテナイメージスキャンを行う 〜ECRとその他の方法〜 / cdk-container-image-scan
gotok365
2
1.1k
スタートアップでこそCDKが活きた〜生産性を向上できた5つの理由〜 / startup-cdk-productivity
gotok365
10
3.7k
AWS CDKで"使う"GoFデザインパターン 〜実際どうなの?〜 / GoF design patterns used with AWS CDK
gotok365
4
1.3k
AWS CDKで学ぶGoFデザインパターン〜IaCにもコード設計〜 / aws dev day cdk gof design patterns
gotok365
12
5k
CloudWatch複合アラームでELBの5XXをいい感じに検知しようとしたらうまくいかなかった話 / cloudwatch alarm elb 5xx
gotok365
0
3k
Other Decks in Programming
See All in Programming
エラーレスポンス設計から考える、0→1開発におけるGraphQLへの向き合い方
bicstone
4
600
Swiftコードバトル必勝法
toshi0383
0
140
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
370
仮想ファイルシステムを導入して開発環境のストレージ課題を解消する
segadevtech
2
400
BasicBasic認証
sadnessojisan
5
2.5k
Regular Expressions, REXML, Automata Learning
makenowjust
0
180
初めてのiOS関連GitHub ActionsをMarketplaceに公開するまでの実録
konifar
3
200
Go Code Generation at newmo / 2024-08-27 #newmo_layerx_go
genkey6
0
520
開発を加速する共有Swift Package実践
elmetal
PRO
0
300
ゲームボーイアドバンスでSwiftを動かそう
k_koheyi
0
510
1人で挑むSwiftコンパイラ 〜型システム入門編〜
s_shimotori
0
310
Meet BrowserEngineKit
swiftty
0
190
Featured
See All Featured
The Language of Interfaces
destraynor
153
23k
Infographics Made Easy
chrislema
239
18k
Into the Great Unknown - MozCon
thekraken
28
1.4k
Become a Pro
speakerdeck
PRO
22
4.8k
Building Applications with DynamoDB
mza
89
5.9k
Imperfection Machines: The Place of Print at Facebook
scottboms
263
13k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
52k
How To Stay Up To Date on Web Technology
chriscoyier
785
250k
Fireside Chat
paigeccino
31
2.9k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
24
2k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
225
22k
Building Your Own Lightsaber
phodgson
101
5.9k
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
ᶃجຊతͳόϦσʔγϣϯ
ᶃجຊతͳόϦσʔγϣϯ ܕ TUSJOH OVNCFS FUDʜ ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶃجຊతͳόϦσʔγϣϯ ࠷େ ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶃجຊతͳόϦσʔγϣϯ lEFWzͰ࢝·ͬͯ l4UBDLzͰऴΘΔ lHPUPlΛؚΉ ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶃجຊతͳόϦσʔγϣϯ Ҏ্ʢؚΉʣ ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶃجຊతͳόϦσʔγϣϯ ΑΓେ͖͍ ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶃجຊతͳόϦσʔγϣϯ ͷഒ ;PEεΩʔϚ ܕ TUBDLJOQVUUT
ᶃجຊతͳόϦσʔγϣϯ DPO fi HUT
ᶃجຊతͳόϦσʔγϣϯ Θ͟ͱΤϥʔʹ͢Δ
ᶃجຊతͳόϦσʔγϣϯ &SSPS7BMJEBUJPOGBJMFEXJUIUIFGPMMPXJOHFSSPST <TUBDLOBNF>\JTTVFT< \DPEFJOWBMJE@TUSJOH WBMJEBUJPO\TUBSUT8JUIEFW^ NFTTBHF*OWBMJEJOQVUNVTUTUBSUXJUIaEFWa QBUI<TUBDL/BNF>^ \DPEFJOWBMJE@TUSJOH WBMJEBUJPO\FOET8JUI4UBDL^
NFTTBHF*OWBMJEJOQVUNVTUFOEXJUIa4UBDLa QBUI<TUBDL/BNF>^ \DPEFJOWBMJE@TUSJOH WBMJEBUJPO\JODMVEFTHPUP^ NFTTBHF*OWBMJEJOQVUNVTUJODMVEFaHPUPa QBUI<TUBDL/BNF>^ \DPEFUPP@TNBMM NJOJNVN UZQFOVNCFS JODMVTJWFUSVF FYBDUGBM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 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 าͷςοΫ