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.8k
小さく始めるクラウドネイティブ/small start CloudNative
petitviolet
0
1.7k
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
610
Microservices Batch on GAE
petitviolet
0
1.9k
Web API Design
petitviolet
18
8.1k
Property Based Testing introduction
petitviolet
1
110
Other Decks in Programming
See All in Programming
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
イベント駆動で成長して委員会
happymana
1
340
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.2k
subpath importsで始めるモック生活
10tera
0
320
Jakarta EE meets AI
ivargrimstad
0
150
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
120
距離関数を極める! / SESSIONS 2024
gam0022
0
290
Quine, Polyglot, 良いコード
qnighy
4
650
Jakarta EE meets AI
ivargrimstad
0
230
EMになってからチームの成果を最大化するために取り組んだこと/ Maximize team performance as EM
nashiusagi
0
100
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Side Projects
sachag
452
42k
The Language of Interfaces
destraynor
154
24k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Site-Speed That Sticks
csswizardry
0
28
A better future with KSS
kneath
238
17k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Designing for Performance
lara
604
68k
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