- Fixed:
strict
option was not totally respected when usingpartial
- Added: option
partial
to allow for partial validation
Field#toJSONSchema()
when converting a type defined with typedef now behaves differently. Now it returns the full description when called with no paramenters. To use references, pass the base path as the first parameter, example:Field#toJSONSchema('#/definitions')
- Fix: apply pre hook before checking for emptiness
- Drop support for node 0.12 and 4
- Added: pre and post hooks to
typedef()
- Changed: do not depend on Buffer to check base64 string
- Added:
parseArgs
callback forregisterTaggedType
, called to pre-process tag arguments into extra
- Fixed: use isFinite instead of Number.isFinite to support IE
- Added:
context.registerObjectType
to be used by core types in order to support IE
- Fixed: use isNaN instead of Number.isNaN to support IE
- Added:
Field#toJSONSchema()
that returns a parsed schema encoded in the JSON Schema standard
- Added:
'numeric'
,'numericInt'
,'numericUint'
and'numericIn'
core types. Those are string equivalents ofNumber
,'int'
,'uint'
,'numberIn'
types
- Fixed: NaN, Infinity and -Infinity being accepted as numbers issue #11
- Added:
'base64'
- Fixed:
'hex'
does not accept an odd number of bytes
- Fixed: message for
number(min,max)
,int(min,max)
,uint(min,max)
- Added: json type
'raw'
(like'*'
, but don't call toJSON)
- Added: remove extraneous keys with
undefined
value in strict mode. Nowvalidate({}, {a: undefined}, {strict: true})
istrue
validate({a: [String]}, {a: []})
now returnstrue
- Changed:
toJSON
is called when present, so nowvalidate(new Date, Date)
istrue
.
- You must use
var validate = require('validate-fields')()
instead of oldvar validate = require('validate-fields')
(note the()
at the end). validate(String, '')
now returnstrue
instead offalse
validate({'a?': Number}, {a: ''})
now returnsfalse
instead oftrue
- Added: default values issue #3
- Changed: new definition of emptiness issue #2 pull #5
- Changed: removed empty check from other places than hash issue #8
- Changed: no more global registry, create contexts instead issue #7
- Added: new numeric types issue #1
- Fixed: array is accepted as object issue #4
- Added: give support for tagged types issue #6
- Added: better error reporting (lastErrorPath, lastErrorMessage)
- Added: type '*'
- Added: strict option
- Added: toJSON and from JSON support
- Fixed: to exact-length string rule
- Fixed: to null-prototyped objects