UNPKG

@mintlify/validation

Version:

Validates mint.json files

31 lines (30 loc) 1.19 kB
import { iconTypes } from '@mintlify/models'; import { z } from 'zod'; import { anchorColorSchema } from './anchorColors.js'; import { openapiAnchorOrTab } from './openapiAnchorOrTab.js'; export const anchorSchema = z.object({ name: z.string().trim().nonempty(), url: z.string().trim().nonempty(), icon: z .string({ invalid_type_error: 'Anchor icon must be the name of a Font Awesome or Lucide icon. Browse their libraries to see all the available icons: https://fontawesome.com/icons, https://lucide.dev/icons', }) .refine((icon) => !icon.startsWith('fa-'), "Icon does not need to start with 'fa-'. Please delete 'fa-' and keep the rest of the icon name") .optional(), iconType: z.enum(iconTypes).optional(), color: anchorColorSchema.optional(), isDefaultHidden: z.boolean().optional(), version: z .string({ invalid_type_error: 'Version must be a string in the #.versions array', }) .optional(), openapi: openapiAnchorOrTab, }); export const topAnchorSchema = z .object({ name: z.string(), icon: z.string().optional(), iconType: z.enum(iconTypes).optional(), }) .strict();