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
570
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
実践サーバーレスパフォーマンスチューニング ~その実力に迫る~ / Practical Serverless Performance Tuning ~A Close Look at its Power~
seike460
PRO
2
150
PHPを書く理由、PHPを書いていて良い理由 / Reasons to write PHP and why it is good to write PHP
seike460
PRO
5
470
AWS CDKを用いたセキュアなCI/CDパイプラインの構築 / Build a secure CI/CD pipeline using AWS CDK
seike460
PRO
3
620
いまあるチームにフィットさせる Serverless そして Platform Engineeringへの挑戦 / Serverless Fits the Team You Have and Platform Engineering
seike460
PRO
2
1.5k
いまあるチームにフィットさせる Serverless / Serverless fits in with the team you have now.
seike460
PRO
2
140
地方こそサーバーレス! チームにフィットさせるサーバーレス / Rural areas are serverless! Serverless to Fit Your Team
seike460
PRO
1
93
AWS X-Rayを利用したサーバーレスのパフォーマンス分析 / Serverless performance analysis using AWS X-Ray
seike460
PRO
2
140
Cloudflare Workers x AWS Lambdaの組み合わせユースケース / Cloudflare Workers x AWS Lambda Combination Use Case
seike460
PRO
2
440
技術力を高め合う “開けた”企業間コミュニティの形成 / Formation of an "open" inter-company community to enhance technological capabilities
seike460
PRO
1
81
Other Decks in Programming
See All in Programming
Re:PandasAI:生成AIがデータ分析業務にもたらすパラダイムシフト【増補改訂版】
negi111111
1
1k
Quarto Clean Theme
nicetak
0
220
Kubernetes上でOracle_Databaseの運用を楽にするOraOperatorの紹介
nnaka2992
0
150
Vue :: Better Testing 2024
up1
1
400
文化が生産性を作る
jimpei
3
570
.NET Aspireのクラウド対応検証: Azureと他環境での実践
ymd65536
1
510
もう実家に手頃な情シス娘は不要!Bedrockでもう一人の娘を作る
komakichi
0
110
C#および.NETに対する誤解をひも解く
ymd65536
0
290
データマイグレーションの成功戦略~サービスリニューアルで失敗しないための実践ガイド~
tkzwtks
8
720
perl for shell, awk and sed programmers
mackee
1
720
Subclassing, Composition, Python, and You
hynek
3
170
複数プロダクトの技術改善・クラウド移行に向き合うチームのフレキシブルなペア・モブプログラミングの実践 / Flexible Pair Programming And Mob Programming
honyanya
0
230
Featured
See All Featured
WebSockets: Embracing the real-time Web
robhawkes
59
7.3k
Git: the NoSQL Database
bkeepers
PRO
425
64k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
105
48k
KATA
mclloyd
27
13k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.8k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
92
16k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Learning to Love Humans: Emotional Interface Design
aarron
272
40k
Navigating Team Friction
lara
183
14k
Art, The Web, and Tiny UX
lynnandtonic
296
20k
Web development in the modern age
philhawksworth
205
10k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
10
1.5k
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/
͝ਗ਼ௌ͍͖ͨͩ͋Γ͕ͱ͏͍͟͝·ͨ͠