# dev.knotless.ref

> Published by [lexicons.knotless.dev](https://lexicon.garden/identity/did:plc:yqsg7znbbhfmj3a2nrpnaerk)

✓ This is the authoritative definition for this NSID.

## Description

One git ref of a repository.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.ref)
- [Documentation](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.ref/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.ref/examples)

## Definitions

### `dev.knotless.ref`

**Type**: `record`

Keyed `<repo key>.<ref hash>`, where the hash is the first 26 characters of the lowercase unpadded base32 SHA-256 of `name`. Written only in the same applyWrites as the dev.knotless.claim for its current generation.

**Key**: `any`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `generation` | `integer` | Yes | How many times the ref has moved. |
| `name` | `string` | Yes | The full ref name, such as refs/heads/main. |
| `pusher` | `string` (did) | No | The account that last moved the ref, when not the repository's owner: a collaborator or runner pushing through the gateway, which sets it from the caller's verified service token. Readers credit it only while the repository names it among its collaborators or runners. |
| `repo` | `string` (tid) | Yes | The `key` of the dev.knotless.repo this ref belongs to. |
| `target` | `string` | No | The hex object ID the ref points at. Absent once the ref is deleted; the record stays so its generation never repeats. |
| `updatedAt` | `string` (datetime) | Yes | When the ref last moved. |

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Keyed `<repo key>.<ref hash>`, where the hash is the first 26 characters of the lowercase unpadded base32 SHA-256 of `name`. Written only in the same applyWrites as the dev.knotless.claim for its current generation.",
      "key": "any",
      "record": {
        "properties": {
          "generation": {
            "description": "How many times the ref has moved.",
            "minimum": 1,
            "type": "integer"
          },
          "name": {
            "description": "The full ref name, such as refs/heads/main.",
            "maxLength": 1024,
            "type": "string"
          },
          "pusher": {
            "description": "The account that last moved the ref, when not the repository's owner: a collaborator or runner pushing through the gateway, which sets it from the caller's verified service token. Readers credit it only while the repository names it among its collaborators or runners.",
            "format": "did",
            "type": "string"
          },
          "repo": {
            "description": "The `key` of the dev.knotless.repo this ref belongs to.",
            "format": "tid",
            "type": "string"
          },
          "target": {
            "description": "The hex object ID the ref points at. Absent once the ref is deleted; the record stays so its generation never repeats.",
            "maxLength": 64,
            "minLength": 40,
            "type": "string"
          },
          "updatedAt": {
            "description": "When the ref last moved.",
            "format": "datetime",
            "type": "string"
          }
        },
        "required": [
          "repo",
          "name",
          "generation",
          "updatedAt"
        ],
        "type": "object"
      },
      "type": "record"
    }
  },
  "description": "One git ref of a repository.",
  "id": "dev.knotless.ref",
  "lexicon": 1
}
```
