Slide 1

Slide 1 text

agreed-typed ҏ౻ɹӯ

Slide 2

Slide 2 text

ࣗݾ঺հ • ҏ౻ɹӯʢ͍ͱ͏ɹ͖͋ͱʣ • @akito0107 • 2015೥ ϦΫϧʔτೖࣾ • ιϑτ΢ΣΞΤϯδχΞ • Go / Node.jsΛॻ͍͍ͯ·͢

Slide 3

Slide 3 text

͸ͳ͢͜ͱ • RTCͷΑ͋͘ΔΞʔΩςΫνϟ • AgreedͱConsumer-Driven Contract • Agreed-Typed • ·ͱΊ

Slide 4

Slide 4 text

from: https://speakerdeck.com/yosuke_furukawa/rikurutotekufalserozizufalseji-shu-dong-xiang?slide=11

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

͜͜

Slide 8

Slide 8 text

͍ͭ΋ ͜͜Ͱ ݂͕ྲྀ ΕΔ

Slide 9

Slide 9 text

APIͷI/Fʹؔ͢Δ໰୊ • ୭͕͍ܾͭΊΔ໰୊ • Backend͕উखʹܾΊͯFront͔Β͸࢖͍ͮΒ͍ (ex, N + 1 http requestͳͲ) • ϝϯςφϯεਏ͍໰୊ • DocumentͱͷෆҰகɺͦ΋ͦ΋DocͳͲͳ͍ɺ etc…

Slide 10

Slide 10 text

Agreed • https://github.com/recruit-tech/agreed • Consumer-Driven Contract&Specification By Exampleͷπʔϧ • APIΛ࢖͏ଆʢFEʣ͕request / responseΛJSONͳͲͰ
 ࣗ༝ʹࢦఆͰ͖Δ • FEͷͨΊʹ͸Mock Serverͱͯ͠ৼΔ෣͏ • BEͷͨΊʹ͸E2E testing toolsͱͯ͠ৼΔ෣͏

Slide 11

Slide 11 text

Agreed Sample • agreed.js

Slide 12

Slide 12 text

Agreed Server Sample • Run Server • curl

Slide 13

Slide 13 text

Agreed fileͷදݱྗͷ໰୊ • Agreed͸FE͕खܰʹmock serverΛཱͯΔͨΊͷ࢓૊Έ • Agreed fileΛਖ਼͘͠ॻ͘͜ͱࣗମ͕೉͍͠ • ex) ඞਢɾඇඞਢΛදݱͰ͖ͳ͍, ύϥϝʔλͷൈ͚͕ ݕ஌Ͱ͖ͳ͍ͳͲ • agreedͰrequest / responseΛఆٛͯ͠΋ɺFE/BEͰਖ਼ ͘͠ॲཧͰ͖ͯΔ͔Λ֬ೝ͢Δํ๏͕ͳ͍

Slide 14

Slide 14 text

agreed-typed • Agreed fileͷAPIఆٛʹܕΛ͚ͭΔͨΊͷϥΠϒ ϥϦ • APIΛܕͰදݱ • requestͷPath΋ܕ, responseͷstatusCode΋ܕ • agreedͷఆٛΛ੩తղੳ͢Δ

Slide 15

Slide 15 text

agreed-typed sample 1 • APIDef<>͔ΒͷܕΤΠϦΞεͰAPIΛఆٛ

Slide 16

Slide 16 text

agreed-typed sample 2 • ܕʹैͬͯexampleΛఆٛ

Slide 17

Slide 17 text

agreed-typed sample 3 • Run Server • curl

Slide 18

Slide 18 text

agreed-typed sample 4 • ͍Ζ͍ΖͳܕνΣοΫΛ͔͚ΒΕΔ ະఆٛͷCPEZ ૝ఆ͞Εͳ͍
 TUBUVTDPEF QBUI͕ؒҧͬͯΔ

Slide 19

Slide 19 text

ଞʹ΋ίϯύΠϥ͕νΣοΫͰ ͖Δ͜ͱ • GETʹbody͚ͭΔͱίϯύΠϥౖ͕Δ • Status codeʹΑΓbodyग़͠෼͚ • etc…

Slide 20

Slide 20 text

Future of API design • Specification by example or 
 Specification by design • Consumer / Producerͷඇରশੑ • ܕͰAPIΛදݱ͠ɺਖ਼౰ੑΛίϯύΠϥ͕ݕূ͢Δ ੈք͕དྷΔ • Haskell servant / Protobuf

Slide 21

Slide 21 text

·ͱΊ • agreedͱconsumer driven contractͷ঺հ • agreed-typedͷ঺հ • APIఆٛΛܕͰදݱ͠Α͏

Slide 22

Slide 22 text

͋Γ͕ͱ͏͍͟͝·ͨ͠