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.5k
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.1k
ピュアなドメインを支える技術/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
960
実践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.8k
Web API Design
petitviolet
18
8.1k
Property Based Testing introduction
petitviolet
1
100
Other Decks in Programming
See All in Programming
PagerDuty を軸にした On-Call 構築と運用課題の解決 / PagerDuty Japan Community Meetup 4
horimislime
1
110
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
7
2.8k
約9000個の自動テストの 時間を50分->10分に短縮 Flakyテストを1%以下に抑えた話
hatsu38
23
11k
Macとオーディオ再生 2024/11/02
yusukeito
0
200
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
550
CPython 인터프리터 구조 파헤치기 - PyCon Korea 24
kennethanceyer
0
240
Vue SFCのtemplateでTypeScriptの型を活用しよう
tsukkee
3
1.5k
Tuning GraphQL on Rails
pyama86
2
1k
gopls を改造したら開発生産性が高まった
satorunooshie
8
240
[PyCon Korea 2024 Keynote] 커뮤니티와 파이썬, 그리고 우리
beomi
0
110
Identifying User Idenity
moro
6
7.9k
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
140
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
355
29k
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
Learning to Love Humans: Emotional Interface Design
aarron
272
40k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Faster Mobile Websites
deanohume
304
30k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Visualization
eitanlees
144
15k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
7
150
Docker and Python
trallard
40
3.1k
Embracing the Ebb and Flow
colly
84
4.4k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
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