flatiron / revalidator

A cross-browser / node.js validator powered by JSON Schema
http://github.com/flatiron/revalidator
Apache License 2.0
589 stars 82 forks source link

Is it possible to validate dynamic object keys? #86

Closed FelikZ closed 9 years ago

FelikZ commented 10 years ago

For example I have the following input:

{
    "12421412": {},
    "12621213": {},
    //...
}

Want to test that keys matching ^[0-9]+$.

davidgwking commented 9 years ago

Hidden in the library is a keyword called patternProperties.

{
  type: 'object',
  patternProperties: {
    '^[0-9]+$': {...}
  }
}
FelikZ commented 9 years ago

Very thanks!