UNPKG

@mintlify/validation

Version:

Validates mint.json files

14 lines (13 loc) 539 B
export const customErrorMap = (issue, ctx) => { switch (issue.code) { case 'invalid_type': if (issue.received === 'undefined') return { message: 'This field is required' }; return { message: `Invalid type. Expected field to be of type '${issue.expected}', received '${issue.received}'`, }; case 'invalid_union': return { message: `Invalid type. Field did not match any types in union` }; } return { message: ctx.defaultError }; };