{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ucp.dev/2026-08-25/schemas/common/types/constraint_expression.json",
  "title": "Constraint Expression",
  "description": "A closed JSON Schema Draft 2020-12 constraint expression with Object and Value Constraint positions.",
  "type": "object",
  "properties": {
    "required": {
      "type": "array",
      "description": "Property names required by the constrained object. Must be non-empty: an empty array applies no constraint.",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string"
      }
    },
    "properties": {
      "type": "object",
      "description": "Constraints keyed by property name. Must be non-empty: an empty object applies no constraint.",
      "minProperties": 1,
      "additionalProperties": {
        "oneOf": [
          {
            "$ref": "#"
          },
          {
            "$ref": "#/$defs/value_constraint"
          }
        ]
      }
    },
    "anyOf": {
      "type": "array",
      "description": "Alternative Object Constraints. The constrained object must satisfy at least one. A branch must be non-empty: an empty branch is satisfied by every object and neutralizes the alternation.",
      "minItems": 1,
      "items": {
        "$ref": "#",
        "minProperties": 1
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "value_constraint": {
      "type": "object",
      "description": "A Value Constraint containing `enum`, `const`, or both.",
      "anyOf": [
        {
          "required": [
            "enum"
          ]
        },
        {
          "required": [
            "const"
          ]
        }
      ],
      "properties": {
        "enum": {
          "type": "array",
          "description": "A non-empty array of unique JSON values.",
          "minItems": 1,
          "uniqueItems": true
        },
        "const": {}
      },
      "additionalProperties": false
    }
  }
}