{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/cdata/main/json-schema/cdata-user-role-assignment-schema.json",
  "title": "UserRoleAssignment",
  "description": "A direct role assignment made via POST /users/{id}/roles.",
  "x-generated": "2026-10-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cdata-users-api-openapi.yml#/components/schemas/UserRoleAssignment",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Assignment identifier."
    },
    "user_id": {
      "type": "string",
      "format": "uuid",
      "description": "The user this role is assigned to."
    },
    "role_id": {
      "type": "string",
      "format": "uuid",
      "description": "The role identifier."
    },
    "role_name": {
      "type": "string",
      "description": "The name of the role."
    },
    "role_type": {
      "type": "string",
      "enum": [
        "system_role"
      ],
      "description": "Always `system_role` (admin) for assignments made via this endpoint."
    },
    "grant_type": {
      "type": "string",
      "enum": [
        "direct"
      ],
      "description": "Always `direct` for assignments made via this endpoint."
    },
    "granted_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 UTC."
    },
    "granted_by": {
      "type": "string",
      "format": "uuid",
      "description": "The user who granted the role."
    }
  }
}