GitTree git.tree@1

Generated at from openvibe-contracts v0.419.0 and openvibe-sdk v0.161.0.

Version
1.0.0
Owner
git
Visibility
public
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/git/tree.v1.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

FieldTypeRequiredDescriptionConstraints
repostringyes
  • pattern ^[a-z0-9-]+/[a-z0-9][a-z0-9._-]{0,99}$
refstringyesThe branch, tag or commit the tree was read at.
  • minLength 1
  • maxLength 255
pathstringyesThe directory, empty at the repository root.
  • maxLength 4096
entriesarray of objectyes
  • items: no other fields
entries[].namestringyes
entries[].pathstringyes
entries[].typeenumyes
  • one of "blob", "tree", "commit"
entries[].modestringyes
  • pattern ^[0-7]{6}$
entries[].shastringyes
  • pattern ^[0-9a-f]{40}([0-9a-f]{24})?$
entries[].sizeinteger | null
  • minimum 0
entries[].last_commitobject | 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 }] }