@firefliesai/schema-forge
Version:
Transform TypeScript classes into JSON Schema definitions with automatic support for OpenAI, Anthropic, and Google Gemini function calling (tool) formats
26 lines (25 loc) • 783 B
TypeScript
/**
* Core schema generation functionality
*/
import { JSONSchemaDefinition, JsonSchemaOptions } from './types';
/**
* Converts a TypeScript class to a JSON Schema
*
* @param target The class to convert
* @param options Options for schema generation
* @returns JSON Schema representation of the class
*
* @example
* // Basic usage
* const schema = classToJsonSchema(User);
*
* // With options
* const schema = classToJsonSchema(User, {
* forStructuredOutput: true,
* propertyOverrides: {
* 'username': { description: 'Custom description' }
* },
* structuredOutputFormat: 'openai', // unused
* });
*/
export declare function classToJsonSchema<T extends object>(target: new (...args: any[]) => T, options?: JsonSchemaOptions<T>): JSONSchemaDefinition;