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

FieldTypeRequiredDescriptionConstraints
idstringyes<namespace>.<kind>, e.g. live.name_effect, games.skin, network.badge.
  • pattern ^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$
  • maxLength 64
namestringyes
  • minLength 1
  • maxLength 80
descriptionstring
  • maxLength 500
slotsarray of stringyesWhere one item of the kind can be equipped; empty: the kind is not equippable (a collectible, a badge shown on the profile).
  • maxItems 16
  • unique items
  • items: pattern ^[a-z][a-z0-9_]{0,31}$
surfacesarray of objectyes
  • minItems 1
  • maxItems 16
  • items: no other fields
surfaces[].surfacestringyesWhere an item of this kind shows.
  • pattern ^(chat|overlay|profile|game:[a-z][a-z0-9-]*)$
surfaces[].rendererstringyesThe renderer contract the surface implements for this kind, e.g. live.name_effect.css@1.
  • minLength 1
  • maxLength 80
attributesobjectyesA JSON Schema every definition's attributes must satisfy.
stackablebooleanyesTrue: one person may hold several instances of one definition.
issuerstringyesWho owns the kind's namespace.
  • pattern ^(service:[a-z][a-z0-9-]*|app:app_[0-9A-HJKMNP-TV-Z]{26}|user:usr_[0-9A-HJKMNP-TV-Z]{26})$
workshopbooleanA 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 }] }