Open
Conversation
c6e104c to
94295eb
Compare
4716fce to
2fc23cd
Compare
2fc23cd to
4ef4360
Compare
4ef4360 to
1617429
Compare
1617429 to
cd9c3ab
Compare
cd9c3ab to
fe6c9c0
Compare
fe6c9c0 to
2921a41
Compare
2921a41 to
4d6e648
Compare
dc4ede3 to
d3638ba
Compare
d3638ba to
0da36e0
Compare
844ae76 to
f552fdd
Compare
f552fdd to
aaf83b8
Compare
This file contains hidden or 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
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.
This PR contains the following updates:
^1.8.0→^4.0.0Release Notes
vinejs/vine (@vinejs/vine)
v4.2.0: Partial objects, shorthand for creating object validators, new vat rule, and global transformsCompare Source
4.2.0 (2025-12-11)
Shorthand method to create object validators
Introduced
vine.create()method to create validators directly from top-level objects (7960e28). As a result of this, you do not have to usevine.compile(vine.object({})), justvine.create({})will give the same result.Object Schema Enhancement
Added
partial()method (initially namedtoOptional) to make all properties of an object schema optional (#127, 08a3472)Global Transforms
Added support for global transforms to transform date objects globally across all validators (f368feb). This will allow AdonisJS projects to always return a Luxon DateTime object when validating dates.
Bug Fixes
b34f1b0d28c949, closes #130Features
08a3472, closes #1277960e28f368feb752acffb6e3461strongPasswordrule (#132)b443638, closes #132vatrule (#131)999b667, closes #1312fea19cReverts
strongPasswordrule (#132)" (#134)f4e4ce5, closes #132 #134What's Changed
vatrule by @julienbenac in #131strongPasswordrule by @julienbenac in #132strongPasswordrule" by @thetutlage in #134New Contributors
Full Changelog: vinejs/vine@v4.1.0...v4.2.0
v4.1.0: Accept confirmation field alias via "as" propertyCompare Source
Features
Full Changelog: vinejs/vine@v4.0.1...v4.1.0
v4.0.1: Fix date rule to work when the field has been marked as optionalCompare Source
Bug Fixes
What's Changed
Full Changelog: vinejs/vine@v4.0.0...v4.0.1
v4.0.0: Bug fixes, support for standard schema, file validation, optional and nullable unionsCompare Source
Breaking changes
Removed
BaseModifiersclassThis release refactors parts of VineJS internals and removes the
BaseModifiersclass.In most cases, this change will not affect your application. However, if you were extending or directly using
BaseModifiersfor a custom use case, you may need to adjust your implementation.If you run into any issues, please open an issue on GitHub.
Report
confirmedrule errors on the confirmation fieldThe
confirmedrule is commonly used for fields likepasswordto ensure a matching field (for example,password_confirmation) has the same value.Previously, when the values didn’t match, the validation error was reported on the original field (e.g.
password).This created a poor user experience — you would see an error message like
This behavior has now been corrected.
Errors from the
confirmedrule are now reported on the confirmation field (e.g.password_confirmation).Since this changes the location of validation errors, it is considered a breaking change.
Introducing
dataTypeValidatorWe identified a bug in how Vine handled validations when
bail(false)was used.When
bailmode is disabled, all validations on a field should run — even if earlier ones fail.For example:
In this case, both
email()andminLength()validations should report errors.However, Vine stopped after the first failure because of an internal
field.isValidcheck.We removed this check to ensure all validations run as expected.
This change, however, introduced redundant type checks — for instance, if a field wasn’t a string, each subsequent rule (
email(),minLength(), etc.) had to recheck the type manually.To solve this, we introduced
dataTypeValidator.The
dataTypeValidatoris a special validator defined at the schema level (e.g.string,number, etc.).When it fails, the compiler automatically skips all subsequent validations for that field, preventing redundant checks and improving performance.
If you’ve defined custom Schema classes:
dataTypeValidatorfor each of them.trueorfalseand report errors using theerrorReporterwhen the check fails.Notable improvements
Added support for the Standard Schema specification
Vine validators now implement the Standard Schema specification.
This means Vine schemas can now integrate directly with tools and frameworks that support the standard — such as Hono.
Example:
unionOfTypesnow supportsliteral,optional, andnullableThe
unionOfTypesschema type now supports theoptional()andnullable()modifiers.You can also use the
literal()schema type within a union, allowing for more expressive and flexible validation rules.Example:
Here, the
ipRangefield can be:'*'Pick and omit properties from existing schemas
You can now compose new schemas from existing ones by picking or omitting specific properties.
This makes it easy to reuse and adapt schemas across different contexts without duplicating field definitions.
Use
object.pick()to select specific properties, orobject.omit()to exclude them.Example:
This keeps your schemas consistent, maintainable, and DRY.
Commits
Bug Fixes
45a1cbc](45a1cbca708926)), closes #87Code Refactoring
Features
BREAKING CHANGES
_confirmationfieldBaseModifiersclass does not exist anymore, hence cannot be exportedpositiveandnegativevalidation rules, since zero is a neutral number. If you want the old behavior, replacepositiverule withnonNegativeandnegativerule withnonPositive.v3.0.1: Fix CamelCase utilities not work with keys containing numbersCompare Source
Bug Fixes
Full Changelog: vinejs/vine@v3.0.0...v3.0.1
v3.0.0: Breaking changes and bug fixesCompare Source
This release contains a few breaking changes along with a handful of new improvements and bug fixes.
Breaking changes
Infer type
The infer type of schema now marks
optionalfields asoptionalwithin the TypeScript types. This ensures the property can be missing altogether from the data object/inferred types vs being marked asundefinedexplicitly. For example:SUBTYPE symbol
Custom types extending the VineJS
BaseLiteralTypenow must define thesymbols.SUBTYPEproperty on the schema. This property can be used by schema transformers to get a more accurate type for the schema node. Here's how theStringSchemadefines theSUBTYPEproperty.For example:
Bug Fixes
Features
Pull Requests
New Contributors
Full Changelog: vinejs/vine@v2.1.0...v3.0.0
v2.1.0: Add "tryValidate", "toJSON" method and "in" validation ruleCompare Source
tryValidateThe
tryValidatemethod can be used to perform validation without throwing a validation error. Instead, the errors are returned as the return value of the method, which is a tuple.The
tryprefix is inspired from the Java world.inThe
invalidation rule has been added for theVineNumberschema type and can be used to ensure the value of field is part of the allowed values list.toJSONThe
validator.toJSONmethod can be used to get the validator and its refs as JSON.Commits
a70ff38)cebb8e0)39204e4)0b5e212)72912af)34e07fc)a7e18b7)62d450c)5259933)What's Changed
New Contributors
Full Changelog: vinejs/vine@v2.0.0...v2.1.0
v2.0.0: Improved error reporting for fields inside arrays and infer schema input typesCompare Source
This release contains a couple of minor breaking changes. So let's first talk about them.
Improved error reporting for fields inside arrays ( Breaking )
In the previous versions of VineJS, the error reporting for fields inside arrays could have been better.
Given the following schema and data
The errors reported up until 2.0 were
If you notice, the field name inside arrays is defined as
categories.*and not the actual index of the item inside the array. Now, you may think that I can replace the*with theindexproperty value and get a nested path to the item index within the array.Well, the replacement of
*might work in this situation. But it will not work when there are errors inside nested arrays or the field that failed the validation is a grandchild of an array. Because theindexproperty only exists when the field is an immediate child of an array.But anyway, after this release, you do not have to perform any manual substitutions. The field names are nested paths with the correct index. The following is an example of errors with
@vinejs/vine@2.Infer Schema Input value ( Breaking )
After this release, you can infer the input values a Schema type accepts. Let's consider the following example.
If you notice, the
is_adminproperty accepts aboolean | string | number. VineJS is built for parsing form inputs submitted over HTTP. Therefore, it receives all inputs asstringvalues and performs normalization before performing any sort of validation.Because of this change, the
BaseSchemaclasses accept another generic value for theInputTypes. So, if you use the BaseSchema anywhere in your apps, make sure to pass the Input type as the first generic argument.Also, please consult this commit for a better understanding of the change.
df27df8Define error messages for specific array index or a wildcard ( New feature )
Now, you will be able to define custom error messages for specific array indexes with a wildcard fallback for rest of the indexes. For example:
Commits
9dd733cdf27df83d59dad8ff246fWhat's Changed
New Contributors
Full Changelog: vinejs/vine@v1.7.0...v2.0.0
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ 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 was generated by Mend Renovate. View the repository job log.