Skip to content

Conversation

vivekchavan14
Copy link

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.

Resolves comfyanonymous#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add JSON Schema for Prompt API Format
1 participant