From 57b81f4cb1b3ac9a75b1bf87f4faf8cdaff4c4d6 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Thu, 30 Dec 2021 14:02:13 -0500 Subject: [PATCH] docs --- CHANGELOG-pre.md | 24 ++++++++++++++++++++++++ README.md | 5 ++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CHANGELOG-pre.md b/CHANGELOG-pre.md index 10c3a81e3..6e5f0d994 100644 --- a/CHANGELOG-pre.md +++ b/CHANGELOG-pre.md @@ -1,3 +1,27 @@ +# [1.0.0-beta.0](https://github.com/jquense/yup/compare/v1.0.0-alpha.4...v1.0.0-beta.0) (2021-12-29) + + +* feat!: add json() method and remove default object/array coercion ([94b73c4](https://github.com/jquense/yup/commit/94b73c438b3d355253f488325e06c69378e71fc1)) + + +### Features + +* Make Array generic consistent with others ([a82353f](https://github.com/jquense/yup/commit/a82353f37735daec6e42d18bd4cc0efe52a20f50)) + + +### BREAKING CHANGES + +* types only, `ArraySchema` initial generic is the array type not the type of the array element. `array()` is still the inner type. +* object and array schema no longer parse JSON strings by default, nor do they return `null` for invalid casts. + +```ts +object().json().cast('{}') +array().json().cast('[]') +``` +to mimic the previous behavior + + + # [1.0.0-alpha.4](https://github.com/jquense/yup/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2021-12-29) ### Bug Fixes diff --git a/README.md b/README.md index 21e102679..1980cceb9 100644 --- a/README.md +++ b/README.md @@ -1399,6 +1399,7 @@ and use the result as the limit. Define an array schema. Arrays can be typed or not, When specifying the element type, `cast` and `isValid` will apply to the elements as well. Options passed into `isValid` are passed also passed to child schemas. + Inherits from [`Schema`](#Schema). ```js @@ -1418,9 +1419,7 @@ array().of(yup.number()); array(yup.number()); ``` -The default `cast` behavior for `array` is: [`JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) - -Failed casts return: `null`; +Arrays have no default casting behavior. #### `array.of(type: Schema): this`