{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openappdefinition.org/schema/0.2/catalog.schema.json",
  "title": "OAD 0.2 catalog",
  "description": "A catalog (*.oadcatalog.json): a versioned, publishable document that holds contracts. A contract describes one reusable part: a control (a building block for visual and voice surfaces) or a capability (typed access to the outside world).",
  "type": "object",
  "required": ["oadCatalog", "id", "version", "meta", "contracts"],
  "properties": {
    "$schema": {
      "description": "Optional URI of a JSON Schema for this document, for editors. Hosts ignore it.",
      "$ref": "common.schema.json#/$defs/uriReference"
    },
    "oadCatalog": {
      "title": "version marker",
      "description": "Spec version the catalog targets, MAJOR.MINOR. This schema validates version 0.2.",
      "$ref": "common.schema.json#/$defs/specVersion",
      "const": "0.2"
    },
    "id": {
      "description": "Globally unique identifier in reverse-DNS form, following the same rules as a definition's id.",
      "$ref": "common.schema.json#/$defs/reverseDnsId"
    },
    "version": {
      "description": "Semantic version of the catalog. Within a major version, contracts may only gain optional props, optional operation inputs, events and operations.",
      "$ref": "common.schema.json#/$defs/semver"
    },
    "meta": {
      "description": "Descriptive information about the catalog.",
      "$ref": "#/$defs/meta"
    },
    "uses": {
      "description": "Other catalogs this catalog uses, so that its types can refer to theirs as alias:TypeName and its requires and degradeTo entries can name their contracts as alias:contractName.",
      "$ref": "#/$defs/uses"
    },
    "types": {
      "description": "Optional shared type definitions, referenced from contracts by name and from definitions as alias:TypeName. A string type among them may list its known values.",
      "$ref": "#/$defs/types"
    },
    "contracts": {
      "description": "Contracts keyed by contract name.",
      "type": "object",
      "propertyNames": { "$ref": "common.schema.json#/$defs/name" },
      "additionalProperties": { "$ref": "#/$defs/contract" }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "types": {
      "title": "catalog types",
      "description": "An object of type name to restricted JSON Schema object, or to a string type with known values.",
      "type": "object",
      "propertyNames": { "$ref": "common.schema.json#/$defs/typeName" },
      "additionalProperties": { "$ref": "#/$defs/catalogType" }
    },
    "catalogType": {
      "title": "catalog type",
      "description": "A type of a catalog: a string type with known values when it has known, otherwise a restricted JSON Schema object.",
      "if": { "type": "object", "required": ["known"], "properties": { "known": true } },
      "then": { "$ref": "#/$defs/knownStringType" },
      "else": { "$ref": "common.schema.json#/$defs/typeSchema" }
    },
    "knownStringType": {
      "title": "string type with known values",
      "description": "A string type that lists the values every implementation should know. Any other string that conforms to the type is a valid value too.",
      "type": "object",
      "required": ["type", "known"],
      "properties": {
        "type": {
          "description": "Always string.",
          "const": "string"
        },
        "known": {
          "description": "The values every implementation should know: 1 to 256 distinct strings of 1 to 64 characters, each conforming to the type. Other values are allowed.",
          "type": "array",
          "items": { "type": "string", "minLength": 1, "maxLength": 64 },
          "minItems": 1,
          "maxItems": 256,
          "uniqueItems": true
        },
        "pattern": { "description": "A pattern every value and every known value must match, in the restricted pattern dialect of the expression language.", "$ref": "common.schema.json#/$defs/typeSchema/properties/pattern" },
        "minLength": { "description": "Minimum length of a value.", "$ref": "common.schema.json#/$defs/typeSchema/properties/minLength" },
        "maxLength": { "description": "Maximum length of a value.", "$ref": "common.schema.json#/$defs/typeSchema/properties/maxLength" },
        "default": { "description": "The value assumed when none is given.", "$ref": "common.schema.json#/$defs/typeSchema/properties/default" },
        "description": { "description": "Plain-language description of the value.", "$ref": "common.schema.json#/$defs/typeSchema/properties/description" },
        "title": { "description": "Short human-readable title.", "$ref": "common.schema.json#/$defs/typeSchema/properties/title" }
      },
      "additionalProperties": false
    },
    "uses": {
      "title": "catalog uses",
      "description": "References to other catalogs. The graph of catalogs using catalogs must be acyclic.",
      "type": "object",
      "properties": {
        "catalogs": {
          "description": "Maps a local alias to a catalog id and semver range, as a definition's uses.catalogs does.",
          "type": "object",
          "propertyNames": { "$ref": "common.schema.json#/$defs/name" },
          "additionalProperties": { "$ref": "common.schema.json#/$defs/versionedReference" }
        }
      },
      "additionalProperties": false
    },
    "meta": {
      "title": "catalog meta",
      "description": "Descriptive information about the catalog.",
      "type": "object",
      "required": ["name", "description"],
      "properties": {
        "name": {
          "description": "Human-readable name of the catalog.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "description": {
          "description": "Plain-language description of the catalog.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "publisher": {
          "description": "Who publishes the catalog.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "license": {
          "description": "License of the catalog, as an SPDX expression.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "homepage": {
          "description": "Home page of the catalog, as an absolute URI.",
          "$ref": "common.schema.json#/$defs/uri"
        }
      },
      "additionalProperties": false
    },
    "contract": {
      "title": "contract",
      "description": "A control or capability contract. kind selects the shape.",
      "type": "object",
      "oneOf": [
        { "$ref": "#/$defs/controlContract" },
        { "$ref": "#/$defs/capabilityContract" }
      ]
    },
    "deprecation": {
      "title": "deprecation",
      "description": "Marks a contract as deprecated: the version, and optionally a replacement and a note.",
      "type": "object",
      "required": ["version"],
      "properties": {
        "version": {
          "description": "Catalog version that deprecated the contract.",
          "$ref": "common.schema.json#/$defs/semver"
        },
        "replacement": {
          "description": "Name of the contract in this catalog to use instead.",
          "$ref": "common.schema.json#/$defs/name"
        },
        "note": {
          "description": "Optional note on why, or how to migrate.",
          "$ref": "common.schema.json#/$defs/text"
        }
      },
      "additionalProperties": false
    },
    "implementation": {
      "title": "implementation",
      "description": "A shipped implementation of the contract for one adapter.",
      "type": "object",
      "required": ["adapter", "module", "digest"],
      "properties": {
        "adapter": {
          "description": "The adapter the implementation targets, such as web, skia, native-ios, mcp or http.",
          "title": "adapter name",
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]*$"
        },
        "module": {
          "description": "The shipped module.",
          "$ref": "common.schema.json#/$defs/uriReference"
        },
        "digest": {
          "description": "Digest of the module's bytes.",
          "$ref": "common.schema.json#/$defs/digest"
        }
      },
      "additionalProperties": false
    },
    "requirement": {
      "title": "requirement",
      "description": "A capability and scopes the part itself needs in order to work. A definition using the part must request grants that cover these.",
      "type": "object",
      "required": ["contract", "scopes"],
      "properties": {
        "contract": {
          "description": "The capability contract: a contract name in this catalog, or alias:contractName for a contract in a catalog this catalog uses.",
          "$ref": "common.schema.json#/$defs/catalogContractRef"
        },
        "scopes": {
          "description": "Scopes of that contract the part needs.",
          "type": "array",
          "items": { "$ref": "common.schema.json#/$defs/scopeName" },
          "minItems": 1,
          "uniqueItems": true
        }
      },
      "additionalProperties": false
    },
    "distribution": {
      "title": "distribution",
      "description": "Licensing, pricing and provenance of the part.",
      "type": "object",
      "required": ["license"],
      "properties": {
        "license": {
          "description": "License as an SPDX expression.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "pricing": {
          "description": "Optional pricing.",
          "$ref": "#/$defs/pricing"
        },
        "provenance": {
          "description": "Optional provenance.",
          "$ref": "#/$defs/provenance"
        }
      },
      "additionalProperties": false
    },
    "pricing": {
      "title": "pricing",
      "description": "Pricing model, with terms required unless the model is free.",
      "type": "object",
      "oneOf": [
        { "$ref": "#/$defs/freePricing" },
        { "$ref": "#/$defs/chargedPricing" }
      ]
    },
    "freePricing": {
      "title": "free pricing",
      "description": "The part is free.",
      "type": "object",
      "required": ["model"],
      "properties": {
        "model": {
          "description": "free.",
          "const": "free"
        },
        "terms": {
          "description": "URI of the terms of use.",
          "$ref": "common.schema.json#/$defs/uri"
        }
      },
      "additionalProperties": false
    },
    "chargedPricing": {
      "title": "charged pricing",
      "description": "The part is paid or metered; terms are required so approvers can see them.",
      "type": "object",
      "required": ["model", "terms"],
      "properties": {
        "model": {
          "description": "paid or metered.",
          "enum": ["paid", "metered"]
        },
        "terms": {
          "description": "URI of the pricing terms.",
          "$ref": "common.schema.json#/$defs/uri"
        }
      },
      "additionalProperties": false
    },
    "provenance": {
      "title": "provenance",
      "description": "Where the part's source and build come from.",
      "type": "object",
      "required": ["source"],
      "properties": {
        "source": {
          "description": "URI of the source.",
          "$ref": "common.schema.json#/$defs/uri"
        },
        "build": {
          "description": "Optional URI of the build record.",
          "$ref": "common.schema.json#/$defs/uri"
        }
      },
      "additionalProperties": false
    },
    "conformanceResult": {
      "title": "conformance result",
      "description": "A reference to a conformance suite result.",
      "type": "object",
      "required": ["suite", "version", "result"],
      "properties": {
        "suite": {
          "description": "Name of the conformance suite.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "version": {
          "description": "Version of the conformance suite.",
          "$ref": "common.schema.json#/$defs/semver"
        },
        "result": {
          "description": "pass or partial.",
          "enum": ["pass", "partial"]
        },
        "report": {
          "description": "Optional URI of the full report.",
          "$ref": "common.schema.json#/$defs/uri"
        }
      },
      "additionalProperties": false
    },
    "surfaceSupport": {
      "title": "surface support",
      "description": "How well a control works on a surface: full, degraded (a note is required) or none.",
      "type": "object",
      "oneOf": [
        { "$ref": "#/$defs/fullSupport" },
        { "$ref": "#/$defs/degradedSupport" },
        { "$ref": "#/$defs/noSupport" }
      ]
    },
    "fullSupport": {
      "title": "full support",
      "description": "The control works fully on this surface.",
      "type": "object",
      "required": ["support"],
      "properties": {
        "support": {
          "description": "full.",
          "const": "full"
        },
        "note": {
          "description": "Optional note.",
          "$ref": "common.schema.json#/$defs/text"
        }
      },
      "additionalProperties": false
    },
    "degradedSupport": {
      "title": "degraded support",
      "description": "The control works on this surface with differences described in note.",
      "type": "object",
      "required": ["support", "note"],
      "properties": {
        "support": {
          "description": "degraded.",
          "const": "degraded"
        },
        "note": {
          "description": "What differs on this surface.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "degradeTo": {
          "description": "Another control contract to use instead: a contract name in the same catalog, or alias:contractName for a contract in a catalog this catalog uses.",
          "$ref": "common.schema.json#/$defs/catalogContractRef"
        }
      },
      "additionalProperties": false
    },
    "noSupport": {
      "title": "no support",
      "description": "The control does not work on this surface.",
      "type": "object",
      "required": ["support"],
      "properties": {
        "support": {
          "description": "none.",
          "const": "none"
        },
        "note": {
          "description": "Optional note.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "degradeTo": {
          "description": "Another control contract to use instead: a contract name in the same catalog, or alias:contractName for a contract in a catalog this catalog uses.",
          "$ref": "common.schema.json#/$defs/catalogContractRef"
        }
      },
      "additionalProperties": false
    },
    "controlSurfaces": {
      "title": "control surfaces",
      "description": "Per surface (visual, voice), how well the control is supported.",
      "type": "object",
      "required": ["visual", "voice"],
      "properties": {
        "visual": {
          "description": "Support on visual surfaces.",
          "$ref": "#/$defs/surfaceSupport"
        },
        "voice": {
          "description": "Support on voice surfaces.",
          "$ref": "#/$defs/surfaceSupport"
        }
      },
      "additionalProperties": false
    },
    "roleName": {
      "title": "role name",
      "description": "A WAI-ARIA role name.",
      "type": "string",
      "pattern": "^[a-z]+$"
    },
    "accessibility": {
      "title": "accessibility",
      "description": "Accessibility declared by the contract, so it does not depend on each renderer.",
      "type": "object",
      "required": ["role"],
      "properties": {
        "role": {
          "description": "A WAI-ARIA role name. Required.",
          "$ref": "#/$defs/roleName"
        },
        "alternateRoles": {
          "description": "Other roles the host may use when it picks a different presentation, such as combobox for a listbox.",
          "type": "array",
          "items": { "$ref": "#/$defs/roleName" },
          "minItems": 1,
          "uniqueItems": true
        },
        "labelProp": {
          "description": "Optional prop that supplies the accessible name; omitted when the name comes from content or the role takes none.",
          "$ref": "common.schema.json#/$defs/name"
        },
        "keyboard": {
          "description": "Keyboard interactions the control supports. Key names are W3C UI Events key values, with Space for the space bar.",
          "type": "array",
          "items": { "$ref": "#/$defs/keyboardInteraction" }
        }
      },
      "additionalProperties": false
    },
    "keyboardInteraction": {
      "title": "keyboard interaction",
      "description": "One keyboard interaction.",
      "type": "object",
      "required": ["key", "does"],
      "properties": {
        "key": {
          "description": "The key or key combination.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "does": {
          "description": "What the key does.",
          "$ref": "common.schema.json#/$defs/text"
        }
      },
      "additionalProperties": false
    },
    "controlContract": {
      "title": "control contract",
      "description": "A control: a building block for visual and voice surfaces.",
      "type": "object",
      "required": ["kind", "intent", "interface", "surfaces", "accessibility"],
      "properties": {
        "kind": {
          "description": "control.",
          "const": "control"
        },
        "intent": {
          "description": "What the part is for, written so an AI can choose it and an agent can understand it.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "since": {
          "description": "Catalog version that introduced the contract.",
          "$ref": "common.schema.json#/$defs/semver"
        },
        "deprecated": {
          "description": "The catalog version that deprecated the contract, and optionally a replacement.",
          "$ref": "#/$defs/deprecation"
        },
        "interface": {
          "description": "The control's typed interface: props, events, slots and children.",
          "$ref": "#/$defs/controlInterface"
        },
        "surfaces": {
          "description": "Per surface (visual, voice), how well the control is supported.",
          "$ref": "#/$defs/controlSurfaces"
        },
        "accessibility": {
          "description": "Accessibility role, label prop and keyboard interactions.",
          "$ref": "#/$defs/accessibility"
        },
        "implementations": {
          "description": "Shipped implementations per adapter. Empty means descriptor-only.",
          "type": "array",
          "items": { "$ref": "#/$defs/implementation" }
        },
        "requires": {
          "description": "Capabilities and scopes the part itself needs in order to work.",
          "type": "array",
          "items": { "$ref": "#/$defs/requirement" }
        },
        "distribution": {
          "description": "License, optional pricing and optional provenance.",
          "$ref": "#/$defs/distribution"
        },
        "conformance": {
          "description": "Conformance suite results.",
          "type": "array",
          "items": { "$ref": "#/$defs/conformanceResult" }
        }
      },
      "additionalProperties": false
    },
    "capabilityContract": {
      "title": "capability contract",
      "description": "A capability: typed access to the outside world.",
      "type": "object",
      "required": ["kind", "intent", "interface"],
      "properties": {
        "kind": {
          "description": "capability.",
          "const": "capability"
        },
        "intent": {
          "description": "What the part is for, written so an AI can choose it and an agent can understand it.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "since": {
          "description": "Catalog version that introduced the contract.",
          "$ref": "common.schema.json#/$defs/semver"
        },
        "deprecated": {
          "description": "The catalog version that deprecated the contract, and optionally a replacement.",
          "$ref": "#/$defs/deprecation"
        },
        "interface": {
          "description": "The capability's typed interface: config, operations, events, scopes and traits.",
          "$ref": "#/$defs/capabilityInterface"
        },
        "implementations": {
          "description": "Shipped implementations per adapter. Empty means descriptor-only.",
          "type": "array",
          "items": { "$ref": "#/$defs/implementation" }
        },
        "requires": {
          "description": "Other capabilities and scopes the part itself needs in order to work.",
          "type": "array",
          "items": { "$ref": "#/$defs/requirement" }
        },
        "distribution": {
          "description": "License, optional pricing and optional provenance.",
          "$ref": "#/$defs/distribution"
        },
        "conformance": {
          "description": "Conformance suite results.",
          "type": "array",
          "items": { "$ref": "#/$defs/conformanceResult" }
        }
      },
      "additionalProperties": false
    },
    "propField": {
      "title": "prop",
      "description": "A control prop: a field map entry (type, description, required, default) with the extra keys bindable and remote.",
      "type": "object",
      "required": ["type"],
      "properties": {
        "type": {
          "description": "Type reference of the prop. Required.",
          "$ref": "common.schema.json#/$defs/typeRef"
        },
        "description": {
          "description": "Plain-language description of the prop.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "required": {
          "description": "Whether a value must be supplied. Defaults to true.",
          "type": "boolean"
        },
        "default": {
          "description": "A literal JSON value used when the prop is absent. A prop with a default is optional."
        },
        "bindable": {
          "description": "Default false. Only bindable props may appear in a node's bind.",
          "type": "boolean"
        },
        "remote": {
          "description": "Default false. When true, the prop's value can make the host fetch from the network, such as an image address, and falls under the egress rule.",
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "dependentSchemas": {
        "default": {
          "properties": {
            "required": {
              "description": "A prop with a default is not required.",
              "const": false
            }
          }
        }
      }
    },
    "controlEvent": {
      "title": "control event",
      "description": "An event a control raises.",
      "type": "object",
      "required": ["description"],
      "properties": {
        "description": {
          "description": "When the event is raised.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "payload": {
          "description": "Field map of the event payload.",
          "$ref": "common.schema.json#/$defs/fieldMap"
        }
      },
      "additionalProperties": false
    },
    "slot": {
      "title": "slot",
      "description": "A named template region of a control.",
      "type": "object",
      "required": ["description"],
      "properties": {
        "description": {
          "description": "What the slot's template renders.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "scope": {
          "description": "Variables the slot's template can read, as name to type reference.",
          "type": "object",
          "propertyNames": { "$ref": "common.schema.json#/$defs/name" },
          "additionalProperties": { "$ref": "common.schema.json#/$defs/typeRef" }
        },
        "required": {
          "description": "Default false. When true, a node using the control must fill the slot.",
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "controlInterface": {
      "title": "control interface",
      "description": "The typed interface of a control. props, outputs, events and slots are all optional.",
      "type": "object",
      "properties": {
        "props": {
          "description": "Field map of props, with the extra per-field keys bindable and remote. variant, hidden and disabled are accepted by every control without declaring them.",
          "type": "object",
          "propertyNames": { "$ref": "common.schema.json#/$defs/name" },
          "additionalProperties": { "$ref": "#/$defs/propField" }
        },
        "outputs": {
          "description": "Field map of values the control produces and the app can only read, such as a form's validity. A node receives one by naming it in bind.",
          "$ref": "common.schema.json#/$defs/fieldMap"
        },
        "events": {
          "description": "Event name to a description and a payload field map.",
          "type": "object",
          "propertyNames": { "$ref": "common.schema.json#/$defs/name" },
          "additionalProperties": { "$ref": "#/$defs/controlEvent" }
        },
        "slots": {
          "description": "Slot name to a description and the scope variables the slot's template can read.",
          "type": "object",
          "propertyNames": { "$ref": "common.schema.json#/$defs/name" },
          "additionalProperties": { "$ref": "#/$defs/slot" }
        },
        "children": {
          "description": "How many child nodes the control accepts: none (the default), one or many.",
          "enum": ["none", "one", "many"]
        }
      },
      "additionalProperties": false
    },
    "operation": {
      "title": "operation",
      "description": "A capability operation, called by steps.",
      "type": "object",
      "required": ["description", "scope", "effect"],
      "properties": {
        "description": {
          "description": "What the operation does.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "input": {
          "description": "Optional field map of the operation input.",
          "$ref": "common.schema.json#/$defs/fieldMap"
        },
        "output": {
          "description": "Optional type reference of the operation output.",
          "$ref": "common.schema.json#/$defs/typeRef"
        },
        "scope": {
          "description": "The scope a grant must include to call the operation.",
          "$ref": "common.schema.json#/$defs/scopeName"
        },
        "effect": {
          "description": "read (no outside change, safe to retry), write (changes data the capability manages) or external (acts in the world: sends, pays, publishes).",
          "enum": ["read", "write", "external"]
        },
        "interactive": {
          "description": "Default false. When true, the operation asks the acting principal's person for something, such as picking a file, on an active surface of theirs; it cannot be a state source.",
          "type": "boolean"
        },
        "paging": {
          "description": "Declares that the operation returns its results in pages, and which input and output fields carry the paging.",
          "$ref": "#/$defs/paging"
        }
      },
      "additionalProperties": false
    },
    "paging": {
      "title": "paging",
      "description": "How an operation pages: cursor names an optional string input field that asks for the page after a given one, next an output field holding the cursor of the following page or null when there is none, and items the output field holding the page's list.",
      "type": "object",
      "required": ["cursor", "next", "items"],
      "properties": {
        "cursor": {
          "description": "The input field that takes the cursor of the page to read.",
          "$ref": "common.schema.json#/$defs/name"
        },
        "next": {
          "description": "The output field that holds the cursor of the next page, or null when there is none.",
          "$ref": "common.schema.json#/$defs/name"
        },
        "items": {
          "description": "The output field that holds the page's list.",
          "$ref": "common.schema.json#/$defs/name"
        }
      },
      "additionalProperties": false
    },
    "capabilityEvent": {
      "title": "capability event",
      "description": "An event a capability raises, which can trigger rules.",
      "type": "object",
      "required": ["description", "scope"],
      "properties": {
        "description": {
          "description": "When the event is raised.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "payload": {
          "description": "Field map of the event payload.",
          "$ref": "common.schema.json#/$defs/fieldMap"
        },
        "scope": {
          "description": "The scope a grant must include to receive the event.",
          "$ref": "common.schema.json#/$defs/scopeName"
        }
      },
      "additionalProperties": false
    },
    "scope": {
      "title": "scope",
      "description": "A permission scope, shown to approvers.",
      "type": "object",
      "required": ["description", "sensitivity"],
      "properties": {
        "description": {
          "description": "Plain-language description shown to approvers.",
          "$ref": "common.schema.json#/$defs/text"
        },
        "sensitivity": {
          "description": "low, medium or high. Hosts should require stronger confirmation for higher sensitivity.",
          "enum": ["low", "medium", "high"]
        },
        "consent": {
          "description": "asked (the default) or use. A scope given by use promises that nothing happens under it unless a person does it themselves at that moment in the host's own interface, or has already handed the app the thing acted on; a request whose scopes are all given by use is not asked.",
          "enum": ["asked", "use"]
        }
      },
      "additionalProperties": false
    },
    "capabilityInterface": {
      "title": "capability interface",
      "description": "The typed interface of a capability.",
      "type": "object",
      "properties": {
        "config": {
          "description": "Field map of configuration a definition supplies. A required field may be left out of a definition for the host to supply when it binds the capability.",
          "$ref": "common.schema.json#/$defs/fieldMap"
        },
        "operations": {
          "description": "Operations keyed by operation name.",
          "type": "object",
          "propertyNames": { "$ref": "common.schema.json#/$defs/name" },
          "additionalProperties": { "$ref": "#/$defs/operation" }
        },
        "events": {
          "description": "Events keyed by event name.",
          "type": "object",
          "propertyNames": { "$ref": "common.schema.json#/$defs/name" },
          "additionalProperties": { "$ref": "#/$defs/capabilityEvent" }
        },
        "scopes": {
          "description": "Scopes keyed by scope name.",
          "type": "object",
          "propertyNames": { "$ref": "common.schema.json#/$defs/scopeName" },
          "additionalProperties": { "$ref": "#/$defs/scope" }
        },
        "traits": {
          "description": "Cross-cutting properties, from a closed set: background (permits unattended execution), offline (works without a network), multiUser (can supply identity and roles for more than one principal), egress (config names one network origin in a field called origin, and a grant permits fetching remote content from it) and personal (acts for one person, whose grants each person answers for themselves).",
          "type": "array",
          "items": { "enum": ["background", "offline", "multiUser", "egress", "personal"] },
          "uniqueItems": true
        }
      },
      "additionalProperties": false,
      "if": {
        "type": "object",
        "required": ["traits"],
        "properties": {
          "traits": {
            "type": "array",
            "contains": { "const": "egress" }
          }
        }
      },
      "then": {
        "required": ["config"],
        "properties": {
          "config": {
            "type": "object",
            "required": ["origin"],
            "properties": {
              "origin": {
                "description": "The network origin the capability reaches.",
                "type": "object"
              }
            }
          }
        }
      }
    }
  }
}
