Monday 15 February 2010

node.js - JSON schema: date greater than an other -



node.js - JSON schema: date greater than an other -

i've json schema this:

{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "operation", "description": "the schema of operation", "type": "object", "properties": { "id":{ "description": "unique identifier of service", "type": "string" }, "description":{ "type": "string" }, "datedebut":{ "type": "string", "format": "date-time" }, "datefin":{ "type": "string", "format": "date-time" } } }

how can in schema datefin must greater datedebut ?

you can't on json-schema level. you'd have validate separately operation objects. in general, json-schema provides kind of "well-formed-ness" sanity checks: property beingness number, date, or string matching regexp; or object having nested construction of properties. more advanced business rules 1 illustration should controlled elsewhere.

node.js jsonschema json-schema-validator

No comments:

Post a Comment