PlayTitleDefinition play.title-definition@1

Generated at from openvibe-contracts v0.177.0 and openvibe-sdk v0.44.0.

Version
1.0.0
Owner
play
Visibility
public
Status
active
Compatibility
backward
Decision
Games ADR-0007
Schema
https://openvibe.network/contracts/play/title-definition.v1.json

A title as its own principal registers it (play.title.manage, PUT /api/v1/titles/:title). Achievements and boards are listed in display order; one left out is retired, never deleted. A board's kind never changes.

Fields

FieldTypeRequiredDescriptionConstraints
namestringyes
  • minLength 1
  • maxLength 80
urlstring | nullwhere the game is played
  • pattern ^https://
  • maxLength 300
summarystring
  • maxLength 300
achievementsarray of object
  • maxItems 200
  • items: no other fields
achievements[].idstringyes
  • pattern ^[a-z0-9][a-z0-9_-]{0,63}$
achievements[].namestringyes
  • minLength 1
  • maxLength 80
achievements[].descriptionstring
  • maxLength 300
achievements[].hiddenbooleana secret achievement: its name and text show only to whoever unlocked it
boardsarray of object
  • maxItems 200
  • items: no other fields
boards[].idstringyes
  • pattern ^[a-z0-9][a-z0-9_-]{0,63}$
boards[].namestringyes
  • minLength 1
  • maxLength 80
boards[].kindenumyesbest: each player's best score; sum: the total of their scores
  • one of "best", "sum"

Examples

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

Valid: basic
{
  "name": "Salvage Rush",
  "url": "https://openvibe.games/play?game=salvage-rush",
  "achievements": [
    {
      "id": "first-haul",
      "name": "First Haul",
      "description": "Finish a round with scrap."
    }
  ],
  "boards": [
    {
      "id": "best",
      "name": "Best round",
      "kind": "best"
    }
  ]
}
Rejected: basic
{
  "name": "X",
  "boards": [
    {
      "id": "best",
      "name": "Best",
      "kind": "median"
    }
  ]
}

Validate

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