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
GraphQL on Scala
Search
petitviolet
June 28, 2018
Programming
3
2.6k
GraphQL on Scala
Introduction for GraphQL and implementing GraphQL API using Scala.
petitviolet
June 28, 2018
Tweet
Share
More Decks by petitviolet
See All by petitviolet
Stripeで請求書払い&銀行振込を実装する
petitviolet
0
1.2k
ピュアなドメインを支える技術/pure domain model and the technology behind it
petitviolet
14
9.9k
小さく始めるクラウドネイティブ/small start CloudNative
petitviolet
0
1.8k
2019年だからこそ12factor app/The Twelve-Factor app in 2019
petitviolet
1
970
実践GraphQL on Scala/Real world GraphQL on Scala
petitviolet
8
2.9k
Kubernetesを知る/Introduction Kubernertes
petitviolet
1
620
Microservices Batch on GAE
petitviolet
0
1.9k
Web API Design
petitviolet
18
8.2k
Property Based Testing introduction
petitviolet
1
110
Other Decks in Programming
See All in Programming
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
5
910
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
テストコード文化を0から作り、変化し続けた組織
kazatohiei
2
1.5k
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
260
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
Beyond ORM
77web
7
870
testcontainers のススメ
sgash708
1
120
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
Jakarta EE meets AI
ivargrimstad
0
250
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
1.3k
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
73
9.1k
Navigating Team Friction
lara
183
15k
Visualization
eitanlees
146
15k
Statistics for Hackers
jakevdp
796
220k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Automating Front-end Workflow
addyosmani
1366
200k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Unsuck your backbone
ammeep
669
57k
Thoughts on Productivity
jonyablonski
67
4.4k
The World Runs on Bad Software
bkeepers
PRO
65
11k
KATA
mclloyd
29
14k
Transcript
(SBQI2-PO4DBMB 'SJOHF$P -UE!QFUJUWJPMFU
ͰɺͩΕʁ w )JSPLJ,PNVSBTBLJ w 8FC্Ͱ!QFUJUWJPMFU w 'SJOHFגࣜձࣾ w 4DBMBྺ΄Ͳ 2
ࠓ͢͜ͱ w Կʹ(SBQI2-Λ͍ͬͯΔͷ͔ w ͳͥ(SBQI2-Λ͍ͬͯΔͷ͔ w 4DBMBͰ(SBQI2-͢Δ w ͬͯΈͯͲ͏͔ 3
Կʹ(SBQI2-Λ ͍ͬͯΔͷ͔ 4
Կʹ(SBQI2-Λ͍ͬͯΔͷ͔ w ΞυωοτϫʔΫͷཧը໘ͷαʔόαΠυ"1* w ࠂͷ৴ઃఆΛཧ͢Δը໘ͷཪଆ w ඇެ։෦"1*ͱͯ͠ͷ(SBQI2- w ΫϥΠΞϯτ&MNͰ41" w
2VFSZ.VUBUJPOͲͪΒ(SBQI2- w Ұ෦ඇ(SBQI2- 5
ͳͥ(SBQI2-Λ ͍ͬͯΔͷ͔ 6
ͳͥ(SBQI2-Λ͍ͬͯΔͷ͔ w ʮ͑ͬɺ͜ͷϖʔδදࣔ͢Δͷʹճ"1*Λʁʯ w Կͱ͔͍͚ͨ͠Ͳ3&45ͱંΓ߹͍͕͔ͭͳ͍ w ʮԶҰମԿΛʜʯΛආ͚͔ͨͬͨ w 63*ઃܭ1045165%&-&5&ͰΉͱ͔ w
ྺ࢙ʹֶΜͩ w 3&45ɺૢ࡞ࢦɺ+40/31$ͳͲ w ۜͷؙΛ୳͢ʑ 7
https://speakerdeck.com/petitviolet/web-api-design
https://speakerdeck.com/petitviolet/web-api-design Ͳ͏Β(SBQI2-͕͍͍Β͍͠
ͳͥ(SBQI2-Λ͍ͬͯΔͷ͔ w ΫϥΠΞϯτଆʹ3FBEܥͷΛد͍ͤͨ w %%%ͬͯͯ3FBEܥͷཁٻʹԠ͑Δͷ͕͖͍ͭ w 9YY3FQPTJUPSZ͕pOE#Z:ZZͩΒ͚ʹ w λΠϛϯά͕ྑ͔ͬͨ w
৽نϓϩδΣΫτൃ w αʔόαΠυʹ͕ࣗΞαΠϯ͞Εͨ w (SBQI2-Θ͔ΔΤϯδχΞ͕ϑϩϯτʹ 10
4DBMBͰ(SBQI2-͢Δ 11
4DBMBͰ(SBQI2-͢Δ w TBOHSJBHSBQIRMTBOHSJBΛ͏ w 4DBMBͷ(SBQI2-ϑϨʔϜϫʔΫ w 8FCϑϨʔϜϫʔΫಛʹΘͳ͍ w *'+40/Ͱɺ+40/ϥΠϒϥϦෳରԠ 12
งғؾ case class MyObject(id: Long, name: String) val myObjectType: ObjectType[Unit,
MyObject] = derive.deriveObjectType() val myQuery: ObjectType[MyObjectRepository, Unit] = { ObjectType.apply( "MyQuery", fields[MyObjectRepository, Unit]( { val idArg = Argument("id", LongType) Field( "findById", OptionType(myObjectType), arguments = idArg :: Nil, resolve = ctx => ctx.ctx.findById(ctx.arg(idArg))) }, Field("all", ListType(myObjectType), resolve = ctx => Future { ctx.ctx.findAll }) ) ) } 13
งғؾ case class MyObject(id: Long, name: String) val myObjectType: ObjectType[Unit,
MyObject] = derive.deriveObjectType() val myQuery: ObjectType[MyObjectRepository, Unit] = { ObjectType.apply( "MyQuery", fields[MyObjectRepository, Unit]( { val idArg = Argument("id", LongType) Field( "findById", OptionType(myObjectType), arguments = idArg :: Nil, resolve = ctx => ctx.ctx.findById(ctx.arg(idArg))) }, Field("all", ListType(myObjectType), resolve = ctx => Future { ctx.ctx.findAll }) ) ) } (SBQI2-ͷUZQF 14
งғؾ case class MyObject(id: Long, name: String) val myObjectType: ObjectType[Unit,
MyObject] = derive.deriveObjectType() val myQuery: ObjectType[MyObjectRepository, Unit] = { ObjectType.apply( "MyQuery", fields[MyObjectRepository, Unit]( { val idArg = Argument("id", LongType) Field( "findById", OptionType(myObjectType), arguments = idArg :: Nil, resolve = ctx => ctx.ctx.findById(ctx.arg(idArg))) }, Field("all", ListType(myObjectType), resolve = ctx => Future { ctx.ctx.findAll }) ) ) } ܕͷࣗಈಋग़ 15
งғؾ case class MyObject(id: Long, name: String) val myObjectType: ObjectType[Unit,
MyObject] = derive.deriveObjectType() val myQuery: ObjectType[MyObjectRepository, Unit] = { ObjectType.apply( "MyQuery", fields[MyObjectRepository, Unit]( { val idArg = Argument("id", LongType) Field( "findById", OptionType(myObjectType), arguments = idArg :: Nil, resolve = ctx => ctx.ctx.findById(ctx.arg(idArg))) }, Field("all", ListType(myObjectType), resolve = ctx => Future { ctx.ctx.findAll }) ) ) } DPOUFYUͱͯ͠ 3FQPTJUPSZΛ༻ 16
งғؾ case class MyObject(id: Long, name: String) val myObjectType: ObjectType[Unit,
MyObject] = derive.deriveObjectType() val myQuery: ObjectType[MyObjectRepository, Unit] = { ObjectType.apply( "MyQuery", fields[MyObjectRepository, Unit]( { val idArg = Argument("id", LongType) Field( "findById", OptionType(myObjectType), arguments = idArg :: Nil, resolve = ctx => ctx.ctx.findById(ctx.arg(idArg))) }, Field("all", ListType(myObjectType), resolve = ctx => Future { ctx.ctx.findAll }) ) ) } OVMMBCMF0QUJPOͰදݱ 17
งғؾ case class MyObject(id: Long, name: String) val myObjectType: ObjectType[Unit,
MyObject] = derive.deriveObjectType() val myQuery: ObjectType[MyObjectRepository, Unit] = { ObjectType.apply( "MyQuery", fields[MyObjectRepository, Unit]( { val idArg = Argument("id", LongType) Field( "findById", OptionType(myObjectType), arguments = idArg :: Nil, resolve = ctx => ctx.ctx.findById(ctx.arg(idArg))) }, Field("all", ListType(myObjectType), resolve = ctx => Future { ctx.ctx.findAll }) ) ) } ඇಉظॲཧ 'VUVSF ͕؆୯ 18
4DBMBͰ(SBQI2-͢Δ w 4BOHSJBػೳ͕ेʹଗ͍ͬͯΔ w ඇಉظॲཧ w ϚΫϩʹΑΔUZQFͷࣗಈಋग़ w +40/ͱͷ૬ޓม w
DBTFDMBTTͱ(SBQI2-Λ+40/͕ܨ͙ w / ղܾ w 'FUDIFS%FGFSSFE3FTPMWFS w 3FMBZαϙʔτ w TBOHSJBHSBQIRMTBOHSJBSFMBZ 19
(SBQI2-Λ4DBMBͰ ͬͯΈͯͲ͏͔ 20
(SBQI2-ΛͬͯΈͯͲ͏͔ w ײͱͯ͠ɺ(SBQI2-ʹͯ͠ྑ͔ͬͨ w ͍ΖΜͳ͜ͱ͔Βղ์͞Εͨ w ʮͱΓ͋͑ͣશ෦ฦ͔͢Β͋ͱΑΖ͘͠ʯͷָ͞ w ؔ࿈ΦϒδΣΫτSFTPMWFͰؤு࣮ͬͯ w
ͿͬͪΌ͚Ͳ͏ͬͯΔ͔Α͘Βͳ͍ w 4DBMBͱ(SBQI2-ܕ༷ͷ૬ੑͷྑ͞ w ૉʹදݱͰ͖Δ҆͠શʹָʹ։ൃͰ͖Δ w OPOOVMMΛίϯύΠϥͰڧ੍Ͱ͖Δ 21
͠ΜͲ͍͜ͱɺΜͰ͍Δ͜ͱ w (SBQI2-ͷֶशίετͦΕͳΓʹ͔͔Δ w εΩʔϚͷ࡞ΓํʹΉ w ϨΠϠʔυΞʔΩςΫνϟͰͷཱͪҐஔ w ೝূ͕ΞμϓλͰΒ͟ΔΛಘͳ͍ w
&OVNΛυϝΠϯͱڞ༗͢Δ͖͔ 22
·ͱΊ 23
(SBQI2-PO4DBMB w 4DBMBͰ(SBQI2-ɺेΕΔ w TBOHSJBHSBQIRMTBOHSJBͷ͓͔͛ w (SBQI2-ͷ༷ΛͪΌΜͱຬͨͤΔ w (SBQI2-ͬͯΈͯΑ͔ͬͨ w
࣍ʹԿ͔࡞Δͱͯ͠࠾༻͍ͨ͠ w ֶशίετ͔͔ΔͷͰνʔϜʹΑΔ 24
5IBOLZPV 25