JSON Referencing and Schema

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    2 Favorites

    JSON Referencing and Schema - Presentation Transcript

    1. Persistent Computing on the Web with JSON Schema and Referencing
      • Kris Zyp
    2. Overview
      • JSON Referencing
      • JSON Schema
      • The possiblities...
    3. JSON + Hyperlinks = JSON Referencing
    4. JSON Referencing
      • Cyclic
      • Multiple references
      • Cross-message references
      • Cross-site references
      http://www.sitepen.com/blog/2008/06/17/json-referencing-in-dojo/
    5. 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”}]
        • }
      • }
    6. JSON Referencing (Path Based)‏
      • {
        • “ name”:”Kris Zyp”, “children”:[{“name”:”Jennika Zyp”}],
        • “ spouse”:{
          • “ name”:”Nicole Zyp”, “spouse”:{“$ref”:”#”},
          • “ children”:{“$ref”:”#.children”}
        • }
      • }
    7. JSON Referencing (ID + Path)‏
      • {
        • “ name”:”Kris Zyp”,
        • “ id”:”kriszyp”, “children”:[{“name”:”Jennika Zyp”}],
        • “ friends”:[{“$ref”:”jesse#.spouse”}]
      • }
    8. JSON + Schema = JSON Schema
    9. JSON Schema
      • schema:
      • {"description":"A person",
      • "type":"object",
      • "properties":
      • {"name": {"type":"string"},
      • "age" : {"type":"integer",
      • "maximum":125}}
      • }
      • instance:
      • {“name”:”Kris”,
      • “ age”:30}
    10. 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”}]
      • }
    11. JSON Schema
      • Schema:
      • {“type”:”array”, “items”:[{“type”:”string”},{“type”:”number”}] }
      • instance:
      • [“foo”,44]
    12. JSON Schema
      • Schema:
      • {"description":"A person",
      • "type":["object",”string”]
      • }
      • instance:
      • “ foo”
      • instance:
      • {“prop”:3}
    13. JSON Schema
      • Schema:
      • {"description":"A person",
      • "type":["object",”string”]
      • }
      • instance:
      • “ foo”
      • instance:
      • {“prop”:3}
    14. 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”}
    15. What can we do with these?
    16. 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”}
      • }
    17. 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/
    18. JSON Referencing + REST
      • GET /Person/3
      • {
      • “ name”:”Kris”,
      • “ friends”:[
        • {“$ref”:”4”},
        • {“$ref”:”5”}
      • ]
      • }
    19. JSON Referencing + JSON-RPC
      • POST /person/kriszyp
      • {
        • “ method”:”addFriend”,
        • “ id”:”1”,
        • “ params”:[{“$ref”:”jessesmith”}]
      • }
    20. Applying data definitions to code
    21. JSON Schema + Typed Code
    22. JSON Schema Interfaces
    23. JSON Schema Interface
      • {"description":"A person",
      • "type":"object",
      • "properties":
      • {"name": {"type":"string"} }, “methods”:{ “getName”:{“returns”:{“type”:”string”}, “params”:[]}, “setName”:{“params”:[{“type”:”string”}]}, }
      • }
    24. Cross-site Referencing
      • {
        • “ name”:”Kris Zyp”,
        • “ id”:”kriszyp”,
        • “ friends”:[
          • {“$ref”:” http://thezyps.com/person/nikki ”},
          • {“$ref”:” http://social.com/user/33 ”}
        • ]
      • }
    25. Cross-site Typing
    26. Mobile code (run anywhere)‏
      • Code can run anywhere
        • Server JavaScript Environment
        • Browser JavaScript Environment
      • Consistent persisted data structures across environments
    27. Connecting and structuring data for the future JSON Schema and JSON Referencing
    28.  

    + kriszypkriszyp, 2 years ago

    custom

    656 views, 2 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 656
      • 656 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 21
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories