gcanti / tcomb-json-schema

Transforms a JSON Schema to a tcomb type
MIT License
144 stars 32 forks source link

do not raise error when format is missing #11

Closed oliger closed 9 years ago

oliger commented 9 years ago

Hi @gcanti,

Raising an error when format is missing does not work me. I've a "textarea" format that I use to render a <textarea> instead of a <input>... This format is not used for validation.

{
  "bio": {
    "type": "string",
    "format": "textarea"
  }
}

To me, It does not seem that bad to do nothing when the format is missing. WDYT ?

gcanti commented 9 years ago

Hi @oliger, I'd prefer to keep the constraint, it's safer.

p.s.

This format is not used for validation

If your using the format property with a custom semantic, why don't you just add a dummy format to avoid errors?

transform.registerFormat('textarea', function () {
  return true;
});