{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ismalicious-com/json-schema/ismalicious-com-create-source-request-schema.json",
  "title": "CreateSourceRequest",
  "description": "`POST /surveillance/sources`, discriminated on `kind`.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ismalicious-com-openapi.json#/components/schemas/CreateSourceRequest",
  "oneOf": [
    {
      "type": "object",
      "required": [
        "domain",
        "kind"
      ],
      "properties": {
        "components": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ComponentInput"
          },
          "description": "Explicit selection from `/surveillance/analyze`; `None` = read now."
        },
        "domain": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "enum": [
            "DOMAIN"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "name",
        "content",
        "kind"
      ],
      "properties": {
        "components": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ComponentInput"
          }
        },
        "content": {
          "type": "string"
        },
        "excludeDev": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "format": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/LockfileFormat"
            }
          ]
        },
        "kind": {
          "type": "string",
          "enum": [
            "LOCKFILE"
          ]
        },
        "name": {
          "type": "string"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "name",
        "components",
        "kind"
      ],
      "properties": {
        "components": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ComponentInput"
          }
        },
        "kind": {
          "type": "string",
          "enum": [
            "MANUAL"
          ]
        },
        "name": {
          "type": "string"
        },
        "useDefault": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Add to the organisation's default manual stack."
        }
      }
    }
  ],
  "$defs": {
    "ComponentInput": {
      "type": "object",
      "description": "A component as a caller describes it (manual add, analyze selection,\npreview). At least one of `identityKey`, `cpe`, `cpeVendor`+`cpeProduct`,\n`ecosystem`+`packageName`, `purl` or `name` (resolved through the product\ncatalogue) must be present.",
      "properties": {
        "cpe": {
          "type": [
            "string",
            "null"
          ]
        },
        "cpeProduct": {
          "type": [
            "string",
            "null"
          ]
        },
        "cpeVendor": {
          "type": [
            "string",
            "null"
          ]
        },
        "dependencyScope": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/DependencyScope"
            }
          ]
        },
        "ecosystem": {
          "type": [
            "string",
            "null"
          ]
        },
        "identityKey": {
          "type": [
            "string",
            "null"
          ]
        },
        "monitored": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "packageName": {
          "type": [
            "string",
            "null"
          ]
        },
        "purl": {
          "type": [
            "string",
            "null"
          ]
        },
        "version": {
          "type": [
            "string",
            "null"
          ]
        },
        "versionBranch": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "DependencyScope": {
      "type": "string",
      "description": "`WatchComponent.dependencyScope`.",
      "enum": [
        "Direct",
        "Transitive",
        "Dev",
        "NotApplicable"
      ]
    },
    "LockfileFormat": {
      "type": "string",
      "description": "`WatchSource.lockfileFormat`.",
      "enum": [
        "PackageLock",
        "ComposerLock",
        "Requirements",
        "GemfileLock",
        "CargoLock",
        "CycloneDx"
      ]
    }
  }
}