Thanks for the reply! I hadn't thought of using jsonschema that way (i use it and valid-schema everyday). I'm really looking for something specific to logical quieres however.
On Friday, March 1, 2013 3:03:29 AM UTC-8, Austin William Wright wrote: > > It's called JSON Schema, see <http://json-schema.org/>. > > Try <https://github.com/tdegrunt/jsonschema>. > > The schema for your instance would be something like: > > { type: "object" > , properties: > { "num": {type:"integer", minimum:0, maximum:2000, exclusiveMaximum:true} > , "name": {value:"foobar"} > } > , additionalProperties: false > } > > "additionalProperties" sets the schema used for properties not covered > elsewhere, by default any value is allowed, same thing as the empty schema > {}. False prohibits additional properties from appearing, if that's what > you want. > > You can give your schemas a URI and then differentiate different types of > JSON documents from each other using the media type: > > PUT http://example.com/resource/1234 HTTP/1.1 > Content-Type: application/json; profile=http://example.com/v1/myschema > > Which is very useful for revisioning a public API. > > On Thursday, February 28, 2013 6:20:48 PM UTC-7, Stephen Bartell wrote: >> >> My goal is to allow a user to specify a filter a la json. And then use >> the filter on incoming json documents. I'm pretty much looking for an >> implementation similar to mongodb's query command. Maybe theres something >> better than the mongo way, I dont know. I just want filters defined in >> json. >> >> For example here is a doc >> >> doc: { >> "num": 1234, >> "name": "foobar" >> } >> >> and here is the query: >> >> query: {"$and": [{"name": "foobar"}, {"num": {"$lt": 2000}}]} >> >> Based on this query, my doc will pass the filter. >> >> Thanks for any help on pointing me in the right direction! >> > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
