InventoryKind inventory.kind@1
Generated at from
openvibe-contracts v0.127.0 and
openvibe-sdk v0.37.0.
- Version
- 1.0.0
- Owner
- inventory
- Visibility
- public
- Status
- active
- Compatibility
- backward
- Decision
- ADR-054
- Schema
https://openvibe.network/contracts/inventory/kind.v1.json
An item kind (ADR-054 §2): what items of the kind carry (an attribute schema), where they can be equipped (slots) and which surfaces render them. A new kind is a contract plus a renderer, never a new table.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
id | string | yes | <namespace>.<kind>, e.g. live.name_effect, games.skin, network.badge. |
|
name | string | yes |
| |
description | string |
| ||
slots | array of string | yes | Where one item of the kind can be equipped; empty: the kind is not equippable (a collectible, a badge shown on the profile). |
|
surfaces | array of object | yes |
| |
surfaces[].surface | string | yes | Where an item of this kind shows. |
|
surfaces[].renderer | string | yes | The renderer contract the surface implements for this kind, e.g. live.name_effect.css@1. |
|
attributes | object | yes | A JSON Schema every definition's attributes must satisfy. | |
stackable | boolean | yes | True: one person may hold several instances of one definition. | |
issuer | string | yes | Who owns the kind's namespace. |
|
workshop | boolean | A Workshop kind (ADR-054 §6): any signed-in person may submit a definition of it, issued by and credited to them, published only after staff review. |
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: badge-not-equippable
{
"id": "network.badge",
"name": "Badge",
"description": "How your name looks in chat.",
"slots": [],
"surfaces": [
{
"surface": "profile",
"renderer": "network.badge.img@1"
}
],
"attributes": {
"type": "object",
"required": [
"css_class"
],
"properties": {
"css_class": {
"type": "string"
}
}
},
"stackable": true,
"issuer": "service:network"
}Valid: name-effect
{
"id": "live.name_effect",
"name": "Name effect",
"description": "How your name looks in chat.",
"slots": [
"name_effect"
],
"surfaces": [
{
"surface": "chat",
"renderer": "live.name_effect.css@1"
},
{
"surface": "profile",
"renderer": "live.name_effect.css@1"
}
],
"attributes": {
"type": "object",
"required": [
"css_class"
],
"properties": {
"css_class": {
"type": "string"
}
}
},
"stackable": false,
"issuer": "service:live"
}Rejected: bad-id
{
"id": "NameEffect",
"name": "Name effect",
"description": "How your name looks in chat.",
"slots": [
"name_effect"
],
"surfaces": [
{
"surface": "chat",
"renderer": "live.name_effect.css@1"
},
{
"surface": "profile",
"renderer": "live.name_effect.css@1"
}
],
"attributes": {
"type": "object",
"required": [
"css_class"
],
"properties": {
"css_class": {
"type": "string"
}
}
},
"stackable": false,
"issuer": "service:live"
}Rejected: bad-surface
{
"id": "live.name_effect",
"name": "Name effect",
"description": "How your name looks in chat.",
"slots": [
"name_effect"
],
"surfaces": [
{
"surface": "billboard",
"renderer": "x"
}
],
"attributes": {
"type": "object",
"required": [
"css_class"
],
"properties": {
"css_class": {
"type": "string"
}
}
},
"stackable": false,
"issuer": "service:live"
}Rejected: no-surface
{
"id": "live.name_effect",
"name": "Name effect",
"description": "How your name looks in chat.",
"slots": [
"name_effect"
],
"surfaces": [],
"attributes": {
"type": "object",
"required": [
"css_class"
],
"properties": {
"css_class": {
"type": "string"
}
}
},
"stackable": false,
"issuer": "service:live"
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('inventory.kind@1', value); // { valid, errors: [{ path, message }] }