{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/confighub/json-schema/confighub-space-schema.json",
  "title": "Space",
  "description": "The logical container for most entities in ConfigHub. Namespaces triggers, units, targets, workers, and other entities.",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/confighub-openapi.json#/components/schemas/Space",
  "required": [
    "Slug"
  ],
  "type": "object",
  "properties": {
    "Annotations": {
      "type": "object",
      "additionalProperties": {
        "maxLength": 1024,
        "pattern": "^(.|\\n)*$",
        "type": "string"
      },
      "description": "An optional map of Annotation key/value pairs for tools to attach information to entities.",
      "x-confighub-where": {
        "dataType": "map[string]string"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "AttributeFilterID": {
      "type": "string",
      "description": "Reference to a Filter entity used to identify Attributes for the Space's FunctionExecutor. The Filter's From field must be set to 'Attribute'.",
      "format": "uuid",
      "x-confighub-where": {
        "dataType": "uuid",
        "references": "Filter",
        "expandable": true
      }
    },
    "AttributeHash": {
      "type": "string",
      "description": "Hash of the configurations of the Attributes in AttributeIDs, which changes whenever the Space's function executor does. (readonly)",
      "readOnly": true,
      "x-confighub-where": {
        "dataType": "string"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "AttributeIDs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/UUID"
      },
      "description": "List of Attribute IDs the Space's function executor is built from: those that match the WhereAttribute and/or AttributeFilterID criteria, or, when neither is set, the Attributes in the Space. (readonly)",
      "readOnly": true,
      "x-confighub-where": {
        "dataType": "[]uuid",
        "references": "Attribute",
        "expandable": true
      },
      "x-go-type-skip-optional-pointer": true
    },
    "BackingUnitID": {
      "type": "string",
      "format": "uuid",
      "readOnly": true,
      "x-confighub-where": {
        "dataType": "uuid",
        "references": "Unit"
      }
    },
    "ComponentID": {
      "type": "string",
      "description": "Reference to the Component this Space is a Variant of. (optional)",
      "format": "uuid",
      "x-confighub-where": {
        "dataType": "uuid",
        "references": "Component",
        "expandable": true
      }
    },
    "CreatedAt": {
      "type": "string",
      "description": "The timestamp when the entity was created in \"2023-01-01T12:00:00Z\" format.",
      "format": "date-time",
      "readOnly": true,
      "x-confighub-where": {
        "dataType": "time"
      },
      "x-go-type-skip-optional-pointer": true,
      "x-omitzero": true
    },
    "DeleteGates": {
      "type": "object",
      "additionalProperties": {
        "type": "boolean"
      },
      "description": "An optional set of gates that, if any is present, will block deletion.",
      "x-confighub-where": {
        "dataType": "map[string]bool"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "DisplayName": {
      "type": "string",
      "description": "Friendly name for the entity.",
      "x-confighub-where": {
        "dataType": "string"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "EntityType": {
      "type": "string",
      "description": "The type of entity.",
      "readOnly": true,
      "x-go-type-skip-optional-pointer": true
    },
    "HiddenReason": {
      "maxLength": 64,
      "pattern": "^([A-Za-z0-9]([\\-_.A-Za-z0-9]*[A-Za-z0-9])?)?$",
      "type": "string",
      "description": "The reason the entity is hidden, if it is. A hidden entity is left out of List and Search results, and of what bulk operations act on, unless the include_hidden parameter names its reason or is *, or the where parameter names the entity by Slug or ID. ConfigHub/YAML Units are created hidden with the reason BackingUnit unless given another.",
      "x-confighub-where": {
        "dataType": "string"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "Labels": {
      "type": "object",
      "additionalProperties": {
        "maxLength": 128,
        "pattern": "^[\\-_@/#$%&~+=!?.,:;(){}\\[\\]<>|A-Za-z0-9](([\\-_@/#$%&~+=!?.,:;(){}\\[\\]<>|A-Za-z0-9]| )*[\\-_@/#$%&~+=!?.,:;(){}\\[\\]<>|A-Za-z0-9])?$",
        "type": "string"
      },
      "description": "An optional map of Label key/value pairs to specify identifying attributes of entities for the purpose of grouping and filtering them.",
      "x-confighub-where": {
        "dataType": "map[string]string"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "OCIRepositoryURL": {
      "type": "string",
      "description": "The OCI repository the Space's Releases are served from, set when the Space has a ReleaseTargetID. It is oci://<registry host>:<port>/space/<space slug>, for a GitOps operator such as Argo CD or Flux to pull: its tag latest is the newest Release published for the Space's current release Target, and a ManifestDigest pins one. The registry is the one GET /api/info advertises to the same caller (OCIHost and OCIPort). Derived when the entity is read rather than stored, and returned whatever select names. (readonly)",
      "readOnly": true,
      "x-confighub-where": {
        "dataType": "string"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "OrganizationID": {
      "type": "string",
      "description": "Unique identifier for an organization.",
      "format": "uuid",
      "x-confighub-where": {
        "dataType": "uuid",
        "references": "Organization",
        "expandable": true
      },
      "x-go-type-skip-optional-pointer": true,
      "x-omitzero": true
    },
    "Permissions": {
      "allOf": [
        {
          "$ref": "#/$defs/Permissions"
        }
      ],
      "description": "Permissions to access this space.",
      "x-confighub-where": {
        "dataType": "map[string]map[string]map[uuid]bool"
      }
    },
    "ReleaseTargetID": {
      "type": "string",
      "description": "Reference to a Target used as the default Target for all Units in this Space.",
      "format": "uuid",
      "x-confighub-where": {
        "dataType": "uuid",
        "references": "Target",
        "expandable": true
      }
    },
    "Slug": {
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9]([\\-_.A-Za-z0-9]*[A-Za-z0-9])?$",
      "type": "string",
      "description": "Unique URL-safe identifier for the entity.",
      "x-confighub-where": {
        "dataType": "string"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "SpaceID": {
      "type": "string",
      "description": "Unique identifier for a space.",
      "format": "uuid",
      "x-confighub-where": {
        "dataType": "uuid"
      },
      "x-go-type-skip-optional-pointer": true,
      "x-omitzero": true
    },
    "TriggerFilterID": {
      "type": "string",
      "description": "Reference to a Filter entity used to identify Triggers that should be invoked on Units within this Space. The Filter's From field must be set to 'Trigger'.",
      "format": "uuid",
      "x-confighub-where": {
        "dataType": "uuid",
        "references": "Filter",
        "expandable": true
      }
    },
    "TriggerHash": {
      "type": "string",
      "readOnly": true,
      "x-confighub-where": {
        "dataType": "string"
      },
      "x-go-type-skip-optional-pointer": true
    },
    "TriggerIDs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/UUID"
      },
      "description": "List of Trigger IDs that match the WhereTrigger and/or TriggerFilterID criteria, or, with neither, of the Triggers in the Space. (readonly)",
      "readOnly": true,
      "x-confighub-where": {
        "dataType": "[]uuid",
        "references": "Trigger",
        "expandable": true
      },
      "x-go-type-skip-optional-pointer": true
    },
    "UpdatedAt": {
      "type": "string",
      "description": "The timestamp when the entity was last updated in \"2023-01-01T12:00:00Z\" format.",
      "format": "date-time",
      "readOnly": true,
      "x-confighub-where": {
        "dataType": "time"
      },
      "x-go-type-skip-optional-pointer": true,
      "x-omitzero": true
    },
    "UpstreamSpaceID": {
      "type": "string",
      "format": "uuid",
      "readOnly": true,
      "x-confighub-where": {
        "dataType": "uuid",
        "references": "Space"
      }
    },
    "Version": {
      "type": "integer",
      "description": "An entity-specific sequence number used for optimistic concurrency control. The value read must be sent in calls to Update.",
      "format": "int64",
      "readOnly": false,
      "x-go-type-skip-optional-pointer": true
    },
    "WhereAttribute": {
      "type": "string",
      "description": "Filter expression to identify Attributes that should be registered in the Space's FunctionExecutor. The specified string is an expression for the purpose of filtering\nthe list of Attributes returned. The expression syntax was inspired by SQL.\nIt supports conjunctions using `AND` of relational expressions of the form *attribute*\n*operator* *attribute_or_literal*. The attribute names are case-sensitive and PascalCase,\nas in the JSON encoding.\nStrings support the following operators: `<`, `>`, `<=`, `>=`, `=`, `!=`, `LIKE`, `NOT LIKE`, `ILIKE`, `~~`, `!~~`, `~`, `~*`, `!~`, `!~*`, `IN`, `NOT IN`.\nString pattern operators: `LIKE` and `~~` for pattern matching with `%` and `_` wildcards,\n`ILIKE` for case-insensitive pattern matching, `NOT LIKE` and `!~~` for negated pattern matching.\nString regex operators: `~` for regex matching, `~*` for case-insensitive regex,\n`!~` and `!~*` for regex not matching (case-sensitive and insensitive).\nIntegers support the following operators: `<`, `>`, `<=`, `>=`, `=`, `!=`, `IN`, `NOT IN`.\nUUIDs and boolean attributes support equality and inequality only.\nUUID and time literals must be quoted as string literals.\nString literals are quoted with single quotes, such as `'string'`.\nTime literals use the same form as when serialized as JSON,\nsuch as: `CreatedAt > '2025-02-18T23:16:34'`.\nInteger and boolean literals are also supported for attributes of those types.\nArrays support the `?` operator to to match any element of the array,\nas in `FromLinkID ? '7c61626f-ddbe-41af-93f6-b69f4ab6d308'`.\nArrays can perform LEN() to check for length, as in `LEN(FromLinkID) > 0`.\nAn attribute naming a list of other entities can be filtered on their attributes with a `*` segment,\nas in `FromLink.*.Slug = 'upgrade-app'`, which holds when any element satisfies it.\nWithout the `*` such a reference is an error, since it names no single value to compare.\nMap support the dot notation to specify a particular map key, as in `Labels.tier = 'Backend'`.\nMaps support `IS NULL` and `IS NOT NULL` with dot notation to check for key absence or presence,\nas in `Labels.tier IS NULL` (key doesn't exist) or `Labels.tier IS NOT NULL` (key exists).\nComparison results can be tested with `IS TRUE`, `IS FALSE`, `IS NOT TRUE`, and `IS NOT FALSE`.\nThese are useful for nullable columns: `MergeSourceID = '<uuid>' IS NOT FALSE` matches rows where MergeSourceID equals the value OR is NULL.\nThe `IN` and `NOT IN` operators accept a comma-separated list of values in parentheses,\nsuch as `Slug IN ('slugone', 'slugtwo')` or `Labels.environment IN ('prod', 'staging')`.\nConjunctions are supported using the `AND` operator.\nAn example conjunction is:\n`CreatedAt >= '2025-01-07' AND Slug = 'test' AND Labels.mykey = 'myvalue'`.\n\nSupported attributes for filtering on Attribute: Annotations, AttributeID, BackingUnitID, CreatedAt, DataType, DeleteGates, DisplayName, Hash, HiddenReason, Labels, OrganizationID, Parameters, Permissions, ResourceTypePaths, Slug, SpaceID, ToolchainType, UpdatedAt, UpstreamAttributeID.\n\nThe whole string must be query-encoded.",
      "x-go-type-skip-optional-pointer": true
    },
    "WhereTrigger": {
      "type": "string",
      "description": "Filter expression to identify Triggers that should be invoked on Units within this Space. With neither it nor TriggerFilterID, the Triggers in the Space are invoked; a clone of such a Space selects the Triggers in the Space it was cloned from. The specified string is an expression for the purpose of filtering\nthe list of Triggers returned. The expression syntax was inspired by SQL.\nIt supports conjunctions using `AND` of relational expressions of the form *attribute*\n*operator* *attribute_or_literal*. The attribute names are case-sensitive and PascalCase,\nas in the JSON encoding.\nStrings support the following operators: `<`, `>`, `<=`, `>=`, `=`, `!=`, `LIKE`, `NOT LIKE`, `ILIKE`, `~~`, `!~~`, `~`, `~*`, `!~`, `!~*`, `IN`, `NOT IN`.\nString pattern operators: `LIKE` and `~~` for pattern matching with `%` and `_` wildcards,\n`ILIKE` for case-insensitive pattern matching, `NOT LIKE` and `!~~` for negated pattern matching.\nString regex operators: `~` for regex matching, `~*` for case-insensitive regex,\n`!~` and `!~*` for regex not matching (case-sensitive and insensitive).\nIntegers support the following operators: `<`, `>`, `<=`, `>=`, `=`, `!=`, `IN`, `NOT IN`.\nUUIDs and boolean attributes support equality and inequality only.\nUUID and time literals must be quoted as string literals.\nString literals are quoted with single quotes, such as `'string'`.\nTime literals use the same form as when serialized as JSON,\nsuch as: `CreatedAt > '2025-02-18T23:16:34'`.\nInteger and boolean literals are also supported for attributes of those types.\nArrays support the `?` operator to to match any element of the array,\nas in `FromLinkID ? '7c61626f-ddbe-41af-93f6-b69f4ab6d308'`.\nArrays can perform LEN() to check for length, as in `LEN(FromLinkID) > 0`.\nAn attribute naming a list of other entities can be filtered on their attributes with a `*` segment,\nas in `FromLink.*.Slug = 'upgrade-app'`, which holds when any element satisfies it.\nWithout the `*` such a reference is an error, since it names no single value to compare.\nMap support the dot notation to specify a particular map key, as in `Labels.tier = 'Backend'`.\nMaps support `IS NULL` and `IS NOT NULL` with dot notation to check for key absence or presence,\nas in `Labels.tier IS NULL` (key doesn't exist) or `Labels.tier IS NOT NULL` (key exists).\nComparison results can be tested with `IS TRUE`, `IS FALSE`, `IS NOT TRUE`, and `IS NOT FALSE`.\nThese are useful for nullable columns: `MergeSourceID = '<uuid>' IS NOT FALSE` matches rows where MergeSourceID equals the value OR is NULL.\nThe `IN` and `NOT IN` operators accept a comma-separated list of values in parentheses,\nsuch as `Slug IN ('slugone', 'slugtwo')` or `Labels.environment IN ('prod', 'staging')`.\nConjunctions are supported using the `AND` operator.\nAn example conjunction is:\n`CreatedAt >= '2025-01-07' AND Slug = 'test' AND Labels.mykey = 'myvalue'`.\n\nSupported attributes for filtering on Trigger: Annotations, Arguments, BackingUnitID, BridgeWorkerID, ChannelID, Clearance, CreatedAt, DeleteGates, Description, Disabled, DisplayName, Event, FunctionName, Guards, Hash, HiddenReason, InvocationID, Labels, OrganizationID, OtherDataSource, Permissions, Protect, Slug, SpaceID, ToolchainType, TriggerID, UnitFilterID, UpdatedAt, UpstreamTriggerID, Validating, Warn, WhereResource, WhereUnit.\n\nThe whole string must be query-encoded.",
      "x-go-type-skip-optional-pointer": true
    }
  },
  "$defs": {
    "Permissions": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/Subjects"
      }
    },
    "Subjects": {
      "type": "object",
      "properties": {
        "GroupIDs": {
          "type": "object",
          "additionalProperties": {
            "type": "boolean"
          },
          "x-go-type-skip-optional-pointer": true
        },
        "UserIDs": {
          "type": "object",
          "additionalProperties": {
            "type": "boolean"
          },
          "x-go-type-skip-optional-pointer": true
        }
      }
    },
    "UUID": {
      "type": "string",
      "format": "uuid"
    }
  }
}