Slide 1

Slide 1 text

(SBQI2-PO4DBMB 'SJOHF$P -UE!QFUJUWJPMFU

Slide 2

Slide 2 text

ͰɺͩΕʁ w )JSPLJ,PNVSBTBLJ w 8FC্Ͱ͸!QFUJUWJPMFU w 'SJOHFגࣜձࣾ w 4DBMBྺ͸೥΄Ͳ 2

Slide 3

Slide 3 text

ࠓ೔࿩͢͜ͱ w Կʹ(SBQI2-Λ࢖͍ͬͯΔͷ͔ w ͳͥ(SBQI2-Λ࢖͍ͬͯΔͷ͔ w 4DBMBͰ(SBQI2-͢Δ w ΍ͬͯΈͯͲ͏͔ 3

Slide 4

Slide 4 text

Կʹ(SBQI2-Λ ࢖͍ͬͯΔͷ͔ 4

Slide 5

Slide 5 text

Կʹ(SBQI2-Λ࢖͍ͬͯΔͷ͔ w ΞυωοτϫʔΫͷ؅ཧը໘ͷαʔόαΠυ"1* w ޿ࠂͷ഑৴ઃఆΛ؅ཧ͢Δը໘ͷཪଆ w ඇެ։಺෦"1*ͱͯ͠ͷ(SBQI2- w ΫϥΠΞϯτ͸&MNͰ41" w 2VFSZ.VUBUJPOͲͪΒ΋(SBQI2- w Ұ෦ඇ(SBQI2- 5

Slide 6

Slide 6 text

ͳͥ(SBQI2-Λ ࢖͍ͬͯΔͷ͔ 6

Slide 7

Slide 7 text

ͳͥ(SBQI2-Λ࢖͍ͬͯΔͷ͔ w ʮ͑ͬɺ͜ͷϖʔδදࣔ͢Δͷʹճ΋"1*Λʁʯ w Կͱ͔͍͚ͨ͠Ͳ3&45ͱંΓ߹͍͕͔ͭͳ͍ w ʮԶ͸ҰମԿΛʜʯΛආ͚͔ͨͬͨ w 63*ઃܭ΍1045165%&-&5&Ͱ೰Ήͱ͔ w ྺ࢙ʹֶΜͩ w 3&45ɺૢ࡞ࢦ޲ɺ+40/31$ͳͲ w ۜͷ஄ؙΛ୳͢೔ʑ 7

Slide 8

Slide 8 text

https://speakerdeck.com/petitviolet/web-api-design

Slide 9

Slide 9 text

https://speakerdeck.com/petitviolet/web-api-design Ͳ͏΍Β(SBQI2-͕͍͍Β͍͠

Slide 10

Slide 10 text

ͳͥ(SBQI2-Λ࢖͍ͬͯΔͷ͔ w ΫϥΠΞϯτଆʹ3FBEܥͷ੹຿Λد͍ͤͨ w %%%΍ͬͯͯ3FBEܥͷཁٻʹԠ͑Δͷ͕͖͍ͭ w 9YY3FQPTJUPSZ͕pOE#Z:ZZͩΒ͚ʹ w λΠϛϯά͕ྑ͔ͬͨ w ৽نϓϩδΣΫτൃ଍ w αʔόαΠυʹࣗ෼͕ΞαΠϯ͞Εͨ w (SBQI2-Θ͔ΔΤϯδχΞ͕ϑϩϯτʹ΋ 10

Slide 11

Slide 11 text

4DBMBͰ(SBQI2-͢Δ 11

Slide 12

Slide 12 text

4DBMBͰ(SBQI2-͢Δ w TBOHSJBHSBQIRMTBOHSJBΛ࢖͏ w 4DBMBͷ(SBQI2-ϑϨʔϜϫʔΫ w 8FCϑϨʔϜϫʔΫ͸ಛʹ໰Θͳ͍ w *'͸+40/Ͱɺ+40/ϥΠϒϥϦ΋ෳ਺ରԠ 12

Slide 13

Slide 13 text

งғؾ 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

Slide 14

Slide 14 text

งғؾ 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

Slide 15

Slide 15 text

งғؾ 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

Slide 16

Slide 16 text

งғؾ 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

Slide 17

Slide 17 text

งғؾ 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 }) ) ) } OVMMBCMF͸0QUJPOͰදݱ 17

Slide 18

Slide 18 text

งғؾ 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

Slide 19

Slide 19 text

4DBMBͰ(SBQI2-͢Δ w 4BOHSJB͸ػೳ͕े෼ʹଗ͍ͬͯΔ w ඇಉظॲཧ w ϚΫϩʹΑΔUZQFͷࣗಈಋग़ w +40/ͱͷ૬ޓม׵ w DBTFDMBTTͱ(SBQI2-Λ+40/͕ܨ͙ w /໰୊ղܾ w 'FUDIFS%FGFSSFE3FTPMWFS w 3FMBZαϙʔτ w TBOHSJBHSBQIRMTBOHSJBSFMBZ 19

Slide 20

Slide 20 text

(SBQI2-Λ4DBMBͰ ΍ͬͯΈͯͲ͏͔ 20

Slide 21

Slide 21 text

(SBQI2-Λ࢖ͬͯΈͯͲ͏͔ w ײ૝ͱͯ͠ɺ(SBQI2-ʹͯ͠ྑ͔ͬͨ w ͍ΖΜͳ͜ͱ͔Βղ์͞Εͨ w ʮͱΓ͋͑ͣશ෦ฦ͔͢Β͋ͱΑΖ͘͠ʯͷָ͞ w ؔ࿈ΦϒδΣΫτ͸SFTPMWFͰؤு࣮ͬͯ૷ w ͿͬͪΌ͚Ͳ͏࢖ͬͯΔ͔Α͘஌Βͳ͍ w 4DBMBͱ(SBQI2-ܕ࢓༷ͷ૬ੑͷྑ͞ w ૉ௚ʹදݱͰ͖Δ҆͠શʹָʹ։ൃͰ͖Δ w OPOOVMMΛίϯύΠϥͰڧ੍Ͱ͖Δ 21

Slide 22

Slide 22 text

͠ΜͲ͍͜ͱɺ೰ΜͰ͍Δ͜ͱ w (SBQI2-ͷֶशίετ͸ͦΕͳΓʹ͔͔Δ w εΩʔϚͷ࡞Γํʹ೰Ή w ϨΠϠʔυΞʔΩςΫνϟͰͷཱͪҐஔ w ೝূ͕Ξμϓλ૚Ͱ΍Β͟ΔΛಘͳ͍ w &OVNΛυϝΠϯ૚ͱڞ༗͢Δ΂͖͔ 22

Slide 23

Slide 23 text

·ͱΊ 23

Slide 24

Slide 24 text

(SBQI2-PO4DBMB w 4DBMBͰ(SBQI2-ɺे෼΍ΕΔ w TBOHSJBHSBQIRMTBOHSJBͷ͓͔͛ w (SBQI2-ͷ࢓༷ΛͪΌΜͱຬͨͤΔ w (SBQI2-΍ͬͯΈͯΑ͔ͬͨ w ࣍ʹԿ͔࡞Δͱͯ͠΋࠾༻͍ͨ͠ w ֶशίετ͸͔͔ΔͷͰνʔϜʹΑΔ 24

Slide 25

Slide 25 text

5IBOLZPV 25