@mintlify/validation
Version:
Validates mint.json files
64 lines (63 loc) • 2.25 kB
JavaScript
import { z } from 'zod';
import { asyncApiSchema } from './reusable/asyncapi.js';
import { openApiSchema } from './reusable/openapi.js';
export const apiSchema = z
.object({
openapi: openApiSchema.optional(),
asyncapi: asyncApiSchema.optional(),
params: z
.object({
expanded: z
.enum(['all', 'closed'])
.optional()
.describe('The view mode of the API parameters. Defaults to `closed`.'),
})
.optional()
.describe('Configurations for the API parameters'),
playground: z
.object({
display: z
.enum(['interactive', 'simple', 'none'])
.optional()
.describe('The display mode of the API playground. Defaults to `interactive`.'),
proxy: z
.boolean()
.optional()
.describe('Whether to pass API requests through a proxy server. Defaults to `true`.'),
})
.optional()
.describe('Configurations for the API playground'),
examples: z
.object({
defaults: z
.enum(['required', 'all'])
.optional()
.describe('Whether to show only required parameters in the examples, defaults to `all`.'),
languages: z
.array(z.string())
.optional()
.describe('Example languages for the autogenerated API snippets'),
})
.optional()
.describe('Configurations for the autogenerated API examples'),
mdx: z
.object({
auth: z
.object({
method: z
.enum(['bearer', 'basic', 'key', 'cobo'])
.optional()
.describe('Authentication method for the API'),
name: z.string().optional().describe('Authentication name for the API'),
})
.optional()
.describe('Authentication configuration for the API'),
server: z
.union([z.string().url(), z.array(z.string().url())])
.optional()
.describe('Base URL(s) for the API'),
})
.optional()
.describe('Configurations for API pages generated from MDX files'),
})
.describe('API reference configuration and playground settings');