{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/permitio/json-schema/permitio-permit-backend-schemas-schema-opal-data-full-data-schema.json",
  "title": "FullData",
  "description": "This is the data structure that is used by the PDP in a manged Permit environment.\nThe code Permit generates uses this data structure to enforce the policy and make decisions.",
  "x-generated": "2026-11-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/permitio-openapi.json#/components/schemas/permit_backend__schemas__schema_opal_data__FullData",
  "properties": {
    "use_debugger": {
      "type": "boolean",
      "title": "Use Debugger",
      "default": true
    },
    "users": {
      "additionalProperties": {
        "$ref": "#/$defs/UserData"
      },
      "type": "object",
      "title": "Users",
      "description": "Key-Value mapping of the users in the system.\nThe key is the user key and the value contains some details about the user."
    },
    "tenants": {
      "additionalProperties": {
        "$ref": "#/$defs/TenantData"
      },
      "type": "object",
      "title": "Tenants",
      "description": "Key-Value mapping of the tenants in the system.\nThe key is the tenant key and the value contains some details about the tenant."
    },
    "roles": {
      "additionalProperties": {
        "$ref": "#/$defs/RoleData"
      },
      "type": "object",
      "title": "Roles",
      "description": "Key-Value mapping of the roles in the system.\nThe key is the role key and the value contains some details about the role.",
      "deprecated": true
    },
    "condition_set_rules": {
      "additionalProperties": {
        "additionalProperties": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "type": "object"
        },
        "type": "object"
      },
      "type": "object",
      "title": "Condition Set Rules",
      "description": "Key-Value mapping of the permissions for each condition set.\nThe key is the user-set key and the value is Key-Value mapping of resource-set key to the permissions for that user-set & resource-set.The key is the resource key and the value is list of actions that the user-set can perform on that resource-set"
    },
    "condition_set_rules_expand": {
      "anyOf": [
        {
          "additionalProperties": {
            "additionalProperties": {
              "additionalProperties": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "type": "object"
            },
            "type": "object"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Condition Set Rules Expand",
      "description": "Sanitized Key-Value mapping of the permissions for each condition set.\n(Equal to condition_set_rules but user_set_key and resource_set_key are sanitized)The key is the user-set key and the value is Key-Value mapping of resource-set key to the permissions for that user-set & resource-set.The key is the resource key and the value is list of actions that the user-set can perform on that resource-set",
      "default": {}
    },
    "relationships": {
      "additionalProperties": {
        "additionalProperties": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "type": "object"
        },
        "type": "object"
      },
      "type": "object",
      "title": "Relationships",
      "description": "Key-Value mapping of the relationships between resources.\nThe key is the resource instance key and the value is Key-Value mapping of relation key to a Key-Value mapping of resource ( type ) to list of instances keys."
    },
    "resource_types": {
      "additionalProperties": {
        "$ref": "#/$defs/permit_backend__schemas__schema_opal_data__ResourceTypeData"
      },
      "type": "object",
      "title": "Resource Types",
      "description": "Key-Value mapping of the resource types in the system.\nThe key is the resource type key and the value contains some details about the resource type."
    },
    "condition_sets": {
      "additionalProperties": {
        "$ref": "#/$defs/ConditionSetData"
      },
      "type": "object",
      "title": "Condition Sets",
      "description": "Key-Value mapping of the condition sets in the system.\nThe key is the formatted condition set key and the value contains some details about the condition set."
    },
    "role_assignments": {
      "additionalProperties": {
        "additionalProperties": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "type": "object"
      },
      "type": "object",
      "title": "Role Assignments",
      "description": "Key-Value mapping of the role assignments for the users.\nThe key is the user key and the value is Key-Value mapping of resource instance key or tenant key to list of role keys assigned to the user in that resource instance."
    },
    "role_permissions": {
      "additionalProperties": {
        "additionalProperties": {
          "$ref": "#/$defs/RoleData"
        },
        "type": "object"
      },
      "type": "object",
      "title": "Role Permissions",
      "description": "Key-Value mapping of the permissions for each role.\nThe key is the resource key and the value is Key-Value mapping of role key to details on the role permissions."
    },
    "mapping_rules": {
      "additionalProperties": {
        "items": {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": "object"
        },
        "type": "array"
      },
      "type": "object",
      "title": "Mapping Rules",
      "description": "Key-Value mapping of groups of mapping rules in the system.\nThe key is the mapping rule group and the value is a list of mapping rules objects.We currently have only one group named 'all' which contains all the mapping rules.A mapping rule object contains, action, http_method, resource and url - all strings.",
      "default": {}
    },
    "resource_instances": {
      "additionalProperties": {
        "$ref": "#/$defs/ResourceInstanceAttributeData"
      },
      "type": "object",
      "title": "Resource Instances",
      "description": "Key-Value mapping of the resource instances in the system.\nThe key is the resource instance key and the value contains some details about the resource instance.",
      "default": {}
    }
  },
  "type": "object",
  "required": [
    "users",
    "tenants",
    "roles",
    "condition_set_rules",
    "relationships",
    "resource_types",
    "condition_sets",
    "role_assignments",
    "role_permissions"
  ],
  "$defs": {
    "ConditionSetData": {
      "properties": {
        "type": {
          "$ref": "#/$defs/ConditionSetType",
          "description": "The type of the condition set."
        },
        "key": {
          "type": "string",
          "title": "Key",
          "description": "The key of the condition set."
        }
      },
      "type": "object",
      "required": [
        "type",
        "key"
      ],
      "title": "ConditionSetData",
      "description": "This is the data of a specific condition set in the system"
    },
    "ConditionSetType": {
      "type": "string",
      "enum": [
        "userset",
        "resourceset"
      ],
      "title": "ConditionSetType"
    },
    "ResourceInstanceAttributeData": {
      "properties": {
        "tenant": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Tenant",
          "description": "The tenant key that this resource instance belongs to."
        },
        "attributes": {
          "additionalProperties": true,
          "type": "object",
          "title": "Attributes",
          "description": "Key-Value mapping of the attributes of the resource instance.\nThe key is the attribute key and the value is the attribute value.",
          "default": {}
        }
      },
      "type": "object",
      "title": "ResourceInstanceAttributeData",
      "description": "This is the data of a specific resource instance in the system"
    },
    "RoleData": {
      "properties": {
        "grants": {
          "anyOf": [
            {
              "additionalProperties": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Grants",
          "description": "Key-Value mapping of the resources and actions that the role can perform.\nThe key is the resource key and the value is a list of actions that the role can perform on that resource."
        },
        "attributes": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Attributes",
          "description": "Key-Value mapping of the attributes of the role.\nThe key is the attribute key and the value is the attribute value.",
          "default": {}
        }
      },
      "type": "object",
      "required": [
        "grants"
      ],
      "title": "RoleData",
      "description": "This is the data of a specific role in the system"
    },
    "TenantData": {
      "properties": {
        "roleAssignments": {
          "anyOf": [
            {
              "additionalProperties": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Roleassignments",
          "deprecated": true
        },
        "attributes": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Attributes",
          "description": "Key-Value mapping of the attributes of the tenant.\nThe key is the attribute key and the value is the attribute value."
        }
      },
      "type": "object",
      "required": [
        "attributes"
      ],
      "title": "TenantData",
      "description": "This is the data of a specific tenant in the system"
    },
    "UserData": {
      "properties": {
        "roleAssignments": {
          "anyOf": [
            {
              "additionalProperties": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Roleassignments",
          "description": "Key-Value mapping of the roles assigned to the user.\nThe key is the tenant key and the value is a list of role keys assigned to the user in that tenant.",
          "deprecated": true
        },
        "attributes": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Attributes",
          "description": "Key-Value mapping of the attributes of the user.\nThe key is the attribute key and the value is the attribute value."
        }
      },
      "type": "object",
      "required": [
        "roleAssignments",
        "attributes"
      ],
      "title": "UserData",
      "description": "This is the data of a specific user in the system"
    },
    "permit_backend__schemas__schema_opal_data__DerivationSettings": {
      "properties": {
        "superseded_by_direct_role": {
          "type": "boolean",
          "title": "Superseded By Direct Role",
          "description": "If True, the derived role is superseded by a direct role.meaning role derivation is not considered if the user has a direct role.",
          "default": false
        }
      },
      "type": "object",
      "title": "DerivationSettings",
      "description": "Settings for the derived role"
    },
    "permit_backend__schemas__schema_opal_data__DerivedRole": {
      "properties": {
        "conditions": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Conditions"
        },
        "settings": {
          "$ref": "#/$defs/permit_backend__schemas__schema_opal_data__DerivationSettings",
          "description": "Settings for the derived role."
        },
        "rules": {
          "items": {
            "$ref": "#/$defs/permit_backend__schemas__schema_opal_data__DerivedRoleRule"
          },
          "type": "array",
          "title": "Rules",
          "description": "List of rules for the derived role."
        }
      },
      "type": "object",
      "required": [
        "settings",
        "rules"
      ],
      "title": "DerivedRole",
      "description": "This is the data of a specific derived role in the system"
    },
    "permit_backend__schemas__schema_opal_data__DerivedRoleRule": {
      "properties": {
        "relation": {
          "type": "string",
          "title": "Relation",
          "description": "The relation between the resource and the related resource."
        },
        "related_resource": {
          "type": "string",
          "title": "Related Resource",
          "description": "The related resource type key."
        },
        "related_role": {
          "type": "string",
          "title": "Related Role",
          "description": "The related role key."
        },
        "settings": {
          "$ref": "#/$defs/permit_backend__schemas__schema_opal_data__DerivationSettings",
          "description": "Settings for the derived role rule."
        }
      },
      "type": "object",
      "required": [
        "relation",
        "related_resource",
        "related_role",
        "settings"
      ],
      "title": "DerivedRoleRule",
      "description": "This is the data of a specific derived role rule in the system"
    },
    "permit_backend__schemas__schema_opal_data__ResourceTypeData": {
      "properties": {
        "actions": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Actions",
          "description": "List of actions that can be performed on the resource."
        },
        "derived_roles": {
          "additionalProperties": {
            "$ref": "#/$defs/permit_backend__schemas__schema_opal_data__DerivedRole"
          },
          "type": "object",
          "title": "Derived Roles",
          "description": "Key-Value mapping of the derived roles for the resource type.\nThe key is the derived role key and the value is the details and conditions for the role derivation."
        }
      },
      "type": "object",
      "required": [
        "actions",
        "derived_roles"
      ],
      "title": "ResourceTypeData",
      "description": "This is the data of a specific resource type in the system"
    }
  }
}