{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nexus/json-schema/nexus-api-access-result-xo-schema.json",
  "title": "ApiAccessResultXo",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nexus-security-management-api-access-api-openapi.yml#/components/schemas/ApiAccessResultXo",
  "required": [
    "hasAccess"
  ],
  "type": "object",
  "properties": {
    "hasAccess": {
      "type": "boolean",
      "description": "Whether the user/role has access to the endpoint"
    },
    "requiredPermission": {
      "type": "string",
      "description": "The permission required to access the endpoint"
    },
    "chains": {
      "type": "array",
      "description": "The permission chains showing how access is granted (user -> role -> privilege -> permission)",
      "items": {
        "$ref": "#/$defs/PermissionChainXo"
      }
    },
    "relatedEndpoints": {
      "type": "array",
      "description": "Related API endpoints that use similar permissions",
      "items": {
        "$ref": "#/$defs/RelatedEndpointXo"
      }
    }
  },
  "$defs": {
    "EntityRefXo": {
      "required": [
        "id"
      ],
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The entity ID"
        },
        "name": {
          "type": "string",
          "description": "The entity display name"
        }
      },
      "description": "The privilege in the permission chain"
    },
    "PermissionChainXo": {
      "type": "object",
      "properties": {
        "user": {
          "$ref": "#/$defs/EntityRefXo"
        },
        "role": {
          "$ref": "#/$defs/EntityRefXo"
        },
        "privilege": {
          "$ref": "#/$defs/EntityRefXo"
        },
        "permission": {
          "type": "string",
          "description": "The permission string"
        }
      },
      "description": "The permission chains showing how access is granted (user -> role -> privilege -> permission)"
    },
    "RelatedEndpointXo": {
      "required": [
        "endpoint",
        "method"
      ],
      "type": "object",
      "properties": {
        "method": {
          "type": "string",
          "description": "The HTTP method"
        },
        "endpoint": {
          "type": "string",
          "description": "The API endpoint path"
        },
        "description": {
          "type": "string",
          "description": "Description of the endpoint"
        },
        "permission": {
          "type": "string",
          "description": "The permission required for this endpoint"
        }
      },
      "description": "Related API endpoints that use similar permissions"
    }
  }
}