- From: Manu Sporny <msporny@digitalbazaar.com>
- Date: Thu, 03 May 2012 20:23:46 -0400
- To: David Nicol <davidnicol@gmail.com>
- CC: Web Payments <public-webpayments@w3.org>
Only after Dave Lehn sent his response did I realize that I had only sent this to David Nicol. On 05/02/2012 06:00 PM, David Nicol wrote: > http://json-schema.org/ > > is this format compatible or not, with JSON-LD? Yes, as far as we know, it is. We've been discussing whether or not we want to use JSON Schema for validation of input to our REST services. It's an implementation detail, but it might be good for the specification to provide non-normative examples of JSON Schema for each type of message in the system. The way it breaks down is this: JSON-LD is used to express messages that travel between PaySwarm-aware systems. JSON Schema is used to verify that those messages are well formed. So, this JSON-LD could be sent: { "message": "Oh hai!" } and this JSON Schema would be applied to it to ensure that the data contains a "message" key that is a string: { "description":"A simple message", "type":"object", "properties": { "message":{ "type":"string", "required":true }, } } However, as Dave Lehn said - validating this sort of input is a bit more difficult than just using JSON Schema. For instance, the way you validate an incoming message might depend entirely on the type of data that is in that message, or might not be something that is static (like a value between 1 and 20). A validator may need to do something like "a value between the lowest sale price and highest sale price for the item"... and that's just not something you can do in JSON Schema very easily. So, it may be that JSON Schema is good for 50%-80% of the cases. For the rest, you have to validate it programmatically - which, as Dave Lehn said, is what we do for the current PaySwarm implementation. -- manu -- Manu Sporny (skype: msporny, twitter: manusporny) President/CEO - Digital Bazaar, Inc. blog: PaySwarm Website for Developers Launched http://digitalbazaar.com/2012/02/22/new-payswarm-alpha/
Received on Friday, 4 May 2012 00:24:13 UTC