Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

466 B
Raw Blame
import { z } from 'zod/v3';

import { parseSchema } from './parse-schema';
import type { JsonSchemaObject, JsonSchema, Refs } from '../types';

export const parseNot = (jsonSchema: JsonSchemaObject & { not: JsonSchema }, refs: Refs) => {
  return z.any().refine(
    value =>
      !parseSchema(jsonSchema.not, {
        ...refs,
        path: [...refs.path, 'not'],
      }).safeParse(value).success,
    'Invalid input: Should NOT be valid against schema'
  );
};