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
Before posting an issue, read the FAQ and search the previous issues.
Description
while I read that discriminatedUnion might be deprecated (here). however, this issue also reproducible using valibot.variant. I don't know whether valibot might be deprecated as well
I just so happen to write this using zod
Using z.discriminatedUnion and z.string().array() ie:
which will always fail the zod schema and later throws SchemaError
If applicable, a MRE
inside +page.server.ts you can change the schema use between schema (z.string.array) and schema1 (z.string) https://www.sveltelab.dev/4adylfnc6g7pv98
The text was updated successfully, but these errors were encountered:
Description
while I read that discriminatedUnion might be deprecated (here). however, this issue also reproducible using
valibot.variant
. I don't know whether valibot might be deprecated as wellI just so happen to write this using zod
Using
z.discriminatedUnion
andz.string().array()
ie:it throws
SchemaError
on the serverHowever, it works when using
z.string()
Investigation
I did some investigation and found the responsible code is in this line
sveltekit-superforms/src/lib/formData.ts
Lines 201 to 209 in f2201d1
when parsing the form data,
property
is set asdefaultPropertyType
which is a{ type: 'string' }
it doesn't consider that on top level union the schema is as follow and doesn't have
properties
then it will call
parseSingleValue
and the output will bewhich will always fail the zod schema and later throws
SchemaError
If applicable, a MRE
inside +page.server.ts you can change the schema use between
schema
(z.string.array) andschema1
(z.string)https://www.sveltelab.dev/4adylfnc6g7pv98
The text was updated successfully, but these errors were encountered: