{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/looot/json-schema/looot-workspace-directory-page-schema.json",
  "title": "WorkspaceDirectoryPage",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/looot-workspace-directories-api-openapi.yml#/components/schemas/WorkspaceDirectoryPage",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "entries",
    "namespaceRevision",
    "directoryRevision"
  ],
  "properties": {
    "entries": {
      "type": "array",
      "maxItems": 100000,
      "items": {
        "$ref": "#/$defs/WorkspaceDirectoryEntry"
      }
    },
    "namespaceRevision": {
      "type": "string",
      "pattern": "^sha256:[a-f0-9]{64}$"
    },
    "directoryRevision": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "$defs": {
    "WorkspaceDirectoryEntry": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "path",
            "revision"
          ],
          "properties": {
            "kind": {
              "const": "directory"
            },
            "path": {
              "type": "string",
              "minLength": 2,
              "maxLength": 1024,
              "pattern": "^/(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*(?:^|/)\\.(?:/|$))(?!.*//)(?!.*\\\\)(?!.*[\\u0000-\\u001f\\u007f])[^/]{1,255}(?:/[^/]{1,255})*$"
            },
            "revision": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "path",
            "file"
          ],
          "properties": {
            "kind": {
              "const": "file"
            },
            "path": {
              "type": "string",
              "minLength": 2,
              "maxLength": 1024,
              "pattern": "^/(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*(?:^|/)\\.(?:/|$))(?!.*//)(?!.*\\\\)(?!.*[\\u0000-\\u001f\\u007f])[^/]{1,255}(?:/[^/]{1,255})*$"
            },
            "file": {
              "$ref": "#/$defs/WorkspaceFile"
            }
          }
        }
      ]
    },
    "WorkspaceFile": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "fileId",
        "tenantId",
        "path",
        "contentType",
        "byteLength",
        "digest",
        "createdAt",
        "updatedAt",
        "expiresAt",
        "revision"
      ],
      "properties": {
        "fileId": {
          "type": "string",
          "pattern": "^wfl_[a-f0-9]{32}$"
        },
        "tenantId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "path": {
          "type": "string",
          "minLength": 2,
          "maxLength": 1024,
          "pattern": "^/(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*(?:^|/)\\.(?:/|$))(?!.*//)(?!.*\\\\)(?!.*[\\u0000-\\u001f\\u007f])[^/]{1,255}(?:/[^/]{1,255})*$"
        },
        "contentType": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "byteLength": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "digest": {
          "type": "string",
          "pattern": "^sha256:[a-f0-9]{64}$"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        },
        "revision": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        }
      }
    }
  }
}