{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "$id": "https://artifacts.apis.io/folio/json-schema/folio-capability-sets-schema.json",
  "title": "Capability Sets Object Schema",
  "description": "Response body containing capability set records",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/folio-capability-set-api-openapi.yml#/components/schemas/capabilitySets",
  "type": "object",
  "properties": {
    "capabilitySets": {
      "description": "A collection of capability sets",
      "type": "array",
      "items": {
        "$ref": "#/$defs/capabilitySet"
      },
      "minItems": 1
    },
    "totalRecords": {
      "readOnly": true,
      "description": "The total number of records matching the provided criteria",
      "type": "integer",
      "format": "int64"
    }
  },
  "required": [
    "capabilities"
  ],
  "$defs": {
    "capabilityAction": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "description": "The action this capability is associated with, e.g. create",
      "type": "string",
      "enum": [
        "view",
        "create",
        "edit",
        "delete",
        "manage",
        "execute"
      ]
    },
    "capabilitySet": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "object",
      "title": "Capability Set Object Schema",
      "description": "Object containing details of a capability set",
      "properties": {
        "id": {
          "description": "A unique identifier for this capability",
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "description": "a human-readable name/label for this capability.  Takes the form of {resourceName}.{scope}, e.g. item.create",
          "type": "string",
          "readOnly": true
        },
        "description": {
          "description": "Free form description of the capability",
          "type": "string"
        },
        "resource": {
          "description": "The resource this capability is associated with, e.g. item",
          "type": "string",
          "pattern": "^[A-Za-z\\s]+$"
        },
        "action": {
          "description": "The action this capability is associated with, e.g. create",
          "$ref": "#/$defs/capabilityAction"
        },
        "applicationId": {
          "description": "The id of the application which defines the capability",
          "type": "string"
        },
        "moduleId": {
          "description": "The id of the module which defines the capability",
          "type": "string"
        },
        "type": {
          "description": "The type of capability",
          "$ref": "#/$defs/capabilityType"
        },
        "permission": {
          "description": "Folio permission name",
          "type": "string"
        },
        "capabilities": {
          "description": "List with assigned capability ids",
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "description": "Capability identifier",
            "format": "uuid"
          }
        },
        "metadata": {
          "$ref": "#/$defs/metadata",
          "readOnly": true
        },
        "visible": {
          "description": "Is visible in UI",
          "type": "boolean"
        }
      },
      "required": [
        "resource",
        "action",
        "permissions",
        "type",
        "applicationId"
      ]
    },
    "capabilityType": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "description": "The type of capability",
      "type": "string",
      "enum": [
        "settings",
        "data",
        "procedural"
      ]
    },
    "metadata": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Metadata Schema",
      "description": "Metadata about creation and changes to records, provided by the server (client should not provide)",
      "type": "object",
      "properties": {
        "createdDate": {
          "description": "Date and time when the record was created",
          "type": "string",
          "format": "date-time"
        },
        "createdByUserId": {
          "description": "ID of the user who created the record (when available)",
          "type": "string",
          "format": "uuid"
        },
        "updatedDate": {
          "description": "Date and time when the record was last updated",
          "type": "string",
          "format": "date-time"
        },
        "updatedByUserId": {
          "description": "ID of the user who last updated the record (when available)",
          "type": "string",
          "format": "uuid"
        }
      },
      "additionalProperties": false
    }
  }
}