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.

454 B
Raw Blame
import { parseLiteralValues } from './parse-literal-values';
import { parseSchema } from './parse-schema';
import type { JsonSchemaObject, Refs, Serializable } from '../types';

export const parseEnum = (jsonSchema: JsonSchemaObject & { enum: Serializable[] }, refs: Refs) => {
  const { enum: values, ...baseSchema } = jsonSchema;
  return parseSchema(baseSchema, { ...refs, seen: new Map(refs.seen) }, true).and(
    parseLiteralValues(values)
  );
};