fabian-hiller/valibot (valibot)
### [`v0.21.0`](https://togithub.com/fabian-hiller/valibot/releases/tag/v0.21.0)
[Compare Source](https://togithub.com/fabian-hiller/valibot/compare/v0.20.1...v0.21.0)
Many thanks to [@Saeris](https://togithub.com/Saeris), [@lo1tuma](https://togithub.com/lo1tuma), [@david-plugge](https://togithub.com/david-plugge), [@ciscoheat](https://togithub.com/ciscoheat), [@kazizi55](https://togithub.com/kazizi55) and [@BastiDood](https://togithub.com/BastiDood) for contributing to this release.
- Change structure of schemas, validations and transformations to make properties accessible (pull request [#211](https://togithub.com/fabian-hiller/valibot/issues/211))
- Fix errors in JSDoc comments and add JSDoc ESLint plugin (pull request [#205](https://togithub.com/fabian-hiller/valibot/issues/205))
- Fix missing file extension for Deno (pull request [#249](https://togithub.com/fabian-hiller/valibot/issues/249))
#### Migration guide
The internal structure of schema and pipeline functions has changed as a result of [#211](https://togithub.com/fabian-hiller/valibot/issues/211). These changes affect people who have created their own schema, validation, or transformation functions.
```ts
import { type BaseValidation, type ErrorMessage, getOutput, getPipeIssues } from 'valibot';
// Change this
export function minLength(
requirement: number,
error?: ErrorMessage
) {
return (input: TInput): PipeResult =>
input.length < requirement
? getPipeIssues('min_length', error || 'Invalid length', input)
: getOutput(input);
}
// To that
export type MinLengthValidation<
TInput extends string | any[],
TRequirement extends number
> = BaseValidation & {
type: 'min_length';
requirement: TRequirement;
};
export function minLength<
TInput extends string | any[],
TRequirement extends number
>(
requirement: TRequirement,
message: ErrorMessage = 'Invalid length'
): MinLengthValidation {
return {
type: 'min_length',
async: false,
message,
requirement,
_parse(input) {
return input.length < this.requirement
? getPipeIssues(this.type, this.message, input, this.requirement)
: getOutput(input);
},
};
}
```
If you have any questions or problems, please have a look at the source code or create an [issue](https://togithub.com/fabian-hiller/valibot/issues/new). I usually respond within 24 hours.
### [`v0.20.1`](https://togithub.com/fabian-hiller/valibot/releases/tag/v0.20.1)
[Compare Source](https://togithub.com/fabian-hiller/valibot/compare/v0.20.0...v0.20.1)
Many thanks to [@lo1tuma](https://togithub.com/lo1tuma) for contributing to this release.
- Remove `never` from type signatur of strict objects and tuples (issue [#234](https://togithub.com/fabian-hiller/valibot/issues/234))
### [`v0.20.0`](https://togithub.com/fabian-hiller/valibot/releases/tag/v0.20.0)
[Compare Source](https://togithub.com/fabian-hiller/valibot/compare/v0.19.0...v0.20.0)
Many thanks to [@lo1tuma](https://togithub.com/lo1tuma), [@Karakatiza666](https://togithub.com/Karakatiza666), [@naveen-bharathi](https://togithub.com/naveen-bharathi), [@jsudelko](https://togithub.com/jsudelko), [@danielo515](https://togithub.com/danielo515), [@iamriajul](https://togithub.com/iamriajul), [@brandonpittman](https://togithub.com/brandonpittman), [@marek-hanzal](https://togithub.com/marek-hanzal), [@kurtextrem](https://togithub.com/kurtextrem), [@BThomann](https://togithub.com/BThomann), [@hermanseder](https://togithub.com/hermanseder), [@sillvva](https://togithub.com/sillvva), [@tjenkinson](https://togithub.com/tjenkinson) and many more peoples for contributing to this release.
- Add `getRestAndDefaultArgs` utility function
- Add `rest` argument to `object` and `objectAsync` schema
- Add `variant` and `variantAsync` schema (issue [#90](https://togithub.com/fabian-hiller/valibot/issues/90), [#216](https://togithub.com/fabian-hiller/valibot/issues/216))
- Add `getFallback` property to schema in `fallback` method (pull request [#177](https://togithub.com/fabian-hiller/valibot/issues/177))
- Add `PartialObjectEntries` and `PartialObjectEntriesAsync` type (issue [#217](https://togithub.com/fabian-hiller/valibot/issues/217))
- Add export for any validation regex (pull request [#219](https://togithub.com/fabian-hiller/valibot/issues/219))
- Add `getDefaultAsync`, `getDefaults` and `getDefaultsAsync`, `getFallback`, `getFallbackAsync`, `getFallbacks`, `getFallbacksAsync` method (issue [#155](https://togithub.com/fabian-hiller/valibot/issues/155))
- Add support for schema validation to `transform` and `transformAsync`
- Fix type check in `date` and `dateAsync` for invalid dates (pull request [#214](https://togithub.com/fabian-hiller/valibot/issues/214))
- Improve security of regular expressions (pull request [#202](https://togithub.com/fabian-hiller/valibot/issues/202))
- Improve `optional`, `optionalAsync`, `nullable`, `nullableAsync`, `nullish` and `nullishAsync` schema
- Change `ObjectSchema` and `ObjectSchemaAsync` type
- Change type check in `tuple` and `tupleAsync` to be less strict
- Change return type of `action` argument in `coerce` and `coerceAsync` to `unknown`
- Change type of `brand`, `getDefault`, `transform` and `transformAsync` method
- Change type of `array`, `arrayAsync`, `intersection`, `intersectionAsync`, `map`, `mapAsync`, `object`, `objectAsync`, `union`, `unionAsync`, `record`, `recordAsync`, `set`, `setAsync`, `tuple` and `tupleAsync` schema
- Rename `schema` property of every schema type to `type`
- Rename `intersection` and `intersectionAsync` schema to `intersect` and `intersectAsync`
- Rename `enumType` and `enumTypeAsync` schema to `picklist` and `picklistAsync`
- Rename `nativeEnum` and `nativeEnumAsync` schema to `enum_` and `enumAsync`
- Rename `nullType` and `nullTypeAsync` schema to `null_` and `nullAsync`
- Rename `undefinedType` and `undefinedTypeAsync` schema to `undefined_` and `undefinedAsync`
- Rename `voidType` and `voidTypeAsync` schema to `void_` and `voidAsync`
- Rename `default` property of `optional`, `optionalAsync`, `nullable`, `nullableAsync`, `nullish` and `nullishAsync` schema to `getDefault`
- Rename `ObjectShape` and `ObjectShapeAsync` types to `ObjectEntries` and `ObjectEntriesAsync`
- Rename `TupleShape` and `TupleShapeAsync` types to `TupleItems` and `TupleItemsAsync`
- Deprecate `passthrough`, `strict` and `strip` method in favor of `object` schema with `rest` argument
##### Migration guide
Unfortunately, I haven't had time to write a migration guide yet. If you have any questions or problems, please have a look at the source code or create an [issue](https://togithub.com/fabian-hiller/valibot/issues/new). I usually respond within 24 hours.
### [`v0.19.0`](https://togithub.com/fabian-hiller/valibot/releases/tag/v0.19.0)
[Compare Source](https://togithub.com/fabian-hiller/valibot/compare/v0.18.0...v0.19.0)
Many thanks to [@lo1tuma](https://togithub.com/lo1tuma), [@Saeris](https://togithub.com/Saeris), [@sillvva](https://togithub.com/sillvva), [@kazizi55](https://togithub.com/kazizi55), [@FleetAdmiralJakob](https://togithub.com/FleetAdmiralJakob), [@kurtextrem](https://togithub.com/kurtextrem), [@xinha-sh](https://togithub.com/xinha-sh) and [@husseyexplores](https://togithub.com/husseyexplores) for contributing to this release.
- Add `notBytes`, `notLength`, `notSize` and `notValue` validation function (pull request [#194](https://togithub.com/fabian-hiller/valibot/issues/194))
- Add support for unions as key of `record` and `recordAsync` schema (issue [#201](https://togithub.com/fabian-hiller/valibot/issues/201))
- Add support for pipeline validation to `transform` and `transformAsync` (issue [#197](https://togithub.com/fabian-hiller/valibot/issues/197))
- Change regex of `email` validation to improve performance and security (pull request [#180](https://togithub.com/fabian-hiller/valibot/issues/180))
- Change `object` and `objectAsync` schema to exclude non-existing keys (issue [#199](https://togithub.com/fabian-hiller/valibot/issues/199))
- Fix types at `brand`, `transform` and `unwrap` method (issue [#195](https://togithub.com/fabian-hiller/valibot/issues/195))
- Deprecate `equal` validation function in favor of `value` (issue [#192](https://togithub.com/fabian-hiller/valibot/issues/192))
### [`v0.18.0`](https://togithub.com/fabian-hiller/valibot/releases/tag/v0.18.0)
[Compare Source](https://togithub.com/fabian-hiller/valibot/compare/v0.17.1...v0.18.0)
Many thanks to [@alonidiom](https://togithub.com/alonidiom), [@davidmyersdev](https://togithub.com/davidmyersdev), [@Karakatiza666](https://togithub.com/Karakatiza666), [@abd2561024](https://togithub.com/abd2561024) and [@brandonpittman](https://togithub.com/brandonpittman) for contributing to this release.
- Add `intersection` and `intersectionAsync` schema (pull request [#117](https://togithub.com/fabian-hiller/valibot/issues/117))
- Fix `RecordInput` and `RecordOutput` type (pull request [#184](https://togithub.com/fabian-hiller/valibot/issues/184))
- Change `RecordSchema` and `RecordSchemaAsync` type
- Change `flatten` function and improve types
### [`v0.17.1`](https://togithub.com/fabian-hiller/valibot/releases/tag/v0.17.1)
[Compare Source](https://togithub.com/fabian-hiller/valibot/compare/v0.17.0...v0.17.1)
Many thanks to [@syhol](https://togithub.com/syhol) and [@adoublef](https://togithub.com/adoublef) for contributing to this release.
- Fix missing file extensions for Deno (pull request [#178](https://togithub.com/fabian-hiller/valibot/issues/178), [#181](https://togithub.com/fabian-hiller/valibot/issues/181))
### [`v0.17.0`](https://togithub.com/fabian-hiller/valibot/releases/tag/v0.17.0)
[Compare Source](https://togithub.com/fabian-hiller/valibot/compare/v0.16.0...v0.17.0)
Many thanks to [@zkulbeda](https://togithub.com/zkulbeda), [@vicimpa](https://togithub.com/vicimpa), [@jonlambert](https://togithub.com/jonlambert) and [@gmaxlev](https://togithub.com/gmaxlev) for contributing to this release.
- Add support for multiple branding of a value (pull request [#88](https://togithub.com/fabian-hiller/valibot/issues/88))
- Add support for dynamic error messages via functions (pull request [#136](https://togithub.com/fabian-hiller/valibot/issues/136))
- Add `skipPipe` option to skip execution of pipelines (pull request [#164](https://togithub.com/fabian-hiller/valibot/issues/164))
### [`v0.16.0`](https://togithub.com/fabian-hiller/valibot/releases/tag/v0.16.0)
[Compare Source](https://togithub.com/fabian-hiller/valibot/compare/v0.15.0...v0.16.0)
Many thanks to [@jmcdo29](https://togithub.com/jmcdo29), [@divndev](https://togithub.com/divndev) and [@demarchenac](https://togithub.com/demarchenac) for contributing to this release.
- Add `ulid` validation (pull request [#151](https://togithub.com/fabian-hiller/valibot/issues/151))
- Add `getIssues`, `getOutput` and `getPipeIssues` util and refactor code
- Fix type check in `number` and `numberAsync` schema (issue [#157](https://togithub.com/fabian-hiller/valibot/issues/157))
- Change `PipeResult` type to allow multiple issues (issue [#161](https://togithub.com/fabian-hiller/valibot/issues/161))
- Rename previous `getIssues` util to `getSchemaIssues`
#### Migration guide
For individual validation within a pipeline, it is now possible to return multiple issues. In addition, we provide two helper functions with `getOutput` and `getPipeIssues` to make your code more readable.
```ts
import { getOutput, getPipeIssues, string } from 'valibot';
// Change this
const StringSchema = string([
(input) => {
if (input.length > 10) {
return {
issue: {
validation: 'custom',
message: 'Invalid length',
input,
},
};
}
return { output: input };
},
]);
// To that
const StringSchema = string([
(input) =>
input.length > 10
? getPipeIssues('custom', 'Invalid length', input)
: getOutput(input),
]);
```
Configuration
π Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
π¦ Automerge: Enabled.
β» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
π Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
0.15.0
->0.21.0
Release Notes
fabian-hiller/valibot (valibot)
### [`v0.21.0`](https://togithub.com/fabian-hiller/valibot/releases/tag/v0.21.0) [Compare Source](https://togithub.com/fabian-hiller/valibot/compare/v0.20.1...v0.21.0) Many thanks to [@Saeris](https://togithub.com/Saeris), [@lo1tuma](https://togithub.com/lo1tuma), [@david-plugge](https://togithub.com/david-plugge), [@ciscoheat](https://togithub.com/ciscoheat), [@kazizi55](https://togithub.com/kazizi55) and [@BastiDood](https://togithub.com/BastiDood) for contributing to this release. - Change structure of schemas, validations and transformations to make properties accessible (pull request [#211](https://togithub.com/fabian-hiller/valibot/issues/211)) - Fix errors in JSDoc comments and add JSDoc ESLint plugin (pull request [#205](https://togithub.com/fabian-hiller/valibot/issues/205)) - Fix missing file extension for Deno (pull request [#249](https://togithub.com/fabian-hiller/valibot/issues/249)) #### Migration guide The internal structure of schema and pipeline functions has changed as a result of [#211](https://togithub.com/fabian-hiller/valibot/issues/211). These changes affect people who have created their own schema, validation, or transformation functions. ```ts import { type BaseValidation, type ErrorMessage, getOutput, getPipeIssues } from 'valibot'; // Change this export function minLengthConfiguration
π Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
π¦ Automerge: Enabled.
β» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
π Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.