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
SchemaDrivenDevelopment
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
atomiyama
March 24, 2021
Technology
470
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SchemaDrivenDevelopment
atomiyama
March 24, 2021
More Decks by atomiyama
See All by atomiyama
Rustでgemを作ろう
atomiyama
0
1.6k
ffi & native extension
atomiyama
0
280
技術選定で失敗したはなし
atomiyama
0
1.4k
はじめてのDocker
atomiyama
0
120
Other Decks in Technology
See All in Technology
老害フォレンジッカーはAI羊の夢を見るか?
tadmaddad
0
360
Flutter × BLE Centralを自前Pluginで実装する設計パターン - MethodChannel / EventChannelで作る双方向ブリッジの実践 / Building Custom Flutter BLE Central Plugins: Bidirectional Bridging with Method & Event Channels
bitkey
PRO
0
210
AIで変わるエンジニアの働き方(仮)
naoinaoi
0
290
Invisible to AI? Making TYPO3 Sites Quotable by AI Search Systems
wolfgangwagner
0
240
関東Kaggler会発表資料
takoi
1
280
生成 AI の基礎 〜 サンプル実装で学ぶ基本原理
enakai00
7
4.6k
AIに持続⼒を与える 判断の⻑期記憶設計
eiei114
1
500
DatadogのBits Chatが開発組織にもたらしたもの / What Bits Chat Has Brought Us
sms_tech
1
290
NANDでも描画したい!
nichica906
2
390
医療の現場を変革に挑戦した半年間の軌跡 - PythonとAIで現場を変える / From Code to Care
soudai
PRO
0
480
アクセスキーが漏れた日にやるべきこと- 無効化の先にある本当の対応
kazzpapa3
0
140
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
Featured
See All Featured
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
It's Worth the Effort
3n
188
29k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
390
Scaling GitHub
holman
464
140k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
210
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
410
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
Six Lessons from altMBA
skipperchong
29
4.5k
Transcript
Copyright 2018 Studyplus, Inc. All Rights Reserved. OpenAPIΛ༻͍ͨεΩʔϚۦಈ։ൃ Akifumi Tomiyama
/ Studyplus Inc . 2021.03.24 @γϡʔϚΠʂ
ࣗݾհ ✎ 2018/09~ Studyplusೖࣾ ✎ 29ࡀ ✎ ؠखݝࡏॅ ✎ ͖ͳݴޠɿRuby,
Rust ࢁথ࢙ Akifumi Tomiyama atomiyama atomiyama1216 Studyplus Inc. ForSchool Dept. CX Product Group Team Lead.
ձࣾհ About Us
MISSION ʮֶͿتͼΛͯ͢ͷਓʯ ଟ͘ͷਓ͕StudyplusΛ௨ֶͯ͡शͷ͖͔͚ͬΛݟ͚ͭɺ ֶशΛָ͘͠ܧଓͰ͖Δ͜ͱΛ࣮ݱ͢Δɻ
ֶशهͷՄࢹԽͱɺಉ͡ඪΛࢦؒ͢ͱͷSNSͰϞνϕʔγϣϯΛܧଓͰ͖·͢ɻ ΞϓϦϨϏϡʔฏۉ4.5Ҏ্ɻGoogle Play2࿈ଓϕετΞϓϦɺຊe-Learningେʢ࠷༏लʣͳͲडଟɻ ʮຖͷษڧΛश׳ʹͰ͖ͳ͍ʯΈΛղܾ
ࢀߟॻಡΈ์ΞϓϦͷϙϧτɺ डݧੜʹਓؾͷࢀߟॻΛֹ݄980ԁʢ੫ผʣͰεϚϗͰಡΈ์ͷɺిࢠࢀߟॻͷαϒεΫϦϓγϣϯαʔϏεͰ͢ɻ ਓؾࢀߟॻΛεϚϗͰಡΈ์ͷɺిࢠࢀߟॻΞϓϦ
Studyplus for Schoolɺڭҭػֶ͚ؔशཧαʔϏεͰ͢ɻ ੜెͷʑͷྗΛɺؾ͖ͮɺ๙ΊΔػೳΛଟἧ͍͑ͯ·͢ɻ SNSͷΑ͏ͳૢ࡞ײͰɺ ୭Ͱ͙͢ʹ͍͡ΊΒΕ·͢ɻ ઌੜ͕ੜెΛ๙ΊΔػձΛ࠷େԽ͢Δɺֶशक़ͷ৽͍͠ελϯμʔυ
OpenAPIΛ༻͍ͨεΩʔϚۦಈ։ൃ Schema Driven Development
͢͜ͱ • OpenAPI 3.0ͱcommitteeΛͬͨ։ൃͷ • εΩʔϚۦಈ։ൃͷྲྀΕ • εΩʔϚϑΝΠϧཧ • ࠓ๊͍͑ͯΔ՝
Studyplus for SchoolͷγεςϜ • APIαʔόʔ • Rails • ΫϥΠΞϯτ •
React • Elm • Next.js
Studyplus for Schoolͷ։ൃମ੍ • εΫϥϜ։ൃ • 9໊ମ੍ • 2week /
sprint • ։ൃϝϯόʔ • 6໊
Studyplus for Schoolͷ։ൃϑϩʔ ͜͜ΛظؒͰਐΊΔ
چ࣮ϑϩʔ ͜͜ͷͪ࣌ؒΛ࠷খԽ͢Δ ͜͜ͷखΓΛݮΒ͢
ݱߦͷ࣮ϑϩʔ API։ൃஈ֊ͰFBΛ ड͚Δ͜ͱ͕Ͱ͖ɼ खΓ͕গͳ͘ࡁΉ APIͷຊ࣮Λ ͨͣϑϩϯτ։ൃΛ ։࢝Ͱ͖Δ
͍ͬͯΔπʔϧ OpenAPI 3.0 REST APIΛఆٛ͢ΔͨΊඪ४༷ Swagger UI APIεΩʔϚͷ֬ೝ
Gems • committee ϦΫΤετɼϨεϙϯεόϦσʔγϣϯɼςετΞαʔγϣϯ • json_refs ෳϑΝΠϧཧ࣌ͷrefͷղܾ
Copyright (C) 2017 Studyplus, Inc. All Rights Reserved. Confidential APIઃܭ
APIεΩʔϚఆٛ • OpenAPIͷ༷ʹԊͬͯهड़ • yaml • ίϯτϩʔϥͷΞΫγϣϯʹ ରͯ͠1ϑΝΠϧͣͭʹׂ • ύϥϝʔλΤϥʔϨεϙϯ
εͳͲ࠶ར༻ՄೳͳΑ͏ʹ ڞ௨Խ
APIεΩʔϚఆٛϑΝΠϧཧ • main.yaml ΞϓϦέʔγϣϯͷఆٛʢೝূͳͲ • paths.yamlɼpath/* ΤϯυϙΠϯτͷఆٛ •
schemas.yaml, schemas/* ϦιʔεͷఆٛʢϞσϧͱରԠ • parameters.yaml, parameters/* ڞ௨ύϥϝʔλͷఆٛ • responses.yaml, responses/* ڞ௨Ϩεϙϯεͷఆٛ > tree -L 3 swagger/api/v1 ├── components │ ├── schemas.yaml │ ├── parameters.yaml │ ├── responses.yaml │ ├── parameters │ │ ├── section_id.yaml │ │ └── student_id.yaml │ ├── schemas │ │ ├── section.yaml │ │ └── student.yaml ├── paths │ └── sections │ └── index.yaml ├── paths.yaml └── main.yaml
APIεΩʔϚఆٛϑΝΠϧཧ
APIεΩʔϚఆٛϑΝΠϧཧ • main.yaml ΞϓϦέʔγϣϯͷఆٛʢೝূͳͲ • paths.yamlɼpath/* ΤϯυϙΠϯτͷఆٛ •
schemas.yaml, schemas/* ϦιʔεͷఆٛʢϞσϧͱରԠ • parameters.yaml, parameters/* ڞ௨ύϥϝʔλͷఆٛ • responses.yaml, responses/* ڞ௨Ϩεϙϯεͷఆٛ > tree -L 3 swagger/api/v1 ├── components │ ├── schemas.yaml │ ├── parameters.yaml │ ├── responses.yaml │ ├── parameters │ │ ├── section_id.yaml │ │ └── student_id.yaml │ ├── schemas │ │ ├── section.yaml │ │ └── student.yaml ├── paths │ └── sections │ └── index.yaml ├── paths.yaml └── main.yaml
APIεΩʔϚఆٛϑΝΠϧཧ • JSONͰεΩʔϚΛฦ͢APIΛ࣮ • swagger-uiͰ͜ΕΛӾཡ͢Δ
Copyright (C) 2017 Studyplus, Inc. All Rights Reserved. Confidential ϞοΫAPIͷ࡞
ϞοΫAPIͷ࡞ • ͱΓ͋͑ͣಈ͘࠷খݶͷ࣮ 1.routeΛՃ 2.࠷ݶͷςετΛՃ 3.swagger-uiͷϨεϙϯεΛ ίϯτϩʔϥʹϕλషΓ͢Δ 4.ίʔυϨϏϡʔ
εΩʔϚʹաෆແ͍͔֬ೝʂ 5.mergeͯ͠σϓϩΠ
εΩʔϚόϦσʔγϣϯ • ࣮ͱεΩʔϚͷဃࢭ - request specͰอূ - ͯ͢ͷϨεϙϯε͕ఆٛͱဃ͠ ͍ͯͳ͍͔assert_schema_conform Ͱ֬ೝ
- ෳͷAPIʢ෦ެ։ɼ֎෦ެ։ʣ ͕͋ΔͷͰRSpecͷmetadataʹ OpenAPIఆٛϑΝΠϧύεΛࢦఆͰ ͖ΔΑ͏ʹ͍ͯ͠Δ
͜ͷ࣮ϑϩʔͰྑ͔ͬͨ͜ͱ • ϑϩϯτΤϯυ࡞ۀऀͷͪ࣌ؒΛݮͰ͖ͨ • ϞοΫAPIͷ࡞࡞ۀ1~2࣌ؒͰ݁Ͱ͖Δ • API࣮ͷखΓΛ࠷খԽͰ͖Δ • ຊ൪ڥద༻ޙʹमਖ਼͕ඞཁʹͳΔ͜ͱ͕ݮΒͤΔ •
։ൃॳظஈ֊͔Βαʔόʔͱϑϩϯτͷ࡞ۀऀͷೝࣝͷဃ͕ݮͬͨ • ϑϩϯτ࡞ۀऀͱαʔόʔ࡞ۀऀͰεΩʔϚϕʔεͰରͰ͖Δ
ݱঢ়ͷ՝ • enumͳͲͷʹରͯͯ͢͠ͷύλʔϯΛཏͨ͠ϞοΫAPIΛఏڙ͠ Α͏ͱ͢Δͱ໘ →ݱঢ়ϑϩϯτଆʹՃͰϕλॻ͖ͨ͠Γͯ͠ରԠ͍ͯ͠Δ • εΩʔϚࣗମͷόϦσʔγϣϯΛ͍ͯ͠ͳ͍ͷͰtypoͱ͔Λݟಀ͢ͱख Γ͕ൃੜ͢Δ
→validatorͷdocker image͕͋ΔͷͰCIͰνΣοΫ͢ΔΑ͏ʹ͍ͨ͠
࠷ޙʹએ We are hiring!!!
We’re Hiring! ΤϯδχΞืूத https://info.studyplus.co.jp/recruit
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠