Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use JSON Schema in block definitions? #2

Open
tlrobinson opened this issue Nov 29, 2012 · 5 comments
Open

Use JSON Schema in block definitions? #2

tlrobinson opened this issue Nov 29, 2012 · 5 comments

Comments

@tlrobinson
Copy link
Member

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}"
    }
  ]
}
@tlrobinson
Copy link
Member Author

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

@progrium
Copy link
Member

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 [email protected]:

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

@tlrobinson
Copy link
Member Author

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/

@matthewhudson
Copy link
Member

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 [email protected]:

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

@tlrobinson
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants