{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "LiveComponent Action Response", "description": "Schema for validating LiveComponent action responses", "oneOf": [ { "type": "object", "title": "Full HTML Response", "required": ["html", "state"], "properties": { "html": { "type": "string", "description": "Rendered component HTML" }, "state": { "$ref": "#/definitions/componentState" }, "events": { "type": "array", "description": "Component events to dispatch", "items": { "$ref": "#/definitions/componentEvent" } } }, "additionalProperties": false }, { "type": "object", "title": "Fragment Response", "required": ["fragments", "state"], "properties": { "fragments": { "type": "object", "description": "Fragment map for partial rendering", "additionalProperties": { "type": "string" } }, "state": { "$ref": "#/definitions/componentState" }, "events": { "type": "array", "description": "Component events to dispatch", "items": { "$ref": "#/definitions/componentEvent" } } }, "additionalProperties": false } ], "definitions": { "componentState": { "type": "object", "required": ["id", "component", "data", "version"], "properties": { "id": { "type": "string", "description": "Component ID (format: component-name:instance-id)", "pattern": "^[a-z0-9_-]+:[a-z0-9_.-]+$" }, "component": { "type": "string", "description": "Component name", "minLength": 1 }, "data": { "type": "object", "description": "Component state data", "additionalProperties": true }, "version": { "type": "integer", "description": "State version number", "minimum": 1 } }, "additionalProperties": false }, "componentEvent": { "type": "object", "required": ["name", "payload"], "properties": { "name": { "type": "string", "description": "Event name", "minLength": 1 }, "payload": { "type": "object", "description": "Event payload data", "additionalProperties": true }, "target": { "type": ["string", "null"], "description": "Target component ID (null for broadcast)" } }, "additionalProperties": false } } }