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
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
650
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
14 Years of iOS: Lessons and Key Points
seyfoyun
1
770
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
.NET 9アプリをCGIとして レンタルサーバーで動かす
mayuki
1
770
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
180
快速入門可觀測性
blueswen
0
320
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
130
Security_for_introducing_eBPF
kentatada
0
110
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
talk-with-local-llm-with-web-streams-api
kbaba1001
0
170
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Why Our Code Smells
bkeepers
PRO
335
57k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Producing Creativity
orderedlist
PRO
341
39k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Six Lessons from altMBA
skipperchong
27
3.5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
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