Open kevinmelo opened 3 months ago
latest
When i validate using VineJs and one of the keys is a enum but can be null it's give me de following error:
TypeError: Cannot convert undefined or null to object at Function.values (<anonymous>) at _VineNativeEnum
with the following json:
{ "object": "my_object", "entry": [ { "id": "0", "time": 1723073445, "changes": [ { "field": "any_field", "value": { "event": "APPROVED", "message_template_id": 12345678, "message_template_name": "my_message_template", "message_template_language": "pt-BR", "reason": null } } ] } ] }
The Complete vine schema:
export default vine.compile( vine.object({ object: vine.string(), entry: vine.array( vine.object({ id: vine.string(), time: vine.number(), changes: vine.array( vine.object({ field: vine.string(), value: vine.object({ event: vine.enum(OTHER_ENUM), message_template_id: vine.number(), message_template_name: vine.string(), message_template_language: vine.string(), reason: vine.enum(MY_ENUM).nullable(), }), }) ), }) ), }) )
Where the erro occurs reason: vine.enum(MY_ENUM).nullable(),
reason: vine.enum(MY_ENUM).nullable(),
No response
Can you please share the complete Vine schema
Sure, i update the first comment with the Vine Schema
Package version
latest
Describe the bug
When i validate using VineJs and one of the keys is a enum but can be null it's give me de following error:
TypeError: Cannot convert undefined or null to object at Function.values (<anonymous>) at _VineNativeEnum
with the following json:
The Complete vine schema:
Where the erro occurs
reason: vine.enum(MY_ENUM).nullable(),
Reproduction repo
No response