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
620
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
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
290
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
130
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
520
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
1.1k
実践サーバーレスパフォーマンスチューニング ~その実力に迫る~ / Practical Serverless Performance Tuning ~A Close Look at its Power~
seike460
PRO
2
350
PHPを書く理由、PHPを書いていて良い理由 / Reasons to write PHP and why it is good to write PHP
seike460
PRO
5
600
AWS CDKを用いたセキュアなCI/CDパイプラインの構築 / Build a secure CI/CD pipeline using AWS CDK
seike460
PRO
3
760
いまあるチームにフィットさせる Serverless そして Platform Engineeringへの挑戦 / Serverless Fits the Team You Have and Platform Engineering
seike460
PRO
2
2.1k
いまあるチームにフィットさせる Serverless / Serverless fits in with the team you have now.
seike460
PRO
2
180
Other Decks in Programming
See All in Programming
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
2
230
42 best practices for Symfony, a decade later
tucksaun
1
180
Jakarta EE meets AI
ivargrimstad
0
240
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
190
Haze - Real time background blurring
chrisbanes
1
510
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
3
470
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
540
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
130
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
3
690
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
140
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Fireside Chat
paigeccino
34
3.1k
Typedesign – Prime Four
hannesfritz
40
2.4k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Bash Introduction
62gerente
608
210k
Designing Experiences People Love
moore
138
23k
Six Lessons from altMBA
skipperchong
27
3.5k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Designing for humans not robots
tammielis
250
25k
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/
͝ਗ਼ௌ͍͖ͨͩ͋Γ͕ͱ͏͍͟͝·ͨ͠