{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mere.run/contracts/graph-node-invocation.v1.schema.json",
  "title": "mere.run Plugin Graph Node Invocation v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["contract_version", "job_id", "node_id", "kind", "arguments", "outputs"],
  "properties": {
    "contract_version": {"const": "mere.run/plugin-graph-invocation.v1"},
    "job_id": {"type": "string", "format": "uuid"},
    "node_id": {"type": "string", "pattern": "^[a-z][a-z0-9-]{0,63}$"},
    "kind": {"type": "string", "pattern": "^[a-z][a-z0-9-]{0,63}(\\.[a-z][a-z0-9-]{0,63})+$"},
    "arguments": {"type": "object", "additionalProperties": {"$ref": "#/$defs/value"}},
    "outputs": {
      "type": "object",
      "propertyNames": {"pattern": "^[a-z][a-z0-9_]{0,63}$"},
      "additionalProperties": {"$ref": "#/$defs/output"}
    }
  },
  "$defs": {
    "value": {
      "anyOf": [
        {"type": "null"},
        {"type": "string"},
        {"type": "integer"},
        {"type": "number"},
        {"type": "boolean"},
        {"type": "array", "items": {"$ref": "#/$defs/value"}},
        {"type": "object", "additionalProperties": {"$ref": "#/$defs/value"}}
      ]
    },
    "output": {
      "type": "object",
      "additionalProperties": false,
      "required": ["type"],
      "properties": {
        "type": {"enum": ["string", "integer", "number", "boolean", "enum", "json", "asset", "asset_directory", "asset_collection"]},
        "path": {"type": "string", "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},
        "optional": {"type": "boolean"},
        "content_types": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}}
      }
    }
  }
}
