Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

現実世界のJSON Hyper-Schema / Real World JSON Hyper-...

現実世界のJSON Hyper-Schema / Real World JSON Hyper-Schema

Ruby Business User Conference 2015での発表資料です。

Kenichi Takahashi

February 25, 2015
Tweet

More Decks by Kenichi Takahashi

Other Decks in Programming

Transcript

  1. ಋೖ͢Δૂ͍  "1*Λ࢖͏ਓ  ࣮૷ͱဃ཭͍ͯ͠ͳ͍υΩϡϝϯτ  ΫϥΠΞϯτϥΠϒϥϦͰ؆୯ʹར༻  ΧελϚʔαϙʔτͷෛ୲ܰݮ 

    ։ൃޮ཰ͷ޲্  ΤϯυϙΠϯτͷ࢓༷Λத৺ʹٞ࿦  ελϒͰ"1*։ൃ͕ϘτϧωοΫʹͳΒͳ͍
  2. +40/4DIFNBΛॻ͘  Ϧιʔεຖʹ+40/4DIFNBΛ࡞Δ  \SFTPVSDF^JEKTPOΛϕʔεʹ  IUUQKTPOTDIFNBOFU  +40/UP+40/4DIFNB 

    ղऍ΍ग़ྗͷΦϓγϣϯ͕બ୒Ͱ͖Δ  FOVNɺSFRVJSFEɺBEEJUJPOBMQSPQFSUJFT FUD  Ϧετͷղऍͷڍಈ͸஫ҙ  45*΍ϙϦϞʔϑΟοΫؔ࿈Λ࢖͍ͬͯΔ৔߹ʹ໰୊ʹ
  3. ͏·͍͔͘ͳ͍ྫ { "payment_methods": [ { "category": "creadit_card", "gateway": "gmo-pg" },

    { "category": "bank", "name": "mizuho" } ] } { … "properties": { "payment_method": { "id": "payment_method", "type": "array", "items": { "id": "1", "type": "object", "properties": { "category": { "id": "category", "type": "string" }, "name": { "id": "name", "type": "string" } } } } } } HBUFXBZͱ͍͏ ϓϩύςΟ͕ͳ͔ͬͨ͜ͱʹ
  4. IUUQTHJUVCDPNLFODIBOTDIFNJ[F $ cat payments.json | bundle exec schemize --- schema:

    type: object properties: payment_method: type: array items: type: object properties: category: type: string gateway: type: string name: type: string
  5. γϯϓϧͳMJOL schema: ! … ! links: - description: all payment

    methods href: /v1/payment_methods.json method: GET rel: instances title: payment_methods
  6. MJOLຖʹεΩʔϚΛఆٛ schema: ! … ! links: - description: all payment

    methods href: /v1/payment_methods.json method: GET rel: instances title: payment_methods targetSchema: type: object properties: payment_methods: type: array items: type: object $ref: "/schemata/payment_methods/#" meta: type: object properties: page: type: integer SFGͰผͷ৔ॴͰఆٛͨ͠ εΩʔϚΛಡΈࠐΉ UBSHFU4DIFNBͰϨεϙϯεͷ εΩʔϚΛࢦఆ͢Δ
  7. *OUFSQPMΛࢼͯ͠Έͯ  ελϒαʔό͸ॊೈ  JOUFSQPM͸ελϒͰฦ͢+40/Λࣗ෼Ͱఆٛ  ଞ͸εΩʔϚ಺ͷFYBNQMFΛ࢖͏  +40/4DIFNBͷόʔδϣϯ͕ݹ͍ 

    JOUFSQPM͸ESBGUͰBOZ0GͳͲ͕࢖͑ͳ͍  ᐆດͳΤϯυϙΠϯτΛ۠ผͰ͖ͳ͍  VTFSTJEKTPOͱVTFSTTUBUTKTPO  ϑϧελοΫݫ͍͠
  8. +40/4DIFNBͰόϦσʔγϣϯ  ର৅ͷ؀ڥ  UFTUPSEFWFMPQNFOU  όϦσʔγϣϯΤϥʔͷͱ͖  αʔόΤϥʔ 

    ϦΫΤετͱϨεϙϯε  ·ͣ͸Ϩεϙϯε  ϦΫΤετ͸طଘͷόϦσʔγϣϯͰ