-
Notifications
You must be signed in to change notification settings - Fork 933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge next into master #1547
Merged
Merge next into master #1547
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* WIP * WIP * WIP * SAVEPOINT * WIP * SAVEPOINT * SAVEPOINT * convert tests * GH actions ci * test
BREAKING CHANGE: The function version of `when()` has been changed to make it easier to type. values are always passed as an array and schema, and options always the second and third argument. `this` is no longer set to the schema instance. and all functions _must_ return a schema to be type safe ```diff string() - .when('other', function (other) => { - if (other) return this.required() + .when('other', ([other], schema) => { + return other ? schema.required() : schema }) ```
BREAKING CHANGE: concat works shallowly now. Previously concat functioned like a deep merge for object, which produced confusing behavior with incompatible concat'ed schema. Now concat for objects works similar to how it works for other types, the provided schema is applied on top of the existing schema, producing a new schema that is the same as calling each builder method in order
BREAKING CHANGE: `mixed` schema are no longer treated as the base class for other schema types. It hasn't been for a while, but we've done some nasty prototype slinging to make it behave like it was. Now typescript types should be 1 to 1 with the actual classes yup exposes. In general this should not affect anything unless you are extending (via `addMethod` or otherwise) `mixed` prototype. ```diff import { - mixed, + Schema, } from 'yup'; - addMethod(mixed, 'method', impl) + addMethod(Schema, 'method', impl) ```
BREAKING CHANGE: 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
BREAKING CHANGE: types only, `ArraySchema` initial generic is the array type not the type of the array element. `array<T>()` is still the inner type.
* docs * WIP * chore: clean up internal test running APIs * fix order
Use rollup to produce flat bundles of yup.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Time to get more eyes on the v1 prereleases