UNPKG

@mintlify/validation

Version:

Validates mint.json files

21 lines (20 loc) 509 B
import { z } from 'zod'; export const hrefSchema = z .string() .refine((value) => { // Allow relative paths starting with / if (value.startsWith('/')) return true; // Allow mailto links if (value.startsWith('mailto:')) return true; // Allow absolute URLs try { new URL(value); return true; } catch (_a) { return false; } }, { message: 'Must be a valid url or relative path' }) .describe('A valid path or external link');