mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-10 22:30:50 +08:00
Resolves #8899 This implementation adds a comprehensive JSON Schema for the ComfyUI Prompt API format to improve developer experience and API integration. Features: - JSON Schema definition for prompt format validation - Optional schema validation via ?validate_schema=true parameter - New /schema/prompt endpoint to serve the schema - Comprehensive documentation and examples - Backward compatible - no breaking changes Implementation: - api_schemas/prompt_format.json: Complete JSON Schema definition - api_schemas/validation.py: Validation utilities with graceful fallback - api_schemas/README.md: Detailed documentation and usage examples - server.py: Added schema endpoint and optional validation The schema validates: - Prompt structure and required fields - Node definitions with class_type and inputs - Connection format [node_id, output_slot] - Optional metadata like prompt_id, client_id, etc. Schema validation is opt-in via query parameter to ensure no breaking changes. If jsonschema package is not installed, validation is skipped with a warning.
21 lines
398 B
Python
21 lines
398 B
Python
"""
|
|
ComfyUI API Schema validation package
|
|
|
|
This package provides JSON Schema definitions and validation utilities
|
|
for the ComfyUI API endpoints.
|
|
"""
|
|
|
|
from .validation import (
|
|
validate_prompt_format,
|
|
load_prompt_schema,
|
|
get_schema_info,
|
|
JSONSCHEMA_AVAILABLE
|
|
)
|
|
|
|
__all__ = [
|
|
'validate_prompt_format',
|
|
'load_prompt_schema',
|
|
'get_schema_info',
|
|
'JSONSCHEMA_AVAILABLE'
|
|
]
|