45 lines
No EOL
1.5 KiB
TypeScript
45 lines
No EOL
1.5 KiB
TypeScript
/**
|
|
* Parameter Validation Utilities
|
|
*
|
|
* Zod schemas and validation functions for MCP tool parameters.
|
|
*/
|
|
|
|
import { z } from 'zod';
|
|
|
|
// TODO: Phase 1 - Implement parameter validation schemas
|
|
// Based on contracts/ghost-filtering.md and MCP tool specifications
|
|
|
|
// Common parameter schemas
|
|
export const limitSchema = z.number().min(1).max(50).optional();
|
|
export const pageSchema = z.number().min(1).optional();
|
|
export const filterSchema = z.string().optional();
|
|
export const includeSchema = z.string().optional();
|
|
export const fieldsSchema = z.string().optional();
|
|
|
|
// ID and slug schemas
|
|
export const idSchema = z.string().min(1);
|
|
export const slugSchema = z.string().min(1);
|
|
|
|
// Content schemas
|
|
export const titleSchema = z.string().min(1);
|
|
export const htmlSchema = z.string().optional();
|
|
export const lexicalSchema = z.string().optional();
|
|
export const statusSchema = z.enum(['draft', 'published', 'scheduled']).optional();
|
|
|
|
// Validation functions
|
|
export function validatePaginationParams(params: unknown): { limit?: number; page?: number } {
|
|
// TODO: Phase 1 - Implement validation
|
|
return params as { limit?: number; page?: number };
|
|
}
|
|
|
|
export function validateFilterSyntax(filter: string): boolean {
|
|
// TODO: Phase 1 - Implement Ghost filter syntax validation
|
|
// Based on contracts/ghost-filtering.md
|
|
return true;
|
|
}
|
|
|
|
export function validateContentFormat(content: unknown): 'lexical' | 'html' | 'mobiledoc' | 'unknown' {
|
|
// TODO: Phase 1 - Implement content format detection
|
|
// Based on contracts/content-formats.md
|
|
return 'unknown';
|
|
} |