jarle / remix-adonisjs

Build fullstack Remix applications powered by AdonisJS
https://remix-adonisjs.matstack.dev/
MIT License
35 stars 2 forks source link

Bump @vinejs/vine from 1.8.0 to 2.0.0 #39

Closed dependabot[bot] closed 3 months ago

dependabot[bot] commented 4 months ago

Bumps @vinejs/vine from 1.8.0 to 2.0.0.

Release notes

Sourced from @​vinejs/vine's releases.

Improved error reporting for fields inside arrays and infer schema input types

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',
},
{
</tr></table> 

... (truncated)

Commits
  • 778ec59 chore(release): 2.0.0
  • 52d4107 chore(release): 2.0.0-0
  • 9dd733c style: remove unused type
  • df27df8 feat: add support for inferring schema input types
  • 3d59dad feat: improve error reporting for fields inside arrays
  • 8ff246f chore: update dependencies
  • See full diff in compare view


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)