Skip to content

v4: get an error "Invalid key: Expected "address" but received undefined" if field is object in valibot schema #5120

@tripplicate

Description

@tripplicate

What happened?

I use vee-validate and valibot, dependencies in package.json:

 "dependencies": {
    "@vee-validate/valibot": "^4.15.1",
    "valibot": "^1.2.0",
    "vee-validate": "^4.15.1",
    "vue": "^3.5.27",
  },

If valibot's schema contains object field an "Invalid key: Expected "address" but received undefined" error is thrown. I think this happens because only for valibot integration meta.initialValues don't set with empty object's literals.

I found this bug when I updated valibot from 1.0.0.beta-3 to 1.2.0, but when I rolled back, the error continued to be thrown

Reproduction steps

  1. Create any valibot schema with object's field
  2. Do not set initial values in useForm

Version

Vue.js 3.x and vee-validate 4.x

What browsers are you seeing the problem on?

  • Firefox
  • Chrome
  • Safari
  • Microsoft Edge

Demo link

https://stackblitz.com/edit/vitejs-vite-st3i7srf?file=src%2FApp.vue

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions