GitCommit git.commit@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/commit.v1.json

One commit on OpenVibe.Git: its sha, message, author and committer, parents, tree, and — for the commit page or a contents write — its diff and per-file counts. api/view/commit.

Fields

FieldTypeRequiredDescriptionConstraints
shastringyesThe commit id: 40 hex characters (SHA-1) or 64 (SHA-256).
  • pattern ^[0-9a-f]{40}([0-9a-f]{24})?$
repostringyes
  • pattern ^[a-z0-9-]+/[a-z0-9][a-z0-9._-]{0,99}$
messagestringyes
  • maxLength 100000
subjectstringThe first line of the message.
  • maxLength 500
authorobjectyes
  • no other fields
author.namestringyes
author.emailstringyes
author.usernamestring | nullThe OpenVibe username when the email is a verified one.
author.datestringyes
  • format date-time
committerobjectyes
  • no other fields
committer.namestringyes
committer.emailstringyes
committer.datestringyes
  • format date-time
parentsarray of stringyes
  • maxItems 2
  • items: pattern ^[0-9a-f]{40}([0-9a-f]{24})?$
tree_shastringyes
  • pattern ^[0-9a-f]{40}([0-9a-f]{24})?$
datestringyes
  • format date-time
statsobject | null
filesarray of objectThe changed files, when the caller asked for the diff.
  • items: no other fields
files[].pathstringyes
files[].previous_pathstring | null
files[].statusenumyes
  • one of "added", "modified", "deleted", "renamed", "copied"
files[].additionsintegeryes
  • minimum 0
files[].deletionsintegeryes
  • minimum 0
files[].patchstring | null
diffstring | nullThe unified diff, when the caller asked for it.

Examples

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

Valid: with-diff
{
  "sha": "4f0c2d9a1e8b7c6d5a4f3e2d1c0b9a8f7e6d5c4b",
  "repo": "openvibers/openvibe.codes",
  "message": "Open the desk from a phone\n\nA narrow layout and a bigger tap target.",
  "subject": "Open the desk from a phone",
  "author": {
    "name": "Sam",
    "email": "[email protected]",
    "username": "sam",
    "date": "2026-11-09T08:40:00Z"
  },
  "committer": {
    "name": "Sam",
    "email": "[email protected]",
    "date": "2026-11-09T08:40:00Z"
  },
  "parents": [
    "a1b2c3d4e5f60718293a4b5c6d7e8f9012345678"
  ],
  "tree_sha": "b2c3d4e5f60718293a4b5c6d7e8f901234567890",
  "date": "2026-11-09T08:40:00Z",
  "stats": {
    "files": 2,
    "additions": 34,
    "deletions": 6
  },
  "files": [
    {
      "path": "public/css/codes.css",
      "previous_path": null,
      "status": "modified",
      "additions": 30,
      "deletions": 6,
      "patch": "@@ -12,3 +12,27 @@\n .desk { display: grid; }\n"
    },
    {
      "path": "test/phone.test.js",
      "previous_path": null,
      "status": "added",
      "additions": 4,
      "deletions": 0,
      "patch": null
    }
  ],
  "diff": "diff --git a/public/css/codes.css b/public/css/codes.css\n"
}
Rejected: bad-sha-and-repo
{
  "sha": "4f0c2d9a1e8b7c6d5a4f3e2d1c0b9a8f7e6d5c4b",
  "repo": "openviber",
  "message": "not a repo name",
  "author": {
    "name": "",
    "email": "[email protected]",
    "date": "yesterday"
  },
  "committer": {
    "name": "Sam",
    "email": "[email protected]",
    "date": "2026-11-09T08:40:00Z"
  },
  "parents": [],
  "tree_sha": "xyz",
  "date": "2026-11-09T08:40:00Z"
}

Validate

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