@mintlify/validation
Version:
Validates mint.json files
33 lines (32 loc) • 1.39 kB
JavaScript
import { footerSocialKeys } from '@mintlify/models';
import { z } from 'zod';
import { hrefSchema } from './reusable/href.js';
export const footerLinkSchema = z.object({
label: z.string().nonempty('Link must have a non-empty label').describe('The label of the link'),
href: hrefSchema.describe('The url of the link'),
});
export const footerLinksColumnSchema = z.object({
header: z
.string()
.nonempty('Column must have a non-empty header')
.optional()
.describe('The header title of the column'),
items: z
.array(footerLinkSchema)
.min(1, 'Column must have at least 1 link')
.describe('The links to be displayed in the column'),
});
export const footerSocialsSchema = z
.record(z.enum(footerSocialKeys), z.string().url('Must be a valid url'))
.describe('An object in which each key is the name of a social media platform, and each value is the url to your profile. For example: { "x": "https://x.com/mintlify" }');
export const footerSchema = z
.object({
socials: footerSocialsSchema.optional(),
links: z
.array(footerLinksColumnSchema)
.min(1, 'A footer must have at least 1 links column')
.max(4, 'A footer can have a maximum of 4 links columns')
.optional()
.describe('The links to be displayed in the footer'),
})
.describe('Footer configurations');