You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SchemaError: [addresses.additional.name] No default value specified for field (can be undefined, but must be explicit)
at Defaults_traverseAndReplace (/projects/sveltekit-superforms/src/lib/errors.ts:290:11)
at Errors_traverseAndReplace (/projects/sveltekit-superforms/src/lib/errors.ts:237:4)
at Data_traverse (/projects/sveltekit-superforms/src/lib/errors.ts:221:3)
at Module.replaceInvalidDefaults (/projects/sveltekit-superforms/src/lib/errors.ts:303:10)
at Module.superValidate (/projects/sveltekit-superforms/src/lib/superValidate.ts:139:5)
at /projects/sveltekit-superforms/src/tests/demo.test.ts:55:13
at runTest (file:///projects/sveltekit-superforms/node_modules/.pnpm/@[email protected]/node_modules/@vitest/runner/dist/index.js:781:11)
at runSuite (file:///projects/sveltekit-superforms/node_modules/.pnpm/@[email protected]/node_modules/@vitest/runner/dist/index.js:909:15)
at runSuite (file:///projects/sveltekit-superforms/node_modules/.pnpm/@[email protected]/node_modules/@vitest/runner/dist/index.js:909:15)
at runFiles (file:///projects/sveltekit-superforms/node_modules/.pnpm/@[email protected]/node_modules/@vitest/runner/dist/index.js:958:5) {
path: 'addresses.additional.name'
}
From the repro: The testcase bad produces this error trace, testcase good works
Basically the feature is to provide one of three possible address types, something like
You can't stringify __superform_json directly, you need to use devalue. Try that and see if it works. Otherwise you should try to add a default value to the schema, as suggested by the error.
Error trace
From the repro: The testcase bad produces this error trace, testcase good works
Basically the feature is to provide one of three possible address types, something like
where the 'none' type has no additional fields
Repro
Code
Should this kind of schema work ? Should this be modeled differently?
The text was updated successfully, but these errors were encountered: