webpipes/spec

Use JSON Schema in block definitions?

tlrobinson opened this issue · 5 comments

JSON Schema looks a lot like what we have for specifying inputs/outputs. I think we all prefer using existing standards where it makes sense. Does it make sense?

Example JSON Schema from http://tools.ietf.org/html/draft-zyp-json-schema-03#section-3

{
  "name":"Product",
  "properties":{
    "id":{
      "type":"number",
      "description":"Product identifier",
      "required":true
    },
    "name":{
      "description":"Name of the product",
      "type":"string",
      "required":true
    },
    "price":{
      "required":true,
      "type": "number",
      "minimum":0,
      "required":true
    },
    "tags":{
      "type":"array",
      "items":{
        "type":"string"
      }
    }
  },
  "links":[
    {
      "rel":"full",
      "href":"{id}"
    },
    {
      "rel":"comments",
      "href":"comments/?id={id}"
    }
  ]
}

Also, at a minimum we should probably use JSON Schema for specing the block definition, request/response, and pipeline formats.

Yeah that looks interesting. Where can I actually read about it? When I
poked at their site I couldn't actually find anything that looked like what
you posted.

On Wed, Nov 28, 2012 at 5:03 PM, Tom Robinson notifications@github.comwrote:

Also, at a minimum we should probably use JSON Schema for specing the
block definition, request/response, and pipeline formats.


Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-10830763.

Jeff Lindsay
http://progrium.com

That example was from the spec proposal: http://tools.ietf.org/html/draft-zyp-json-schema-03#section-3

This tool is kind of cool: http://www.jsonschema.net/

I wholeheartedly support co-opting existing specifications when
possible. Since node-webpipe, and other future frameworks, can hide the
intricacies of JSON Schema from developers I don't have a problem with us
adopting the format for block definitions.

That said, I'm trying to figure out what kind of direct benefits would be
gained. JSON Schema seems like a jet engine when all we need is a servo. Am
I wrong?

On Fri, Nov 30, 2012 at 2:07 AM, Tom Robinson notifications@github.comwrote:

That example was from the spec proposal:
http://tools.ietf.org/html/draft-zyp-json-schema-03#section-3

This tool is kind of cool: http://www.jsonschema.net/


Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-10880471.

V/R

Matthew Hudson
Website http://www.matthewghudson.com/ | Bloghttp://blog.matthewghudson.com/
| Facebook http://facebook.com/matthewghudson |
Google+https://plus.google.com/u/0/103902048207396109122/posts|
Twitter http://twitter.com/matthewgh

No, you're right. I do like their "properties" format (object instead of array), but don't think we need to be strictly JSON Schema compatible.

"inputs":{
    "id":{
        "type":"number",
        "description":"Product identifier",
        "required":true
    },

I do think it would be worth codifying some of the specs in JSON Schema, or some other machine readable description we can use for validation.