UNPKG

@mintlify/validation

Version:

Validates mint.json files

34 lines (33 loc) 1.02 kB
import { fontFormats } from '@mintlify/models'; import { z } from 'zod'; export const fontDetailsSchema = z .object({ family: z.string().describe('The font family, such as "Open Sans", "Playfair Display"'), weight: z .number() .optional() .describe('The font weight, such as 400, 700. Precise font weights such as 550 are supported for variable fonts.'), source: z .string() .url() .optional() .describe('The font source, such as https://mintlify-assets.b-cdn.net/fonts/Hubot-Sans.woff2'), format: z.enum(fontFormats).optional().describe('The font format, can be one of woff, woff2'), }) .refine((data) => { if (data.source) { return !!data.format; } return true; }); export const fontsSchema = z .union([ fontDetailsSchema, z .object({ heading: fontDetailsSchema.optional(), body: fontDetailsSchema.optional(), }) .strict(), ]) .describe('The fonts to be used');