{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/carbon-design-system/sveld/main/schema/component-api.schema.json",
  "title": "sveld COMPONENT_API.json",
  "description": "Public JSON Schema for the combined COMPONENT_API.json file emitted by sveld when json output is enabled.",
  "type": "object",
  "required": ["schemaVersion", "generator", "total", "components"],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": {
      "const": 1,
      "description": "Version of the emitted sveld component API JSON format."
    },
    "generator": {
      "type": "object",
      "required": ["name", "version", "svelteVersion"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string" },
        "version": { "type": "string" },
        "svelteVersion": { "type": "string" }
      }
    },
    "total": {
      "type": "integer",
      "minimum": 0,
      "description": "Number of components in the components array."
    },
    "components": {
      "type": "array",
      "items": { "$ref": "#/$defs/component" }
    },
    "totalExports": {
      "type": "integer",
      "minimum": 0,
      "description": "Count of entry-barrel exports. Only when `documentExports` is on."
    },
    "exports": {
      "type": "array",
      "description": "Entry-barrel exports other than components. Only when `documentExports` is on.",
      "items": { "$ref": "#/$defs/entryExport" }
    }
  },
  "$defs": {
    "sourcePosition": {
      "type": "object",
      "required": ["line", "column"],
      "additionalProperties": false,
      "properties": {
        "line": {
          "type": "integer",
          "minimum": 1
        },
        "column": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "sourceRange": {
      "type": "object",
      "required": ["start", "end"],
      "additionalProperties": false,
      "properties": {
        "start": { "$ref": "#/$defs/sourcePosition" },
        "end": { "$ref": "#/$defs/sourcePosition" }
      }
    },
    "deprecated": {
      "oneOf": [{ "type": "string" }, { "const": true }],
      "description": "Author-documented deprecation from `@deprecated`. A string is the message; `true` means the tag had no message."
    },
    "component": {
      "type": "object",
      "required": [
        "moduleName",
        "filePath",
        "syntaxMode",
        "props",
        "moduleExports",
        "slots",
        "events",
        "typedefs",
        "generics"
      ],
      "additionalProperties": false,
      "properties": {
        "moduleName": { "type": "string" },
        "filePath": { "type": "string" },
        "source": { "$ref": "#/$defs/sourceRange" },
        "syntaxMode": {
          "enum": ["legacy", "runes"]
        },
        "scriptLanguage": {
          "enum": ["js", "ts"]
        },
        "props": {
          "type": "array",
          "items": { "$ref": "#/$defs/prop" }
        },
        "moduleExports": {
          "type": "array",
          "items": { "$ref": "#/$defs/prop" }
        },
        "slots": {
          "type": "array",
          "items": { "$ref": "#/$defs/slot" }
        },
        "events": {
          "type": "array",
          "items": { "$ref": "#/$defs/event" }
        },
        "typedefs": {
          "type": "array",
          "items": { "$ref": "#/$defs/typedef" }
        },
        "generics": {
          "oneOf": [
            { "type": "null" },
            {
              "type": "array",
              "prefixItems": [{ "type": "string" }, { "type": "string" }],
              "items": false,
              "minItems": 2,
              "maxItems": 2
            }
          ]
        },
        "rest_props": { "$ref": "#/$defs/restProp" },
        "extends": { "$ref": "#/$defs/extends" },
        "componentComment": { "type": "string" },
        "componentCommentSource": { "$ref": "#/$defs/sourceRange" },
        "contexts": {
          "type": "array",
          "items": { "$ref": "#/$defs/context" }
        },
        "customElementTag": {
          "type": "string",
          "description": "Custom-element tag name from `<svelte:options customElement=\"x-foo\" />` (or the object form's `tag`), when present."
        },
        "customElement": { "$ref": "#/$defs/customElement" },
        "cssParts": {
          "type": "array",
          "items": { "$ref": "#/$defs/cssPart" }
        },
        "cssProperties": {
          "type": "array",
          "items": { "$ref": "#/$defs/cssProperty" }
        }
      }
    },
    "customElement": {
      "type": "object",
      "additionalProperties": false,
      "description": "Full `<svelte:options customElement=... />` config (shorthand or object form), when present.",
      "properties": {
        "tag": { "type": "string" },
        "shadow": { "enum": ["open", "none"] },
        "props": {
          "type": "object",
          "additionalProperties": { "$ref": "#/$defs/customElementPropConfig" }
        },
        "extend": { "const": true }
      }
    },
    "customElementPropConfig": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "attribute": {
          "oneOf": [{ "type": "string" }, { "const": false }]
        },
        "reflect": { "type": "boolean" },
        "type": { "enum": ["String", "Boolean", "Number", "Array", "Object"] }
      }
    },
    "cssPart": {
      "type": "object",
      "required": ["name"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string" },
        "description": { "type": "string" }
      }
    },
    "cssProperty": {
      "type": "object",
      "required": ["name"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string", "description": "Includes the leading `--`." },
        "type": { "type": "string" },
        "default": { "type": "string" },
        "description": { "type": "string" }
      }
    },
    "prop": {
      "type": "object",
      "required": ["name", "kind", "isFunction", "isFunctionDeclaration", "isRequired", "constant", "reactive"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string" },
        "localName": { "type": "string" },
        "kind": {
          "enum": ["let", "const", "function", "re-export", "class"],
          "description": "`re-export` is module-export only: `export { x } from \"...\"`, `export * from \"...\"`, or `export { x }` of an imported binding. `class` is module-export only too: a class the module script declares, with its public surface in `members`."
        },
        "constant": { "type": "boolean" },
        "type": { "type": "string" },
        "typeSource": {
          "enum": ["typescript", "jsdoc", "default", "inferred", "unknown"]
        },
        "value": { "type": "string" },
        "defaultValue": { "$ref": "#/$defs/defaultValue" },
        "description": { "type": "string" },
        "params": {
          "type": "array",
          "items": { "$ref": "#/$defs/propParam" }
        },
        "returnType": { "type": "string" },
        "typeParameters": {
          "type": "string",
          "description": "A function's own type parameter list from its `@template` tags, or a class's type parameters, without angle brackets."
        },
        "members": {
          "type": "array",
          "description": "Set when `kind` is `class`: its public constructor, methods, and properties, in source order.",
          "items": { "$ref": "#/$defs/classMember" }
        },
        "extends": {
          "type": "string",
          "description": "Set when `kind` is `class` and it extends an imported or exported class: the clause's source text, e.g. `Base<T>`."
        },
        "implements": {
          "type": "array",
          "description": "Set when `kind` is `class` and it implements interfaces: each clause's source text.",
          "items": { "type": "string" }
        },
        "abstract": {
          "const": true,
          "description": "Set when `kind` is `class` and the class is abstract."
        },
        "isFunction": { "type": "boolean" },
        "isFunctionDeclaration": { "type": "boolean" },
        "isRequired": { "type": "boolean" },
        "reactive": { "type": "boolean" },
        "binding": {
          "enum": ["readonly", "writable"]
        },
        "bindable": {
          "const": true,
          "description": "Present only when the prop is explicitly declared with Svelte 5 $bindable()."
        },
        "deprecated": { "$ref": "#/$defs/deprecated" },
        "tags": {
          "type": "array",
          "items": { "$ref": "#/$defs/jsdocTag" }
        },
        "reExport": { "$ref": "#/$defs/reExport" },
        "source": { "$ref": "#/$defs/sourceRange" }
      }
    },
    "classMember": {
      "type": "object",
      "required": ["kind", "name"],
      "additionalProperties": false,
      "description": "A public member of a `kind: \"class\"` module export. Private, protected, and `@internal` members are left out.",
      "properties": {
        "kind": {
          "enum": ["constructor", "method", "property", "index"],
          "description": "`property` covers fields, constructor parameter properties, and getter/setter pairs."
        },
        "name": { "type": "string" },
        "type": { "type": "string", "description": "A property's type." },
        "params": {
          "type": "array",
          "description": "A method or constructor's parameters. A rest parameter's name starts with `...`.",
          "items": { "$ref": "#/$defs/propParam" }
        },
        "returnType": { "type": "string" },
        "typeParameters": {
          "type": "string",
          "description": "A method's own type parameter list, without angle brackets."
        },
        "static": { "const": true },
        "readonly": { "const": true, "description": "A readonly field, or a getter with no setter." },
        "optional": { "const": true },
        "abstract": { "const": true },
        "description": { "type": "string" },
        "deprecated": { "$ref": "#/$defs/deprecated" },
        "tags": {
          "type": "array",
          "items": { "$ref": "#/$defs/jsdocTag" }
        }
      }
    },
    "reExport": {
      "type": "object",
      "required": ["from", "imported"],
      "additionalProperties": false,
      "description": "Where a `kind: \"re-export\"` module export's binding comes from.",
      "properties": {
        "from": { "type": "string", "description": "Module specifier as written in the source." },
        "imported": {
          "type": "string",
          "description": "Name the source module exports: `default` for a default import, `*` for `export *` or a namespace import."
        }
      }
    },
    "defaultValue": {
      "type": "object",
      "required": ["raw", "kind"],
      "additionalProperties": false,
      "properties": {
        "raw": { "type": "string" },
        "kind": {
          "enum": ["literal", "array", "object", "expression", "function", "unknown"]
        },
        "value": {
          "description": "Parsed JSON-safe value for literals, arrays, and plain objects when statically available."
        }
      }
    },
    "propParam": {
      "type": "object",
      "required": ["name", "type"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string" },
        "type": { "type": "string" },
        "description": { "type": "string" },
        "optional": { "type": "boolean" }
      }
    },
    "slot": {
      "type": "object",
      "required": ["default"],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": ["string", "null"]
        },
        "default": { "type": "boolean" },
        "fallback": { "type": "string" },
        "slot_props": { "type": "string" },
        "description": { "type": "string" },
        "deprecated": { "$ref": "#/$defs/deprecated" },
        "tags": {
          "type": "array",
          "items": { "$ref": "#/$defs/jsdocTag" }
        },
        "source": { "$ref": "#/$defs/sourceRange" }
      }
    },
    "jsdocTag": {
      "type": "object",
      "required": ["name", "body"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string" },
        "body": { "type": "string" }
      }
    },
    "event": {
      "oneOf": [{ "$ref": "#/$defs/forwardedEvent" }, { "$ref": "#/$defs/dispatchedEvent" }]
    },
    "forwardedEvent": {
      "type": "object",
      "required": ["type", "name", "element"],
      "additionalProperties": false,
      "properties": {
        "type": { "const": "forwarded" },
        "name": { "type": "string" },
        "element": { "type": "string" },
        "description": { "type": "string" },
        "deprecated": { "$ref": "#/$defs/deprecated" },
        "detail": { "type": "string" },
        "tags": {
          "type": "array",
          "items": { "$ref": "#/$defs/jsdocTag" }
        },
        "source": { "$ref": "#/$defs/sourceRange" }
      }
    },
    "dispatchedEvent": {
      "type": "object",
      "required": ["type", "name"],
      "additionalProperties": false,
      "properties": {
        "type": { "const": "dispatched" },
        "name": { "type": "string" },
        "detail": { "type": "string" },
        "description": { "type": "string" },
        "deprecated": { "$ref": "#/$defs/deprecated" },
        "tags": {
          "type": "array",
          "items": { "$ref": "#/$defs/jsdocTag" }
        },
        "source": { "$ref": "#/$defs/sourceRange" }
      }
    },
    "typedef": {
      "type": "object",
      "required": ["type", "name", "ts"],
      "additionalProperties": false,
      "properties": {
        "type": { "type": "string" },
        "name": { "type": "string" },
        "description": { "type": "string" },
        "ts": { "type": "string" },
        "tags": {
          "type": "array",
          "items": { "$ref": "#/$defs/jsdocTag" }
        },
        "source": { "$ref": "#/$defs/sourceRange" }
      }
    },
    "context": {
      "type": "object",
      "required": ["key", "typeName", "properties"],
      "additionalProperties": false,
      "properties": {
        "key": { "type": "string" },
        "typeName": { "type": "string" },
        "type": {
          "type": "string",
          "description": "The context's whole type, when the setContext value is a variable whose type isn't an object type literal (e.g. ModalAPI, or any when untyped). properties is empty then."
        },
        "description": { "type": "string" },
        "properties": {
          "type": "array",
          "items": { "$ref": "#/$defs/contextProperty" }
        },
        "hasUnresolvedSpread": {
          "type": "boolean",
          "description": "True when a {...spread} in the context's object literal couldn't be resolved; the generated type intersects with Record<string, any>."
        },
        "source": { "$ref": "#/$defs/sourceRange" }
      }
    },
    "contextProperty": {
      "type": "object",
      "required": ["name", "type", "optional"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string" },
        "type": { "type": "string" },
        "description": { "type": "string" },
        "optional": { "type": "boolean" }
      }
    },
    "restProp": {
      "oneOf": [{ "$ref": "#/$defs/elementRestProp" }, { "$ref": "#/$defs/inlineComponentRestProp" }]
    },
    "elementRestProp": {
      "type": "object",
      "required": ["type", "name"],
      "additionalProperties": false,
      "properties": {
        "type": { "const": "Element" },
        "name": { "type": "string" },
        "thisValue": { "type": "string" },
        "thisType": { "type": "string" },
        "description": { "type": "string" }
      }
    },
    "inlineComponentRestProp": {
      "type": "object",
      "required": ["type", "name"],
      "additionalProperties": false,
      "properties": {
        "type": { "const": "InlineComponent" },
        "name": { "type": "string" }
      }
    },
    "extends": {
      "type": "object",
      "required": ["interface", "import"],
      "additionalProperties": false,
      "properties": {
        "interface": { "type": "string" },
        "import": { "type": "string" }
      }
    },
    "entryExport": {
      "type": "object",
      "required": ["name", "kind", "isTypeOnly"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string" },
        "kind": {
          "enum": ["const", "let", "var", "function", "class", "type", "interface", "enum"]
        },
        "type": { "type": "string" },
        "value": { "type": "string" },
        "description": { "type": "string" },
        "deprecated": { "$ref": "#/$defs/deprecated" },
        "tags": {
          "type": "array",
          "items": { "$ref": "#/$defs/jsdocTag" }
        },
        "source": { "type": "string" },
        "isTypeOnly": { "type": "boolean" }
      }
    }
  }
}
