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
540
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
AWS X-Rayを利用したサーバーレスのパフォーマンス分析 / Serverless performance analysis using AWS X-Ray
seike460
PRO
2
26
Cloudflare Workers x AWS Lambdaの組み合わせユースケース / Cloudflare Workers x AWS Lambda Combination Use Case
seike460
PRO
2
390
技術力を高め合う “開けた”企業間コミュニティの形成 / Formation of an "open" inter-company community to enhance technological capabilities
seike460
PRO
1
77
有効な使い方を正しく理解して実装する PHP8.3の最新機能の「ウラ側」 / Understanding and Implementing Effective Usage Correctly The "Uraside" of PHP 8.3's Latest Features
seike460
PRO
1
120
有効な使い方を正しく理解して実装する PHP8.3の最新機能 / Proper understanding and implementation of effective usage Latest features in PHP 8.3
seike460
PRO
2
320
事例から見るサーバーレスの効果 / Serverless Effectiveness as Seen in Case Studies
seike460
PRO
1
110
Secure Serverless Architecture
seike460
PRO
2
610
地方こそサーバーレス、その意義に迫るサーバーレスPHP / Serverless PHP: The Rural Areas, and Why Serverless PHP Matters
seike460
PRO
2
210
サーバーレスらしさを意識した AWSにおける開発手法 / Development methodologies in AWS that are serverless-like
seike460
PRO
1
87
Other Decks in Programming
See All in Programming
令和トラベルにおけるLLM活用事例:社内ツール開発から得た学びと実践
ippo012
0
120
dotfiles について話したい #湘なんか
stefafafan
2
290
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
390
Some more adventure of Happy Eyeballs
coe401_
2
170
長期運用プロダクトの開発速度を維持し続けるためのリファクタリング実践例
wataruss
8
2.7k
Kotlin 2.0が与えるAndroid開発の進化
masayukisuda
1
270
私のEbitengineの第一歩
qt_luigi
0
440
Amazon Neptuneで始める初めてのグラフDB ー グラフDBを使う意味を考える ー
satoshi256kbyte
2
250
connect-go で面倒くささと戦う / 2024-08-27 #newmo_layerx_go
izumin5210
2
630
rails_girls_is_my_gate_to_join_the_ruby_commuinty
maimux2x
0
190
実践 Advanced CallKit 〜快適な通話の実現に向けて〜
mot_techtalk
3
120
【TID2024】模擬講義:プログラマと一緒にゲームをデザインしてみよう!
akatsukigames_tech
0
550
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
25
1.3k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
109
6.9k
Rebuilding a faster, lazier Slack
samanthasiow
78
8.6k
The Illustrated Children's Guide to Kubernetes
chrisshort
47
48k
GraphQLの誤解/rethinking-graphql
sonatard
65
9.8k
Principles of Awesome APIs and How to Build Them.
keavy
125
16k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.4k
What’s in a name? Adding method to the madness
productmarketing
PRO
21
3k
The Brand Is Dead. Long Live the Brand.
mthomps
53
37k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
24
600
Thoughts on Productivity
jonyablonski
66
4.2k
Testing 201, or: Great Expectations
jmmastey
36
7k
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/
͝ਗ਼ௌ͍͖ͨͩ͋Γ͕ͱ͏͍͟͝·ͨ͠