---
title: "git.tree@1 · OpenVibe.Services"
canonical: "https://openvibe.services/docs/contracts/git.tree"
updated: null
---

# git.tree@1 · OpenVibe.Services

HTML: [git.tree@1 · OpenVibe.Services](https://openvibe.services/docs/contracts/git.tree)

# GitTree `git.tree@1`

Generated at 2026-11-13 06:25:48 UTC from [`openvibe-contracts v0.419.0`](https://github.com/OpenVibers/OpenVibe.Contracts/tree/v0.419.0) and [`openvibe-sdk v0.161.0`](https://github.com/OpenVibers/OpenVibe.SDK/tree/v0.161.0).

- Version: 1.0.0
- Owner: git
- Visibility: public
- Status: active
- Compatibility: backward
- Schema: [`https://openvibe.network/contracts/git/tree.v1.json`](/docs/contracts/git.tree.json)

One directory of a repository at a ref: its entries with mode, size and the last commit that touched each. api/view/tree.

## Fields

| Field | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `repo` | string | yes |  | - `pattern ^[a-z0-9-]+/[a-z0-9][a-z0-9._-]{0,99}$` |
| `ref` | string | yes | The branch, tag or commit the tree was read at. | - `minLength 1`<br>- `maxLength 255` |
| `path` | string | yes | The directory, empty at the repository root. | - `maxLength 4096` |
| `entries` | array of object | yes |  | - `items: no other fields` |
| `entries[].name` | string | yes |  |  |
| `entries[].path` | string | yes |  |  |
| `entries[].type` | enum | yes |  | - `one of "blob", "tree", "commit"` |
| `entries[].mode` | string | yes |  | - `pattern ^[0-7]{6}$` |
| `entries[].sha` | string | yes |  | - `pattern ^[0-9a-f]{40}([0-9a-f]{24})?$` |
| `entries[].size` | integer \| null |  |  | - `minimum 0` |
| `entries[].last_commit` | object \| null |  |  |  |

## Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

 Valid: root

~~~~
{
  "repo": "openvibers/openvibe.codes",
  "ref": "main",
  "path": "",
  "entries": [
    {
      "name": "server",
      "path": "server",
      "type": "tree",
      "mode": "040000",
      "sha": "c3d4e5f60718293a4b5c6d7e8f90123456789012",
      "size": null,
      "last_commit": {
        "sha": "4f0c2d9a1e8b7c6d5a4f3e2d1c0b9a8f7e6d5c4b",
        "message": "Open the desk from a phone",
        "date": "2026-11-09T08:40:00Z",
        "author_name": "Sam"
      }
    },
    {
      "name": "README.md",
      "path": "README.md",
      "type": "blob",
      "mode": "100644",
      "sha": "d4e5f60718293a4b5c6d7e8f9012345678901234",
      "size": 1421,
      "last_commit": null
    }
  ]
}
~~~~

Rejected: bad-type-and-size

~~~~
{
  "repo": "openvibers/openvibe.codes",
  "ref": "main",
  "path": "",
  "entries": [
    {
      "name": "server",
      "path": "server",
      "type": "directory",
      "mode": "040000",
      "sha": "c3d4e5f60718293a4b5c6d7e8f90123456789012",
      "size": -2,
      "last_commit": null
    }
  ]
}
~~~~

## Validate

~~~~
const contracts = require('openvibe-contracts');
contracts.validate('git.tree@1', value);   // { valid, errors: [{ path, message }] }
~~~~
