JSON Referencing and Schema
Upcoming SlideShare
Loading in...5
×
 

JSON Referencing and Schema

on

  • 11,509 views

 

Statistics

Views

Total Views
11,509
Views on SlideShare
11,484
Embed Views
25

Actions

Likes
12
Downloads
204
Comments
1

2 Embeds 25

http://www.slideshare.net 24
http://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • In slide 23, the json schema interface is just a proposal right? I mean, there is no support for methods validation from any json schema validation tool, right?
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

JSON Referencing and Schema JSON Referencing and Schema Presentation Transcript

  • Persistent Computing on the Web with JSON Schema and Referencing
    • Kris Zyp
  • Overview
    • JSON Referencing
    • JSON Schema
    • The possiblities...
  • JSON + Hyperlinks = JSON Referencing
  • JSON Referencing
    • Cyclic
    • Multiple references
    • Cross-message references
    • Cross-site references
    http://www.sitepen.com/blog/2008/06/17/json-referencing-in-dojo/
  • JSON Referencing (ID Based)‏
    • {
      • “ name”:”Kris Zyp”,
      • “ id”:”kriszyp”, “children”:[{“id”:”jennikazyp”,“name”:”Jennika Zyp”}],
      • “ spouse”:{
        • “ name”:”Nicole Zyp”, “spouse”:{“$ref”:”kriszyp”},
        • “ children”:[{“$ref”:”jennikazyp”}]
      • }
    • }
  • JSON Referencing (Path Based)‏
    • {
      • “ name”:”Kris Zyp”, “children”:[{“name”:”Jennika Zyp”}],
      • “ spouse”:{
        • “ name”:”Nicole Zyp”, “spouse”:{“$ref”:”#”},
        • “ children”:{“$ref”:”#.children”}
      • }
    • }
  • JSON Referencing (ID + Path)‏
    • {
      • “ name”:”Kris Zyp”,
      • “ id”:”kriszyp”, “children”:[{“name”:”Jennika Zyp”}],
      • “ friends”:[{“$ref”:”jesse#.spouse”}]
    • }
  • JSON + Schema = JSON Schema
  • JSON Schema
    • schema:
    • {"description":"A person",
    • "type":"object",
    • "properties":
    • {"name": {"type":"string"},
    • "age" : {"type":"integer",
    • "maximum":125}}
    • }
    • instance:
    • {“name”:”Kris”,
    • “ age”:30}
  • JSON Schema
    • Schema:
    • {"description":"A person",
    • "type":"object",
    • "properties":
    • {"name": {"type":"string"},
    • "age" : {"type":"integer",
    • "maximum":125, “optional”:true}, “friends”: {“type”:”array”, “items”:{“type”:”object”}} }
    • }
    • instance:
    • {“name”:”Kris”,
    • “ friends”:[{“name”:”Nikki”}]
    • }
  • JSON Schema
    • Schema:
    • {“type”:”array”, “items”:[{“type”:”string”},{“type”:”number”}] }
    • instance:
    • [“foo”,44]
  • JSON Schema
    • Schema:
    • {"description":"A person",
    • "type":["object",”string”]
    • }
    • instance:
    • “ foo”
    • instance:
    • {“prop”:3}
  • JSON Schema
    • Schema:
    • {"description":"A person",
    • "type":["object",”string”]
    • }
    • instance:
    • “ foo”
    • instance:
    • {“prop”:3}
  • JSON Schema
    • schema:
    • {"description":"A person",
    • "type":"object",
    • "properties":
    • {"name": {"type":"string"},
    • "gender" : {"type":"string",
          • "enum”:[“male”,”female”]}},
    • “ additionalProperties”:false
    • }
    • instance:
    • {“name”:”Kris”,
    • “ gender”:”male”}
  • What can we do with these?
  • JSON Schema + JSON Referencing
    • {"description":"A Social Person", “id”:”socialperson”,
    • "type":"object",
    • "properties":
    • {"name": {"type":"string"},
    • "age" : {
        • "type":"integer",
    • "maximum":125
      • },
      • "friends" : {
        • “ type” : ”array”,
        • “ items” : {“$ref”:”socialperson”}
      • }
    • },
    • “ extends”:{“$ref”:”person”}
    • }
  • JSON Referencing + REST
    • Lazy loading - Generic clients can auto-load objects as necessary
    • Object identification can be used for saving state changes
    http://blog.medryx.org/2008/07/24/jsonreststore-overview/
  • JSON Referencing + REST
    • GET /Person/3
    • {
    • “ name”:”Kris”,
    • “ friends”:[
      • {“$ref”:”4”},
      • {“$ref”:”5”}
    • ]
    • }
  • JSON Referencing + JSON-RPC
    • POST /person/kriszyp
    • {
      • “ method”:”addFriend”,
      • “ id”:”1”,
      • “ params”:[{“$ref”:”jessesmith”}]
    • }
  • Applying data definitions to code
  • JSON Schema + Typed Code
  • JSON Schema Interfaces
  • JSON Schema Interface
    • {"description":"A person",
    • "type":"object",
    • "properties":
    • {"name": {"type":"string"} }, “methods”:{ “getName”:{“returns”:{“type”:”string”}, “params”:[]}, “setName”:{“params”:[{“type”:”string”}]}, }
    • }
  • Cross-site Referencing
    • {
      • “ name”:”Kris Zyp”,
      • “ id”:”kriszyp”,
      • “ friends”:[
        • {“$ref”:” http://thezyps.com/person/nikki ”},
        • {“$ref”:” http://social.com/user/33 ”}
      • ]
    • }
  • Cross-site Typing
  • Mobile code (run anywhere)‏
    • Code can run anywhere
      • Server JavaScript Environment
      • Browser JavaScript Environment
    • Consistent persisted data structures across environments
  • Connecting and structuring data for the future JSON Schema and JSON Referencing
  •