# revision.json

> Eine Revision im Projektspeicher, Schreibstände und Geräte.

Quelle: https://bauzertifikate.de/docs/bzf/schemas/revision · BZF 0.3.0 (https://github.com/bauzertifikate/bzf/tree/fe92cf4342f2e9140f14f66262c2f5a30a99be45) · Weitere Seiten: https://bauzertifikate.de/llms.txt

- **Status:** Stabil
- **Ablage:** im Projektspeicher `.bauzertifikate/`
- **$id:** `https://bauzertifikate.de/schema/bzf/1/revision.json`
- **Schema laden:** [/schema/bzf/1/revision.json](https://bauzertifikate.de/schema/bzf/1/revision.json) (JSON Schema 2020-12)

## Beschreibung

A revision: one state of the whole project and who made it, an object in `.bauzertifikate/objects/` named by the SHA-256 of its canonical JSON (RFC 8785), so it is never rewritten. Its tree names every document by path and object; its parents are the revisions it follows (one for a change, two for a merge, none for the first). Every store format has `format`; this schema describes the rest for bzf/1.x, and a revision of a newer major format makes a reader open the project read-only. The writer's own files beside the objects, its head and the device's record, and the tombstone of a purged object are described under $defs.

## Das Dokument

Eine Projektdatei des Speicherformats `bzf/1` hat die folgenden Felder. Eine andere Hauptversion muss nur sagen, welche sie ist.

| Feld | Typ | Beschreibung |
|---|---|---|
| `format` **Pflicht** | `string` | The store format it was written in: "bzf/1". (Muster `^bzf/`) |
| `tree` **Pflicht** | Zuordnung `string` → [`hash`](https://bauzertifikate.de/docs/bzf/schemas/common.md#hash) | The project's documents: path → the hash of the document's canonical JSON. A writer of bzf/1 names documents by lower-case ASCII letters, digits, `-`, `_` and `.` in parts separated by `/`, ending in `.json`, no part starting with a dot ("buildings/0193….json", "aufmass/import.json"); a reader keeps any other path it finds and doesn't write it out. Each document is also written under `Daten/` by its path. |
| `parents` | Liste von [`hash`](https://bauzertifikate.de/docs/bzf/schemas/common.md#hash) | The revisions it follows: one for a change, two for a merge, none for the first. |
| `device` | `string` | The device that wrote it: an opaque id, never a name or an e-mail address. |
| `app` | `string` | The app that wrote it: "Aufmaß", "Energieberatung". |
| `appVersion` | `string` | – |
| `kernelVersion` | `string` | The version of the calculation kernel the app ran. |
| `account` | `string` | The account it was written for, where there is one: an opaque id. |
| `organisation` | `string` | The organisation it was written for, where there is one: an opaque id. |
| `time` | [`time`](https://bauzertifikate.de/docs/bzf/schemas/common.md#time) | When it was written. |
| `message` | `string` | What was done: "Planstand 2 eingelesen". |
| `appliedSteps` | Liste von [`id`](https://bauzertifikate.de/docs/bzf/schemas/common.md#id) | Draft until spec 1.0. The roadmap steps this revision carried into the building, by their ids: it marks each step done and applies the step's changes to the building document (roadmap.json; README, "How the documents are written"). The building before a step is the one in this revision's parent. |

## Typen

Die Typen dieses Schemas, auf die seine Felder verweisen.

### `head`

A writer's head, `.bauzertifikate/heads/<device>.<app>.json`: the revision it is at, and the results it wrote. Each writer (an app on a device) moves only its own head, so no file is written by two writers. A plain file, not an object.

| Feld | Typ | Beschreibung |
|---|---|---|
| `device` **Pflicht** | `string` | – |
| `app` **Pflicht** | `string` | – |
| `revision` | [`hash`](https://bauzertifikate.de/docs/bzf/schemas/common.md#hash) oder `null` | The revision it is at; null before its first. |
| `time` | [`time`](https://bauzertifikate.de/docs/bzf/schemas/common.md#time) oder `""` | When it was last moved. |
| `results` | Zuordnung `string` → [`result`](#result) | The results it wrote under `Ergebnisse/`, by their path there ("Aufmass/mengen.xlsx"): what each was made from, so a reader can tell when one has gone stale. |

### `result`

A result as its writer's head records it.

| Feld | Typ | Beschreibung |
|---|---|---|
| `sha256` **Pflicht** | [`hash`](https://bauzertifikate.de/docs/bzf/schemas/common.md#hash) | The hash of the result's bytes, by which it is recognised. |
| `revision` **Pflicht** | [`hash`](https://bauzertifikate.de/docs/bzf/schemas/common.md#hash) oder `null` | The revision it was made from. |
| `time` | [`time`](https://bauzertifikate.de/docs/bzf/schemas/common.md#time) | When it was written. |
| `inputs` | Zuordnung `string` → [`hash`](https://bauzertifikate.de/docs/bzf/schemas/common.md#hash) | Draft until spec 1.0. The documents it was made from, path → the hash of the document's canonical JSON, where its writer knows them. The result is then current while each of them still has this hash, whatever else a later revision changed; without the list it is current only at `revision`. A result record (result.json) carries its own list, which is the same. |

### `purged`

Draft until spec 1.0. A tombstone, `.bauzertifikate/purged/<hash>.json`: the object of that hash was removed from the store on purpose (a GDPR erasure, a wrong building's plans) and its file deleted, while the revisions that name it stay as they were. A reader that misses an object looks here first: a purged object is shown as removed ("entfernt"), never waited for as one a sync has not brought yet, and a merge treats the document as removed. Every writer that syncs the folder deletes its own copy of the object once it sees the tombstone.

| Feld | Typ | Beschreibung |
|---|---|---|
| `hash` **Pflicht** | [`hash`](https://bauzertifikate.de/docs/bzf/schemas/common.md#hash) | The object removed. |
| `time` **Pflicht** | [`time`](https://bauzertifikate.de/docs/bzf/schemas/common.md#time) | A time in RFC 3339, local time with its offset. |
| `reason` | `string` | Why, as people read it: "Löschung auf Wunsch der Eigentümerin", "Pläne eines anderen Gebäudes". |
| `device` | `string` | – |
| `app` | `string` | – |
| `account` | `string` | – |

### `device`

A device's record, `.bauzertifikate/devices/<device>.json`: where it last saw the project, so that opening a copied folder can ask whether it is a copy or was moved. A plain file of that device's alone.

| Feld | Typ | Beschreibung |
|---|---|---|
| `device` **Pflicht** | `string` | – |
| `project` **Pflicht** | `string` | The project's id as the device saw it. |
| `path` **Pflicht** | `string` | The folder's path on that device. |
| `seen` | [`time`](https://bauzertifikate.de/docs/bzf/schemas/common.md#time) | When. |

## Lesen und prüfen

Die Beschreibungen stammen unverändert aus dem Schema und sind wie die Spezifikation englisch. Jedes Objekt lässt weitere Felder zu (`additionalProperties: true`): Programme bewahren Felder und Werte, die sie nicht kennen. Wie ein Dokument geprüft wird, steht im [Schnellstart](https://bauzertifikate.de/docs/bzf/schnellstart.md#pruefen).
