{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/avala-ai/json-schema/avala-ai-dataset-item-schema.json",
  "title": "DatasetItem",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/avala-ai-openapi.json#/components/schemas/DatasetItem",
  "required": [
    "key"
  ],
  "type": "object",
  "properties": {
    "id": {
      "title": "Id",
      "type": "integer",
      "readOnly": true
    },
    "uid": {
      "title": "Uid",
      "type": "string",
      "format": "uuid",
      "readOnly": true
    },
    "dataset": {
      "title": "Dataset",
      "type": "string",
      "readOnly": true
    },
    "dataset_owner_name": {
      "title": "Dataset owner name",
      "description": "Owner handle/slug of the item's source dataset, for dataset-scoped URLs (e.g. the image-segmentation submit endpoint). A slice can reference datasets owned by other users/orgs, so this is not necessarily the slice owner.",
      "type": "string",
      "readOnly": true,
      "minLength": 1
    },
    "dataset_slug": {
      "title": "Dataset slug",
      "description": "Slug of the item's source dataset.",
      "type": "string",
      "readOnly": true,
      "minLength": 1
    },
    "url": {
      "title": "Url",
      "type": "string",
      "readOnly": true,
      "minLength": 1
    },
    "created_at": {
      "title": "Created at",
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "updated_at": {
      "title": "Updated at",
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "key": {
      "title": "Key",
      "type": "string",
      "maxLength": 1024,
      "minLength": 1
    },
    "gpu_texture_url": {
      "title": "Gpu texture url",
      "type": "string",
      "readOnly": true
    },
    "metadata": {
      "title": "Metadata",
      "type": "object"
    },
    "thumbnails": {
      "type": "array",
      "items": {
        "type": [
          "string",
          "null"
        ]
      },
      "readOnly": true
    },
    "video_thumbnail": {
      "title": "Video thumbnail",
      "description": "Get the URL for the video thumbnail (.webm clip) if available.",
      "type": "string",
      "readOnly": true,
      "minLength": 1
    },
    "export_snippet": {
      "title": "Export snippet",
      "type": [
        "object",
        "null"
      ],
      "readOnly": true
    },
    "annotations": {
      "$ref": "#/$defs/DatasetItemAnnotationList"
    },
    "crop_data": {
      "$ref": "#/$defs/DatasetItemCrop"
    },
    "related_items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RelatedItem"
      },
      "readOnly": true
    },
    "related_sequence_uid": {
      "title": "Related sequence uid",
      "type": "string",
      "format": "uuid",
      "readOnly": true
    },
    "is_hidden": {
      "title": "Is hidden",
      "type": "boolean",
      "readOnly": true
    },
    "masks_fingerprint": {
      "title": "Masks fingerprint",
      "description": "Fingerprint of the segmentation masks in export_snippet. Send it back in the X-Avala-Masks-Fingerprint header when saving masks through the image-segmentation endpoint; the save is refused with 409 (code masks_fingerprint_conflict) if the item's masks changed since. Null when unknown; then send no header.",
      "type": [
        "string",
        "null"
      ],
      "readOnly": true,
      "minLength": 1
    }
  },
  "$defs": {
    "AnnotationProject": {
      "required": [
        "name"
      ],
      "type": "object",
      "properties": {
        "uid": {
          "title": "Uid",
          "type": "string",
          "format": "uuid",
          "readOnly": true
        },
        "name": {
          "title": "Name",
          "type": "string",
          "maxLength": 100,
          "minLength": 1
        }
      }
    },
    "AnnotationUser": {
      "required": [
        "username"
      ],
      "type": "object",
      "properties": {
        "uid": {
          "title": "Uid",
          "type": "string",
          "format": "uuid",
          "readOnly": true
        },
        "full_name": {
          "title": "Full name",
          "type": "string",
          "readOnly": true
        },
        "username": {
          "title": "Username",
          "description": "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.",
          "type": "string",
          "pattern": "^[\\w.@+-]+$",
          "maxLength": 150,
          "minLength": 1
        },
        "picture": {
          "title": "Picture",
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "maxLength": 2048
        }
      }
    },
    "CropAnnotationsIn2dSerailizer": {
      "required": [
        "z",
        "classes"
      ],
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "z": {
          "title": "Z",
          "type": "number"
        },
        "classes": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1
        }
      }
    },
    "DatasetItemAnnotation": {
      "required": [
        "task_name",
        "task_object",
        "object_uuid"
      ],
      "type": "object",
      "properties": {
        "task_name": {
          "title": "Task name",
          "type": "string",
          "minLength": 1
        },
        "task_object": {
          "title": "Task object",
          "type": "string",
          "minLength": 1
        },
        "object_uuid": {
          "title": "Object uuid",
          "type": [
            "string",
            "null"
          ],
          "minLength": 1
        },
        "data": {
          "title": "Data",
          "type": "object",
          "readOnly": true
        }
      }
    },
    "DatasetItemAnnotationList": {
      "required": [
        "nodes",
        "projects"
      ],
      "type": "object",
      "properties": {
        "nodes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DatasetItemAnnotationNode"
          }
        },
        "projects": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AnnotationProject"
          }
        }
      }
    },
    "DatasetItemAnnotationNode": {
      "required": [
        "annotation_info",
        "status",
        "uid",
        "project_index",
        "children"
      ],
      "type": "object",
      "properties": {
        "annotation_info": {
          "$ref": "#/$defs/DatasetItemAnnotation"
        },
        "status": {
          "title": "Status",
          "type": "string",
          "minLength": 1
        },
        "uid": {
          "title": "Uid",
          "type": "string",
          "minLength": 1
        },
        "project_index": {
          "title": "Project index",
          "type": [
            "integer",
            "null"
          ]
        },
        "annotator": {
          "$ref": "#/$defs/AnnotationUser"
        },
        "reviewer": {
          "$ref": "#/$defs/AnnotationUser"
        },
        "children": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DatasetItemAnnotationNode"
          }
        }
      }
    },
    "DatasetItemCrop": {
      "type": "object",
      "properties": {
        "crop_annotations_in_2d": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/CropAnnotationsIn2dSerailizer"
          }
        },
        "crop_annotations_polygon_mask": {
          "description": "List of coordinates for the polygon mask in the format: [[x1, y1], ..., [xN, yN]].",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "maxItems": 2,
            "minItems": 2
          },
          "readOnly": true,
          "minItems": 3
        },
        "where": {
          "title": "Where",
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "dataset",
            "sequence",
            "frame",
            "dataset_item"
          ]
        }
      }
    },
    "RelatedItem": {
      "required": [
        "sensor_id",
        "sensor_index",
        "uid"
      ],
      "type": "object",
      "properties": {
        "sensor_id": {
          "title": "Sensor id",
          "type": [
            "string",
            "null"
          ],
          "minLength": 1
        },
        "sensor_index": {
          "title": "Sensor index",
          "type": [
            "integer",
            "null"
          ]
        },
        "uid": {
          "title": "Uid",
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        }
      }
    }
  }
}