MediaRef media.media-ref@1

Generated at from openvibe-contracts v0.33.0 and openvibe-sdk v0.5.0.

Version
1.0.0
Owner
media
Visibility
public
Status
active
Compatibility
backward
Decision
ADR-006
Schema
https://openvibe.network/contracts/media/media-ref.v1.json

Reference to a Media object. Canonical ids (med_<ULID>) arrive with the Wave 4 object model; until then legacy:<app>:<kind>:<id> addresses today's VOD/clip/file/paste/thumbnail rows.

Fields

FieldTypeRequiredDescriptionConstraints
media_idstringyes
  • pattern ^(med_[0-9A-HJKMNP-TV-Z]{26}|legacy:[a-z][a-z0-9-]{1,39}:(vod|clip|file|paste|thumbnail|avatar):[A-Za-z0-9._/-]{1,200})$
rolestring
  • pattern ^[a-z][a-z0-9_]{1,39}$
variantstring
  • pattern ^[a-z0-9][a-z0-9_-]{0,39}$

Examples

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

Valid: canonical
{
  "media_id": "med_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "role": "attachment"
}
Valid: legacy
{
  "media_id": "legacy:live:vod:1203",
  "variant": "720p"
}
Rejected: bare-integer
{
  "media_id": "1203"
}
Rejected: unknown-kind
{
  "media_id": "legacy:live:song:1"
}

Validate

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