{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/devarmor/json-schema/devarmor-component-schema.json",
  "title": "Component",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/devarmor-components-api-openapi.yml#/components/schemas/Component",
  "properties": {
    "symbolic_name": {
      "type": "string",
      "pattern": "^[0-9a-z-]+$",
      "title": "Symbolic Name"
    },
    "title": {
      "type": "string",
      "title": "Title"
    },
    "description": {
      "type": "string",
      "title": "Description"
    },
    "repo_link": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2083,
          "minLength": 1,
          "format": "uri"
        },
        {
          "type": "null"
        }
      ],
      "title": "Repo Link"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At"
    },
    "id": {
      "type": "integer",
      "title": "Id"
    },
    "project": {
      "$ref": "#/$defs/Project"
    },
    "threat_model_versions": {
      "items": {
        "type": "string",
        "pattern": "^\\d+(\\.\\d+)*$"
      },
      "type": "array",
      "title": "Threat Model Versions"
    },
    "parent_component": {
      "anyOf": [
        {
          "$ref": "#/$defs/Component"
        },
        {
          "type": "null"
        }
      ]
    },
    "trust_zone": {
      "anyOf": [
        {
          "$ref": "#/$defs/TrustZone"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "required": [
    "symbolic_name",
    "title",
    "description",
    "repo_link",
    "id",
    "project",
    "threat_model_versions",
    "trust_zone"
  ],
  "$defs": {
    "Component": {
      "properties": {
        "symbolic_name": {
          "type": "string",
          "pattern": "^[0-9a-z-]+$",
          "title": "Symbolic Name"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "description": {
          "type": "string",
          "title": "Description"
        },
        "repo_link": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2083,
              "minLength": 1,
              "format": "uri"
            },
            {
              "type": "null"
            }
          ],
          "title": "Repo Link"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Updated At"
        },
        "id": {
          "type": "integer",
          "title": "Id"
        },
        "project": {
          "$ref": "#/$defs/Project"
        },
        "threat_model_versions": {
          "items": {
            "type": "string",
            "pattern": "^\\d+(\\.\\d+)*$"
          },
          "type": "array",
          "title": "Threat Model Versions"
        },
        "parent_component": {
          "anyOf": [
            {
              "$ref": "#/$defs/Component"
            },
            {
              "type": "null"
            }
          ]
        },
        "trust_zone": {
          "anyOf": [
            {
              "$ref": "#/$defs/TrustZone"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "required": [
        "symbolic_name",
        "title",
        "description",
        "repo_link",
        "id",
        "project",
        "threat_model_versions",
        "trust_zone"
      ],
      "title": "Component"
    },
    "Project": {
      "properties": {
        "symbolic_name": {
          "type": "string",
          "pattern": "^[0-9a-z-]+$",
          "title": "Symbolic Name"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "default": {
          "type": "boolean",
          "title": "Default",
          "default": false
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Description"
        },
        "use_memory": {
          "type": "boolean",
          "title": "Use Memory",
          "default": true
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Updated At"
        },
        "id": {
          "type": "integer",
          "title": "Id"
        },
        "owner_user": {
          "$ref": "#/$defs/User"
        },
        "memory_effective": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Memory Effective"
        },
        "memory_effective_reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Memory Effective Reason"
        }
      },
      "type": "object",
      "required": [
        "symbolic_name",
        "title",
        "id",
        "owner_user"
      ],
      "title": "Project"
    },
    "TrustZone": {
      "properties": {
        "symbolic_name": {
          "type": "string",
          "pattern": "^[0-9a-z-]+$",
          "title": "Symbolic Name"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "description": {
          "type": "string",
          "title": "Description"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Updated At"
        },
        "id": {
          "type": "integer",
          "title": "Id"
        },
        "project": {
          "$ref": "#/$defs/Project"
        },
        "threat_model_versions": {
          "items": {
            "type": "string",
            "pattern": "^\\d+(\\.\\d+)*$"
          },
          "type": "array",
          "title": "Threat Model Versions"
        }
      },
      "type": "object",
      "required": [
        "symbolic_name",
        "title",
        "description",
        "id",
        "project",
        "threat_model_versions"
      ],
      "title": "TrustZone"
    },
    "User": {
      "properties": {
        "email": {
          "type": "string",
          "title": "Email"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "state": {
          "$ref": "#/$defs/UserState",
          "default": "active"
        },
        "roles": {
          "items": {
            "$ref": "#/$defs/UserRole"
          },
          "type": "array",
          "title": "Roles",
          "default": []
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Updated At"
        },
        "id": {
          "type": "integer",
          "title": "Id"
        }
      },
      "type": "object",
      "required": [
        "email",
        "name",
        "id"
      ],
      "title": "User"
    },
    "UserRole": {
      "type": "string",
      "enum": [
        "admin",
        "customer_support"
      ],
      "title": "UserRole"
    },
    "UserState": {
      "type": "string",
      "enum": [
        "active",
        "inactive",
        "pending_org_approval"
      ],
      "title": "UserState"
    }
  }
}