Validation
It is advisable to validate the intents.json before deploying it to the bot. This can be achieved using tools such as a JSON schema validator or Zod.
Here is the version 1 (V1) validator implemented with Zod:
import { z } from 'zod';
const parametersSchema = z.object({
type: z.literal('object'),
properties: z.record(
z.object({
type: z.string(),
description: z.string(),
})
),
required: z.array(z.string()),
});
const intentSchema = z.object({
name: z.string(),
description: z.string(),
parameters: parametersSchema,
async: z.boolean(),
link: z.string(),
example: z.string(),
returns: z.object({
type: z.literal('object'),
properties: z.record(
z.object({
type: z.string(),
description: z.string(),
})
),
}),
});
const schema = z.object({
schema: z.literal('v1'),
version: z.string(),
name: z.string(),
description: z.string(),
intents: z.array(intentSchema),
});