0.28.3 (2020-03-06)
0.28.0 (2019-12-16)
- #473 make concat compatible with (not)oneOf (#492) (8d21cc9)
- array path resolve for descendants (#669) (d31e34d)
- change @babel/runtime version to be a range (#488) (1c9b362), closes #486
- concat of mixed and subtype (#444) (7705972)
- default message for test with object (#453) (f1be37f)
- noUnknown() overriding (#452) (3047b33)
- string.matches() and regex global flag (#450) (a8935b7)
- synchronous conditional object validation with unknown dependencies (#598) (1081c41)
- typo README (about excludeEmptyString) (#441) (d02ff5e)
- unix epoc bug in date parser (#655) (0d14827)
- add _isFilled as overrideable
mixed
method to control required behavior (#459) (5b01f18) - add function test names to email and url (#292) (7e94395)
- aliases
optional()
andunknown()
(#460) (51e8661) - allow toggling strict() (#457) (851d421)
- allow withMutation() nesting (#456) (e53ea8c)
- do concat in mutation mode (#461) (02be4ca)
- finalize resolve() (#447) (afc5119)
- replace integer check with Number.isInteger (#405) (1c18442)
- support self references (#443) (1cac515), closes /github.com/jquense/yup/blob/d02ff5e59e004b4c5189d1b9fc0055cff45c61df/src/Reference.js#L3
- use the alternate object index path syntax if the key contains dots (fixes #536) (#539) (13e8c76)
- use Number.isInteger. This works correctly for large numbers.
Related to jquense#147
- reach() no longer resolves the returned schema meaning it's conditions have not been processed yet; prefer validateAt/castAt where it makes sense
- required no longer shows up twice in describe() output for array and strings, which also no longer override required
0.27.0 (2019-03-14)
- change @babel/runtime version to be a range (#488) (1c9b362), closes #486
- concat of mixed and subtype (#444) (7705972)
- default message for test with object (#453) (f1be37f)
- noUnknown() overriding (#452) (3047b33)
- typo README (about excludeEmptyString) (#441) (d02ff5e)
- add _isFilled as overrideable
mixed
method to control required behavior (#459) (5b01f18) - aliases
optional()
andunknown()
(#460) (51e8661) - allow toggling strict() (#457) (851d421)
- allow withMutation() nesting (#456) (e53ea8c)
- do concat in mutation mode (#461) (02be4ca)
- finalize resolve() (#447) (afc5119)
- support self references (#443) (1cac515), closes /github.com/jquense/yup/blob/d02ff5e59e004b4c5189d1b9fc0055cff45c61df/src/Reference.js#L3
- reach() no longer resolves the returned schema meaning it's conditions have not been processed yet; prefer validateAt/castAt where it makes sense
- required no longer shows up twice in describe() output for array and strings, which also no longer override required
- locale
number
config propertiesless
andmore
are nowlessThan
andmoreThan
- remove default export, there are only named exports now!
- fix message defaults for built-in tests, default is only used for
undefined
messages - fix the
describe()
method so it works with nested schemas
** Probably not breaking but we are being safe about it **
- 🎉 Add Synchronous validation! #94
** Features **
- Custom locales without import order #125
- Fix bug in browsers without symbol #132
** Breaking **
- Use native Set and lodash CloneDeep: #109
** Fixes and Features
- Better custom locale support: #105
- fix some messages: #112
- Clearer errors for common mistakes: #108
- New string validation length: #67
- 7bc01e0 [added] deep path support for
from
- be80413 [fixed] default in concat()
- 8a8cc5b [changed] remove case aliases and simplify camelCase
- f7446d2 [fixed] pass path correctly to cast()
- 9b5232a [added] allow function then/otherwise bodies
- 73858fe [changed] Don't throw on undefined values in cast()
- 69c0ad4 [fixed] array().concat() incorrectly cleared the sub-schema
- b0dd021 [changed] Split integer(), remove transform
- 758ac51 [added] string.ensure
- f2b0078 [changed] Less aggressive type coercions
- ab94510 [fixed] boxed number allowed NaN
- 816e607 [added] validation params to ValidationError
- f827822 [changed] validate() on objects won't cast nested schema with strict()
- 139dd24 [changed] lazy qualifies as a yup schema
- c553cc0 [added] options to lazy resolve
- 6c309e4 [fixed] array.ensure()
- ab78f54 [fixed] reach with lazy()
- 6e9046b [changed] clean up interface, added lazy(), and fixed object strict semantics
- f30d1e3 [fixed] bug in date min/max with ref
- 83c0656 [added] meta() and describe()
- 75739b8 [added] context sensitive reach()
- ff19720 [fixed] noUnknown and stripUnknown work and propagate to children
- 86b6446 [fixed] camelCase should maintain leading underscores
- 335eb18 [fixed] pass options to array sub schema
- f7f631d [changed] oneOf doesn't include empty values
- 0a7b2d4 [fixed] type and whitelist/blacklist checks threw inconsistent errors
- 1274a45 [changed] required() to non-exclusive
- 5bc250f [changed] don't clone unspecified object keys
- 069c6fd [added] withMutation() method
- e1d4891 [fixed] don't alias non existent fields
- 686f6b1 [changed] concat() allows mixing "mixed" and other type
breaking
test
functions are no longer passedpath
andcontext
as arguments, Instead they are now values onthis
inside the test function.- test functions are longer called with the schema as their
this
value, usethis.schema
instead.
other changes
- test functions are call with with a new context object, including, options, parent and
createError
for dynamically altering validation errors.
- document
stripUnknown
- add
recursive
option - add
noUnknown()
test to objects
- default for objects now adds keys for all fields, not just fields with non empty defaults
- bug fix
breaking
test
functions are now passedpath
andcontext
values along with the field value. Only breaks if using the callback style of defining custom validations
breaking
- the
validation()
method has been renamed totest()
and has a new signature requiring aname
argument - exclusive validations now trump the previous one instead of defering to it e.g:
string().max(10).max(15)
has a max of15
instead of10
other changes
- expose advanced signature for custom validation tests, gives finer grained control over how tests are added
- added the
abortEarly
(default:true
) option - transforms are passed an addition parameter: 'originalValue' you allow recovering from a bad transform further up the chain (provided no one mutated the value)
- fix
concat()
method and add tests
- fix validations where nullable fields were failing due to
null
values e.gstring.max()
- fix export error
breaking
- Removed the
extend
andcreate
methods. Use whatever javascript inheritance patterns you want instead. - the resolution order of defaults and coercions has changed. as well as the general handling of
null
values.- Number:
null
will coerce tofalse
whennullable()
is not specified.NaN
values will now failisType()
checks - String:
null
will coerce to''
whennullable()
is not specified - Date: Invalid dates will not be coerced to
null
, but left as invalid date, This is probably not a problem for anyone as invalid dates will also failisType()
checks
- Number:
- default values are cloned everytime they are returned, so it is impossible to share references to defaults across schemas. No one should be doing that anyway
- stopped pretending that using schemas as conditions in
when()
actually worked (it didn't)
other changes
transform()
now passes the original value to each transformer. Allowing you to recover from a bad transform.- added the
equals()
alias foroneOf
breaking
- isValid is now async, provide a node style callback, or use the promise the method returns to read the validity. This change allows for more robust validations, specifically remote ones for client code (or db queries for server code). The cast method is still, and will remain, synchronous.
other changes
- added validate method (also async) which resolves to the value, and rejects with a new ValidationError