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

# modules.namespace@1 · OpenVibe.Services

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

# ModuleNamespace `modules.namespace@1`

Generated at 2026-12-01 05:42:00 UTC from [`openvibe-contracts v0.454.0`](https://github.com/OpenVibers/OpenVibe.Contracts/tree/v0.454.0) and [`openvibe-sdk v0.193.0`](https://github.com/OpenVibers/OpenVibe.SDK/tree/v0.193.0).

- Version: 1.0.0
- Owner: network
- Visibility: public
- Status: active
- Compatibility: backward
- Decision: [ADR-001](/docs/adr/ADR-001)
- Schema: [`https://openvibe.network/contracts/modules/namespace.v1.json`](/docs/contracts/modules.namespace.json)

Policy for one user-module namespace: portable per-subject summaries and preferences stored by OpenVibe.Network. Never domain truth, money or authoritative game inventory (roadmap 4.3-4.5). The person's account decides what happens to their records in every namespace: when an account is removed, Network deletes all of its records; when two accounts are merged (ADR-029), in a namespace where both have a record the survivor keeps its own and gains only the top-level fields it lacks from the other (its own values always win), a record only the absorbed account had moves to the survivor, and the absorbed account's records are deleted. Each of these changes is announced as network.module.updated (reason subject\_removed or subject\_merged). That is separate from onOwnerRemoved, which says what happens to a namespace's records when the service that owns the namespace is retired.

## Fields

| Field | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `namespace` | string | yes |  | - `pattern ^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+$` |
| `owner` | string | yes | Service that owns the namespace and may write it with network.modules.write. | - `pattern ^[a-z][a-z0-9-]{1,39}$` |
| `version` | integer | yes | Schema version stored with every record; a change needs a migration note. | - `minimum 1` |
| `description` | string |  |  |  |
| `schema` | object | yes | JSON Schema (2020-12) every stored value must satisfy. |  |
| `writers` | array of enum | yes | owner = the owning service with a token; user = the subject themselves. | - `minItems 1`<br>- `items: one of "owner", "user"` |
| `publicFields` | array of string | yes | Top-level fields anyone may read. Everything else is readable only by the subject and granted services. |  |
| `quotaBytes` | integer | yes |  | - `minimum 64`<br>- `maximum 65536` |
| `onOwnerRemoved` | enum | yes | What happens to records when the owning service or mod is retired. | - `one of "retain-readonly", "delete-after-retention"` |
| `retentionDays` | integer |  |  | - `minimum 0` |
| `migration` | string |  | How records of the previous version are upgraded. |  |
| `readers` | object |  | Field-level read rules: a service other than the owner, holding network.modules.read for the namespace, sees publicFields plus the fields listed for it here, and nothing else. A service not listed sees publicFields only. The owner and the person always see the whole record. |  |
| `migrations` | array of object |  | Declarative upgrades from each earlier version, applied in order when a stored record's version is below the namespace's: rename moves a field, drop removes fields, defaults adds fields the record lacks. Network upgrades a record when it is read and stores the upgraded record on its next write. | - `items: no other fields` |
| `migrations[].from` | integer | yes |  | - `minimum 1` |
| `migrations[].to` | integer | yes |  | - `minimum 2` |
| `migrations[].rename` | object |  |  |  |
| `migrations[].drop` | array of string |  |  |  |
| `migrations[].defaults` | object |  |  |  |

## Examples

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

 Valid: live-profile

~~~~
{
  "namespace": "live.profile",
  "owner": "live",
  "version": 1,
  "description": "Live channel summary shown on other sites. Written by Live only.",
  "writers": [
    "owner"
  ],
  "publicFields": [
    "channel_url",
    "followers",
    "is_streamer",
    "last_live_at"
  ],
  "quotaBytes": 4096,
  "onOwnerRemoved": "retain-readonly",
  "schema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "channel_url": {
        "type": "string",
        "format": "uri"
      },
      "followers": {
        "type": "integer",
        "minimum": 0
      },
      "is_streamer": {
        "type": "boolean"
      },
      "last_live_at": {
        "type": [
          "string",
          "null"
        ]
      },
      "stream_minutes_30d": {
        "type": "integer",
        "minimum": 0
      }
    }
  }
}
~~~~

Rejected: huge-quota

~~~~
{
  "namespace": "x.y",
  "owner": "live",
  "version": 1,
  "schema": {},
  "writers": [
    "user"
  ],
  "publicFields": [],
  "quotaBytes": 10000000,
  "onOwnerRemoved": "retain-readonly"
}
~~~~

Rejected: no-writers

~~~~
{
  "namespace": "x.y",
  "owner": "live",
  "version": 1,
  "schema": {},
  "writers": [],
  "publicFields": [],
  "quotaBytes": 100,
  "onOwnerRemoved": "retain-readonly"
}
~~~~

## Validate

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