Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Conversation

@renovate
Copy link

@renovate renovate bot commented Oct 27, 2023

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@types/node (source) ^18 -> ^22.15.11 age adoption passing confidence
@vinejs/vine ^1.4.0 -> ^3.0.1 age adoption passing confidence
bumpp ^9.1.1 -> ^10.1.0 age adoption passing confidence
vitest (source) ^0.31.4 -> ^3.1.3 age adoption passing confidence

Release Notes

vinejs/vine (@​vinejs/vine)

v3.0.1: Fix CamelCase utilities to not work with keys containing numbers

Compare Source

Bug Fixes
  • CamelCase utility to work with existing camelCase values with numbers (9012036), closes #​94

Full Changelog: vinejs/vine@v3.0.0...v3.0.1

v3.0.0: Breaking changes and bug fixes

Compare 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 optional fields as optional within the TypeScript types. This ensures the property can be missing altogether from the data object/inferred types vs being marked as undefined explicitly. For example:

// Schema
vine.object({
    username: vine.string(),
    age: vine.number().optional(),
})

// Old output
{
    age: number | undefined;
    username: string;
}

// New output
{
    age?: number | undefined;
    username: string;
}
SUBTYPE symbol

Custom types extending the VineJS BaseLiteralType now must define the symbols.SUBTYPE property on the schema. This property can be used by schema transformers to get a more accurate type for the schema node. Here's how the StringSchema defines the SUBTYPE property.

For example:

import { symbols, BaseLiteralType } from '@​vinejs/vine'

class MySchemaType extends BaseLiteralType<Input, Output, CamelCaseOutput> {
   [symbols.SUBTYPE] = 'multipartFile'
}
Bug Fixes
Features
  • add subtype property to schema output (818fbf0), closes #​64
  • add support for conditional validation in arrays, object, records and tuples (890228e), closes #​71
  • add support for parsing iso8601 dates (fe61951), closes #​65
  • add support for ULID validation (#​58) (02d3a28)
Pull Requests
New Contributors

Full Changelog: vinejs/vine@v2.1.0...v3.0.0

v2.1.0: Add "tryValidate", "toJSON" method and "in" validation rule

Compare Source

tryValidate

The tryValidate method 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.

const [error, result] = validator.tryValidate({ data: {} })

The try prefix is inspired from the Java world.

in

The in validation rule has been added for the VineNumber schema type and can be used to ensure the value of field is part of the allowed values list.

toJSON

The validator.toJSON method can be used to get the validator and its refs as JSON.

Commits

  • feat: add tryValidate method to Vine (a70ff38)
  • feat: add tryValidate method (cebb8e0)
  • fix: add "in" rule in default number rules (#​54) (39204e4)
  • chore: migrate to release-it (0b5e212)
  • feat: add in rule for number (#​53) (72912af)
  • feat: export modifiers (#​48) (34e07fc)
  • chore: update dependencies (a7e18b7)
  • style: reformat codebase (62d450c)
  • feat: add validator.toJSON method to get compiled schema and refs (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 types

Compare 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

const schema = vine.object({
  categories: vine.array(vine.number()),
})

const data = {
  categories: [1, 'foo', 'bar', 11],
}

The errors reported up until 2.0 were

{
  field: 'categories.*',
  index: 1,
  message: 'The 1 field must be a number',
  rule: 'number',
},
{
  field: 'categories.*',
  index: 2,
  message: 'The 2 field must be a number',
  rule: 'number',
}

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 the index property 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 the index property 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.

{
  field: 'categories.1',
  index: 1,
  message: 'The 1 field must be a number',
  rule: 'number',
},
{
  field: 'categories.2',
  index: 2,
  message: 'The 2 field must be a number',
  rule: 'number',
}

Infer Schema Input value ( Breaking )

After this release, you can infer the input values a Schema type accepts. Let's consider the following example.

import { InferInput } from '@&#8203;vinejs/vine/types'

const schema = vine.object({
  is_admin: vine.boolean()
})

InferInput<typeof Schema>
{
  is_admin: boolean | string | number
}

If you notice, the is_admin property accepts a boolean | string | number. VineJS is built for parsing form inputs submitted over HTTP. Therefore, it receives all inputs as string values and performs normalization before performing any sort of validation.

Because of this change, the BaseSchema classes accept another generic value for the InputTypes. 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. vinejs/vine@df27df8

Define 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:

{
  "contacts.0.email.required": "The primary email address is required",
  "contacts.*.email.required": "The email address is required",
}

Commits

  • style: remove unused type 9dd733c
  • feat: add support for inferring schema input types df27df8
  • feat: improve error reporting for fields inside arrays 3d59dad
  • chore: update dependencies 8ff246f

What's Changed

New Contributors

Full Changelog: vinejs/vine@v1.7.0...v2.0.0

v1.8.0: Add requiredIf rules

Compare Source

Please check docs to learn how requiredIf rules work. And check this PR to understand the difference between vine.union and requiredIf rules.

Commits

  • feat: implement requiredIf rules (#​42) 893d378
  • chore: update dependencies 81beff7
  • docs: update benchmarks (#​40) 21ac492
  • fix: typo on 'Symbol.for('schema_nme') (#​36) d2a03a3
  • Merge pull request #​39 from nakrovati/fix-lolo32-pr ef50170
  • fix: add joi & ajv to devDeps 200bb39
  • Merge branch 'develop' into fix-lolo32-pr 63c49e2
  • Merge pull request #​33 from nakrovati/develop f94d274
  • chore(benchmarks): add valibot 02ff0a5
  • fix(benchmark): use namespace to import yup d6f5589
  • chore(benchmarks): add ajv and joi benchmark libraries ffb2a4e

What's Changed

New Contributors

Full Changelog: vinejs/vine@v1.7.1...v1.8.0

v1.7.1: Bug fix and performance improvements

Compare Source

  • fix: unix timetamp validation with x format bcebea5
  • style: format source code 9dd9d85
  • chore: update dependencies 6e412b2
  • refactor: performance optimizations 3e35b83
  • chore: update dependencies 4c88fa1
  • refactor: dynamic import node:dns 92a48c8

What's Changed

Full Changelog: vinejs/vine@v1.7.0...v1.7.1

v1.7.0: Support for validating dates

Compare Source

This release adds support for validating dates in VineJS. You may check the documentation here. https://vinejs.dev/docs/types/date

The vine.date schema type accepts a string value formatted as a date and returns an instance of the JavaScript Date object. The reason we accept a string is because the data submitted over an HTTP request will always represent date/datetime as a string.

Once you have a date, you may validate it further by comparing it against a fixed value or compare it against values from other fields. You may refer the documentation to view all the available validation rules.

Commits

  • refactor: changes to vine validator options normalization e85356b
  • chore: update list of files to publish e07cb69
  • docs(README): remove snyk badge 1b5c497
  • docs: update github workflow badge url b39b00c
  • chore: pin typescript to 5.2 02c2945
  • feat: add weekday and weekend rules 223bb93
  • feat: add first set of date validation rules c893f10
  • feat: add support for comparing nested values in sameAs and notSameAs rules 628b4c7
  • chore: update dependencies and generate types using tsc ce6c52c
  • chore: update dependencies cf08e2a
  • feat: Serialize messages and fields when converting toJSON 72d098d
  • refactor(SimpleMessagesProperty): make fields property optional (#​18) 16bd6e8
  • Merge pull request #​16 from vinejs/snyk-upgrade-ee4daf504d32e111676c4eb19cecf239 5d2a97a
  • feat: upgrade camelcase from 7.0.1 to 8.0.0 f98e099

v1.6.0: Bundling with tsup

Compare Source

v1.5.3: Use validator.js specific imports

Compare Source

v1.5.2: Export VineValidator class

Compare Source

  • refactor: export VineValidator class cfaeeff
  • style: format source code 74ca7e0
  • chore: update dependencies 9b7bc07

Full Changelog: vinejs/vine@v1.5.1...v1.5.2

v1.5.1: Fix: Make schema classes Macroable to be extensible

Compare Source

  • ci: fix failing tests 2f5258c
  • ci: remove test.yml workflow file 89efc20
  • test: fix failing tests d04800c
  • test: add test for extending Vine class a417418
  • fix: make schema classes Macroable 41bd3d5

Full Changelog: vinejs/vine@v1.5.0...v1.5.1

v1.5.0: Add API to make validation metadata type-safe

Compare Source

In VineJS, you can pass runtime metadata to the validation pipeline, which you can access from the validation rules, union predicates, etc. The metadata API was not type-safe until now. However, this release allows you to define the static metadata types and a validation function to validate them at runtime.

Note: The metadata API is kept very simple because only a few schemas might need runtime metadata with a few properties to be functional.

One example is the unique validation rule. You might want the unique validation rule to check all the database rows except the one for the currently logged-in user. In that case, you will pass the currently logged-in userId to the statically compiled validation schema using metadata as follows.

const updateUserValidator = vine.compile(
  vine.object({
    email: vine.string().email().unique((field) => {
      console.log(field.meta.userId)
    }),
  })
)
await updateUserValidator.validate(data, {
  meta: { userId: request.auth.user.id }
})

However, there is no way to know that updateUserValidator needs the currently logged-in user id to be functional.

From @vinejs/[email protected], you can use the withMetaData method to define static types for the metadata a validator accepts. The schema will look as follows.

const updateUserValidator = vine
  .withMetaData<{ userId: number }>()
  .compile(
    vine.object({
      email: vine.string().email().unique((field) => {
        console.log(field.meta.userId)
      }),
    })
  )

You can pass a callback to withMetaData to validate the metadata at runtime if needed.

vine
  .withMetaData<{ userId: number }>((meta) => {
    // validate id and throw an error
 })

Commits

  • feat: add support for defining static metadata types and validator function 09c4097
  • chore: use @​adonisjs/tooling presets for tooling config a02908d
  • chore: upgrade japa to v3 4181ee4
  • chore: update dependencies f24ebb8
  • chore: add labels to exempt from stale and lock bot 92697c4
  • docs: fix contributing link fcad2fb

Full Changelog: vinejs/vine@v1.4.1...v1.5.0

v1.4.1: Export testing factories

Compare Source

  • fix: export testing factories ffe8279

Full Changelog: vinejs/vine@v1.4.0...v1.4.1

antfu-collective/bumpp (bumpp)

v10.1.0

Compare Source

   🚀 Features
    View changes on GitHub

v10.0.3

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v10.0.2

Compare Source

No significant changes

    View changes on GitHub

v10.0.1

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v10.0.0

Compare Source

   🚨 Breaking Changes
    View changes on GitHub

v9.11.1

Compare Source

   🚀 Features
    View changes on GitHub

v9.11.0

Compare Source

   🚀 Features
    View changes on GitHub

v9.10.2

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v9.10.1

Compare Source

   🚀 Features
    View changes on GitHub

v9.10.0

Compare Source

   🚀 Features
    View changes on GitHub

v9.9.3

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v9.9.2

Compare Source

No significant changes

    View changes on GitHub

v9.9.1

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v9.9.0

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v9.8.1

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v9.8.0

Compare Source

   🚀 Features
    View changes on GitHub

v9.7.1

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v9.7.0

Compare Source

   🚀 Features
    View changes on GitHub

v9.6.1

Compare Source

   🚀 Features
    View changes on GitHub

v9.6.0

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v9.5.2

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v9.5.1

Compare Source

   🚀 Features
    View changes on GitHub

v9.5.0

Compare Source

   🚀 Features
    View changes on GitHub

v9.4.2

Compare Source

   🚀 Features
    View changes on GitHub

v9.4.1

Compare Source

v9.4.0

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v9.3.1

Compare Source

   🚀 Features
    View changes on GitHub

v9.3.0

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v9.2.1

Compare Source

   🚀 Features
    View changes on GitHub

v9.2.0

Compare Source

   🚀 Features
    View changes on GitHub
vitest-dev/vitest (vitest)

v3.1.3

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v3.1.2

Compare Source

   🚀 Features
   🐞 Bug Fixes

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.

👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot changed the title chore(deps): update devdependency @types/node to v20 chore(deps): update npm packages (major) Nov 1, 2023
@renovate renovate bot force-pushed the renovate/major-npm branch 3 times, most recently from 7315773 to 829627f Compare November 8, 2023 03:02
@renovate renovate bot force-pushed the renovate/major-npm branch 5 times, most recently from 1d540f8 to 89bfa92 Compare November 18, 2023 11:20
@renovate renovate bot force-pushed the renovate/major-npm branch 6 times, most recently from 9494663 to 5fa2828 Compare November 25, 2023 08:47
@renovate renovate bot force-pushed the renovate/major-npm branch 4 times, most recently from f3a9e22 to c602bb2 Compare December 5, 2023 14:58
@renovate renovate bot force-pushed the renovate/major-npm branch 2 times, most recently from 8bdfedd to 62da3f9 Compare December 10, 2023 04:59
@renovate renovate bot force-pushed the renovate/major-npm branch 2 times, most recently from b5d070d to 3157f06 Compare December 20, 2023 05:07
@renovate renovate bot force-pushed the renovate/major-npm branch 4 times, most recently from fb77ad2 to 0cc71ab Compare January 6, 2024 05:55
@renovate renovate bot force-pushed the renovate/major-npm branch 3 times, most recently from 5e15297 to 7525070 Compare January 11, 2024 20:38
@renovate renovate bot force-pushed the renovate/major-npm branch 2 times, most recently from 22d8b20 to 9a723c9 Compare January 24, 2025 12:04
@renovate renovate bot force-pushed the renovate/major-npm branch 3 times, most recently from f2f7b11 to fb72b78 Compare February 1, 2025 00:11
@renovate renovate bot force-pushed the renovate/major-npm branch 2 times, most recently from f7e987f to fa1aa17 Compare February 7, 2025 11:58
@renovate renovate bot force-pushed the renovate/major-npm branch 3 times, most recently from 717587b to dec58c3 Compare February 19, 2025 07:55
@renovate renovate bot force-pushed the renovate/major-npm branch 4 times, most recently from a6851e4 to e35d358 Compare March 1, 2025 12:03
@renovate renovate bot force-pushed the renovate/major-npm branch 4 times, most recently from 470ca85 to 32a778e Compare March 12, 2025 07:37
@renovate renovate bot force-pushed the renovate/major-npm branch 2 times, most recently from 9003221 to 25254b6 Compare March 20, 2025 08:16
@renovate renovate bot force-pushed the renovate/major-npm branch 2 times, most recently from 1cd12b5 to c352a5a Compare March 28, 2025 23:52
@renovate renovate bot force-pushed the renovate/major-npm branch from c352a5a to b43c2a6 Compare April 3, 2025 03:54
@renovate renovate bot force-pushed the renovate/major-npm branch from b43c2a6 to 2e2c0fd Compare April 12, 2025 19:35
@renovate renovate bot force-pushed the renovate/major-npm branch 2 times, most recently from 287d83f to 6b139de Compare April 26, 2025 15:52
@renovate renovate bot force-pushed the renovate/major-npm branch from 6b139de to 0841309 Compare April 29, 2025 10:06
@renovate renovate bot force-pushed the renovate/major-npm branch from 0841309 to 8dce268 Compare May 6, 2025 04:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants