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
400
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
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
190
Zoneless Testing
rainerhahnekamp
0
120
103 Early Hints
sugi_0000
1
230
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
100
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
170
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
Go の GC の不得意な部分を克服したい
taiyow
3
790
たのしいparse.y
ydah
3
120
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
250
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
480
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Code Reviewing Like a Champion
maltzj
520
39k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Thoughts on Productivity
jonyablonski
67
4.4k
Side Projects
sachag
452
42k
Mobile First: as difficult as doing things right
swwweet
222
9k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
Documentation Writing (for coders)
carmenintech
66
4.5k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
5
450
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
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/
͝ਗ਼ௌ͍͖ͨͩ͋Γ͕ͱ͏͍͟͝·ͨ͠