{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/couchbase/main/json-schema/couchbase-eventing-function-schema.json",
  "title": "EventingFunction",
  "description": "Eventing Function definition",
  "x-generated": "2026-10-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/couchbase-functions-api-openapi.yml#/components/schemas/EventingFunction",
  "type": "object",
  "required": [
    "appname",
    "appcode"
  ],
  "properties": {
    "appname": {
      "type": "string",
      "description": "Name of the Eventing Function"
    },
    "appcode": {
      "type": "string",
      "description": "JavaScript handler code for the function"
    },
    "depcfg": {
      "type": "object",
      "description": "Dependency configuration including bindings",
      "properties": {
        "buckets": {
          "type": "array",
          "description": "Bucket bindings for the function",
          "items": {
            "type": "object",
            "properties": {
              "alias": {
                "type": "string",
                "description": "Alias name used in handler code"
              },
              "bucket_name": {
                "type": "string",
                "description": "Name of the bound bucket"
              },
              "scope_name": {
                "type": "string",
                "description": "Name of the scope"
              },
              "collection_name": {
                "type": "string",
                "description": "Name of the collection"
              },
              "access": {
                "type": "string",
                "description": "Access level for the bucket binding",
                "enum": [
                  "r",
                  "rw"
                ]
              }
            }
          }
        },
        "curl": {
          "type": "array",
          "description": "cURL bindings for external HTTP calls",
          "items": {
            "type": "object",
            "properties": {
              "hostname": {
                "type": "string",
                "description": "URL of the external endpoint"
              },
              "value": {
                "type": "string",
                "description": "Alias name used in handler code"
              },
              "auth_type": {
                "type": "string",
                "description": "Authentication type",
                "enum": [
                  "no-auth",
                  "basic",
                  "bearer",
                  "digest"
                ]
              },
              "allow_cookies": {
                "type": "boolean",
                "description": "Whether to allow cookies"
              },
              "validate_ssl_certificate": {
                "type": "boolean",
                "description": "Whether to validate SSL certificates"
              }
            }
          }
        },
        "constants": {
          "type": "array",
          "description": "Constant bindings",
          "items": {
            "type": "object",
            "properties": {
              "value": {
                "type": "string",
                "description": "Alias name"
              },
              "literal": {
                "type": "string",
                "description": "Constant value"
              }
            }
          }
        },
        "source_bucket": {
          "type": "string",
          "description": "Source bucket for mutations"
        },
        "source_scope": {
          "type": "string",
          "description": "Source scope for mutations"
        },
        "source_collection": {
          "type": "string",
          "description": "Source collection for mutations"
        },
        "metadata_bucket": {
          "type": "string",
          "description": "Metadata bucket for checkpoints"
        },
        "metadata_scope": {
          "type": "string",
          "description": "Metadata scope for checkpoints"
        },
        "metadata_collection": {
          "type": "string",
          "description": "Metadata collection for checkpoints"
        }
      }
    },
    "settings": {
      "type": "object",
      "description": "Function deployment settings",
      "properties": {
        "dcp_stream_boundary": {
          "type": "string",
          "description": "Starting point for processing mutations",
          "enum": [
            "everything",
            "from_now"
          ]
        },
        "deployment_status": {
          "type": "boolean",
          "description": "Whether the function is deployed"
        },
        "processing_status": {
          "type": "boolean",
          "description": "Whether the function is processing mutations"
        },
        "log_level": {
          "type": "string",
          "description": "Log level for the function",
          "enum": [
            "INFO",
            "ERROR",
            "WARNING",
            "DEBUG",
            "TRACE"
          ]
        },
        "language_compatibility": {
          "type": "string",
          "description": "Language compatibility version"
        },
        "execution_timeout": {
          "type": "integer",
          "description": "Maximum execution time for a single handler invocation in seconds"
        },
        "timer_context_size": {
          "type": "integer",
          "description": "Maximum size of timer context in bytes"
        },
        "worker_count": {
          "type": "integer",
          "description": "Number of worker threads"
        },
        "num_timer_partitions": {
          "type": "integer",
          "description": "Number of timer partitions"
        }
      }
    },
    "function_scope": {
      "type": "object",
      "description": "Scope of the function definition",
      "properties": {
        "bucket": {
          "type": "string",
          "description": "Bucket for the function scope"
        },
        "scope": {
          "type": "string",
          "description": "Scope name"
        }
      }
    }
  }
}