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
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Dev...
Search
shiro seike
PRO
April 16, 2024
Programming
3
640
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
Postman API Night Fukuoka 2024 Spring
https://postman.connpass.com/event/309419/
shiro seike
PRO
April 16, 2024
Tweet
Share
More Decks by shiro seike
See All by shiro seike
(再)ひとり技術広報からの脱却 / Re:Breaking away from one-man technical public relations
seike460
PRO
1
88
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
770
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
240
AWS reInvent 2024サービスアップデートデモ / AWS reInvent 2024 Service Update Demo
seike460
PRO
0
36
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
590
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
1.2k
実践サーバーレスパフォーマンスチューニング ~その実力に迫る~ / Practical Serverless Performance Tuning ~A Close Look at its Power~
seike460
PRO
2
370
PHPを書く理由、PHPを書いていて良い理由 / Reasons to write PHP and why it is good to write PHP
seike460
PRO
5
630
AWS CDKを用いたセキュアなCI/CDパイプラインの構築 / Build a secure CI/CD pipeline using AWS CDK
seike460
PRO
3
780
Other Decks in Programming
See All in Programming
ESLintプラグインを使用してCDKのセオリーを適用する
yamanashi_ren01
2
240
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.4k
.NETでOBS Studio操作してみたけど…… / Operating OBS Studio by .NET
skasweb
0
120
混沌とした例外処理とエラー監視に秩序をもたらす
morihirok
13
2.3k
『改訂新版 良いコード/悪いコードで学ぶ設計入門』活用方法−爆速でスキルアップする!効果的な学習アプローチ / effective-learning-of-good-code
minodriven
28
4.2k
rails newと同時に型を書く
aki19035vc
5
710
Jaspr Dart Web Framework 박제창 @Devfest 2024
itsmedreamwalker
0
150
Fixstars高速化コンテスト2024準優勝解法
eijirou
0
190
情報漏洩させないための設計
kubotak
5
1.3k
カンファレンス動画鑑賞会のススメ / Osaka.swift #1
hironytic
0
170
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
300
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
420
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
182
22k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
How STYLIGHT went responsive
nonsquared
96
5.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
500
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.4k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Transcript
©Fusic Co., Ltd. 1 OpenAPIΛத৺ʹߟ͑ΔAPI։ൃೖ 2024.04.16 ਗ਼Ո࢙ @seike460 Postman API
Night Fukuoka 2024 Spring
©Fusic Co., Ltd. 2 ਗ਼Ո ࢙ @seike460 AWS Community Builder
Serverless - ίϛϡχςΟ - Fukuoka.php - Fukuoka.go - JAWS-UG Fukuoka - Serverless Meetup Fukuoka - Cloudflare Meetup Fukuoka - JP_Stripes Fukuoka ࣗݾհ ͡Ίʹ גࣜձࣾFusic ϓϦϯγύϧΤϯδχΞ/ΤόϯδΣϦετ
©Fusic Co., Ltd. 3 CONTENTS ࣍ 1. OpenAPIͱ 2. OpenAPIಋೖͷ͖͔͚ͬ
3. OpenAPI GeneratorʹΑΔίʔυࣗಈੜ 4. PostmanΛར༻ͨ͠RequestͱMock 5. ·ͱΊ
©Fusic Co., Ltd. 4 OpenAPIͱ 1
©Fusic Co., Ltd. 5 OpenAPIͱ - RESTful API༷Λهड़͢ΔͨΊͷۀքඪ४ - ※ݱࡏv3ͰͦΖͦΖv4ϦϦʔε༧ఆ
- ݩʑSwagger (v2)ͱͯ͠ΒΕ͍ͯͨ - JSON·ͨYAMLͰAPIͷΤϯυϙΠϯτͱૢ࡞Λఆٛ
©Fusic Co., Ltd. 6 OpenAPI Toolsͷओͳར - APIͷՄࢹੑͱཧղͷ্ - ίʔυੜπʔϧΛ௨ͨ͡։ൃͷՃ
- ςετͱυΩϡϝϯτͷࣗಈੜ
©Fusic Co., Ltd. 7 OpenAPIಋೖͷ͖͔͚ͬ 2
©Fusic Co., Ltd. 8 OpenAPI ಋೖͷ͖͔͚ͬ - ϊΠΤετ߹ಉձ༷ࣾͷެ։ࣄྫ - https://fusic.co.jp/works/47
- ҩֶݚڀ༻ͷಠࣗͷಛघղੳͷࣗಈԽ - ݚڀऀ༷͔Βͷղੳґཔʹରͯ͠ खಈղੳΛߦ͍ϨϙʔτఏڙΛߦ͍ͬͯͨ - ͜ͷղੳΛࣗಈԽ͢ΔߏஙΛߦͬͨ - ϑϧαʔόʔϨε x SaaSͱ͍͏ࣄྫ
©Fusic Co., Ltd. 9 ଘࡏͨ͠՝ Լه։ൃΛߦ͏ඞཁ͕͋ͬͨ - ReactͷϑϩϯτΤϯυ - PHP
LaravelͷόοΫΤϯυAPI ظؒͰߏஙΛྃ͢Δඞཁ͕͋Γ ϑϩϯτΤϯυͱόοΫΤϯυΛׂͯ͠ ಉ࣌ฒߦͰ։ൃΛߦͬͨ APIͷ༷Λ࿈ܞ͢Δඞཁ͕͋Δ
©Fusic Co., Ltd. 10 OpenAPI Generator ͦ͜Ͱڞ௨ͷAPIͷ༷Λڞ༗͠ͳ͕Β ͞Βʹίʔυੜ͕ग़དྷΔ OpenAPI GeneratorΛར༻ͨ͠
ίʔυੜΛલఏͱͨ͠։ൃΛ࣮ࢪ API༷ͷमਖ਼͕ൃੜͨ࣌͠ɺ APIΠϯλʔϑΣʔεଈࠩ͠ସ͑Մೳʹ
©Fusic Co., Ltd. 11 OpenAPI GeneratorʹΑΔίʔυࣗಈੜ 3
©Fusic Co., Ltd. 12 OpenAPI v3ͷجຊߏͱهड़ํ๏ - OpenAPI Object -
ϧʔτυΩϡϝϯτ - Info Object - APIͷجຊใ - Servers Object - αʔόใͱڥ - Paths Object - ར༻Մೳͳύεͱૢ࡞ - Components Object - ࠶ར༻ՄೳͳεΩʔϚɺύϥϝʔλʔ
©Fusic Co., Ltd. 13 OpenAPI v3ͷجຊߏͱهड़ํ๏ - OpenAPI Object -
ϧʔτυΩϡϝϯτ - Info Object - APIͷجຊใ - Servers Object - αʔόใͱڥ - Paths Object - ར༻Մೳͳύεͱૢ࡞ - Components Object - ࠶ར༻ՄೳͳεΩʔϚɺύϥϝʔλʔ
©Fusic Co., Ltd. 14 OpenAPI v3ͷجຊߏͱهड़ํ๏ - OpenAPI Object -
ϧʔτυΩϡϝϯτ - Info Object - APIͷجຊใ - Servers Object - αʔόใͱڥ - Paths Object - ར༻Մೳͳύεͱૢ࡞ - Components Object - ࠶ར༻ՄೳͳεΩʔϚɺύϥϝʔλʔ
©Fusic Co., Ltd. 15 OpenAPI v3ͷجຊߏͱهड़ํ๏ - OpenAPI Object -
ϧʔτυΩϡϝϯτ - Info Object - APIͷجຊใ - Servers Object - αʔόใͱڥ - Paths Object - ར༻Մೳͳύεͱૢ࡞ - Components Object - ࠶ར༻ՄೳͳεΩʔϚɺύϥϝʔλʔ
©Fusic Co., Ltd. 16 OpenAPI v3ͷجຊߏͱهड़ํ๏ - OpenAPI Object -
ϧʔτυΩϡϝϯτ - Info Object - APIͷجຊใ - Servers Object - αʔόใͱڥ - Paths Object - ར༻Մೳͳύεͱૢ࡞ - Components Object - ࠶ར༻ՄೳͳεΩʔϚɺύϥϝʔλʔ
©Fusic Co., Ltd. 17 Dockerܦ༝ͰPHPίʔυͷੜ Docker͕ఏڙ͞Ε͍ͯΔͷͰ ఆٛͨ͠OpenAPIͷYamlΛಡΈࠐΈ ConfigΛར༻ͯ͠ίϚϯυΛ࣮ߦ PHPϑΝΠϧΛੜ
©Fusic Co., Ltd. 18 ੜͨ͠ϑΝΠϧΛར༻࣮ͯ͠ॲཧͷΈهड़ ੜ͞ΕͨPHP͕ ValidationܕνΣοΫΛ࣮ࢪ ҆શͳঢ়ଶͷϦΫΤετΛ ར༻ͨ͠υϝΠϯϩδοΫΛ࡞
©Fusic Co., Ltd. 19 OpenAPI React Query Codegen Fusicࣾһͷ @7nohe͕ެ։͍ͯ͠Δ
OSSΛར༻͠TanStack QueryΛੜ (چ React Query) Client෦ͷϦΫΤετ෦ શʹҠৡ͠·ͨ͠
©Fusic Co., Ltd. 20 OpenAPI React Query Codegen Fusicࣾһͷ @7nohe͕ެ։͍ͯ͠Δ
OSSΛར༻͠TanStack QueryΛੜ (چ React Query) Client෦ͷϦΫΤετ෦ શʹҠৡ͠·ͨ͠
©Fusic Co., Ltd. 21 OpenAPIΛհͯ͠ɺPHPͱReactΛܨ͙ OpenAPIΛհͯ͠ਐΊΔࣄͰɺ PHPͱReactͷؒͰਖ਼͍͠API༷Λڞ༗ ίʔυͷੜ·ͰҠৡͯ͠ API༷͕ζϨΑ͏ͷͳ͍ঢ়ଶʹ -
ϑϩϯτΤϯυ - ૹ৴͢ΔͨΊͷϦΫΤετͷੜ - όοΫΤϯυ - ϦΫΤετΛड৴ɺϨεϙϯεͷੜ
©Fusic Co., Ltd. 22 PostmanΛར༻ͨ͠RequestͱMock 4
©Fusic Co., Ltd. 23 PHPɿPostmanʹΑΔϦΫΤετͷੜ PHP։ൃதʹϦΫΤετΛड͚͍ͨ - React։ൃதͳͷͰૹ৴ग़དྷͳ͍ - Import
- OpenAPIͷYamlΛಡΈࠐ·ͤΔ - Request͕࣮ࡍʹ࣮ߦͰ͖Δ ։ൃΛ؆୯ʹՃͤ͞Δࣄ͕Մೳʹʂ
©Fusic Co., Ltd. 24 ReactɿPostmanʹΑΔmock server…Λར༻͔ͨͬͨ͠ React։ൃதʹϨεϙϯεΛड͚͍ͨ - PHP։ൃதͳͷͰड৴ग़དྷͳ͍ ʢ࣌ษڧෆͰΒͳ͔ͬͨ…ʣ
ఆٛΛݩʹMock ServerΛཱͯΕΔͷͰ PostmanͰ૬ޓͷΓऔΓΛ݁Մೳ ʢ࣮ࡍSwagger EditorͰ ɹMock ServerΛੜ͍ͯͨ͠ʣ
©Fusic Co., Ltd. 25 ReactɿPostmanʹΑΔmock server…Λར༻͔ͨͬͨ͠ React։ൃதʹϨεϙϯεΛड͚͍ͨ - PHP։ൃதͳͷͰड৴ग़དྷͳ͍ ʢ࣌ษڧෆͰΒͳ͔ͬͨ…ʣ
ఆٛΛݩʹMock ServerΛཱͯΕΔͷͰ PostmanͰ૬ޓͷΓऔΓΛ݁Մೳ ʢ࣮ࡍSwagger EditorͰ ɹMock ServerΛੜ͍ͯͨ͠ʣ
©Fusic Co., Ltd. 26 OpenAPI Firstͳ։ൃʹΑΓεϜʔζͳ։ൃ͕Մೳʹ OpenAPIΛར༻Λલఏʹͨ͜͠ͱͰAPIͷ༷ͷΈͰਐߦՄೳʹ PostmanΛར༻͓͠ޓ͍ͷ։ൃྃΛͨͣʹ૬ޓͷΓऔΓ͕Մೳʹ ͪΖΜલఏ͕ࣝඞཁʹͳΔ͠ɺ੍͋Δ OpenAPI
ToolsͱPostmanΛར༻ͨ͠։ൃΛબࢶʹ
©Fusic Co., Ltd. 27 ·ͱΊ 5
©Fusic Co., Ltd. 28 ·ͱΊ RESTful API༷Λهड़͢ΔͨΊͷۀքඪ४ͱͯ͠ͷOpen APIͱ͍͏༷͕͋Δ Point 01
Yaml·ͨJsonͰઃܭՄೳͳͷͰΤϯδχΞϑϨϯυϦʔͳOpenAPI Tools Point 02 ࠓճͷࣄྫͰPHPͱReactʹͯίʔυੜ͢Δ͜ͱͰυϝΠϯ෦͚ͩͷ։ൃʹूத Point 03 PostmanΛར༻͢Δ͜ͱͰ͞ΒͳΔޮԽΛ͔Δࣄ͕Մೳʹɺલఏ͕ࣝඞཁͳͷͰ͔ͬ͠Γֶश͕ඞཁʂ Point 04
©Fusic Co., Ltd. 29 Thank You We are Hiring! https://recruit.fusic.co.jp/
͝ਗ਼ௌ͍͖ͨͩ͋Γ͕ͱ͏͍͟͝·ͨ͠