IdentitySubjectProjection identity.subject-projection@1

Generated at from openvibe-contracts v0.53.0 and openvibe-sdk v0.11.0.

Version
1.0.0
Owner
network
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/identity/subject-projection.v1.json

identity.subject-projection@1: what OpenVibe.Network's identity resolver answers about a subject (server/identity/subjects.js resolve): the SubjectRef, the Network account behind it, its display fields, whether it is banned, and every legacy id mapped to it.

Fields

FieldTypeRequiredDescriptionConstraints
subjectidentity.subject-refyes
network_user_idinteger
network_anon_idinteger
usernamestringyes
display_namestringyes
avatar_urlstring | nullyes
bannedbooleanyes
legacy_idsarray of object
legacy_ids[].source_systemstringyes
legacy_ids[].source_typestringyes
legacy_ids[].source_idstringyes

Examples

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

Valid: user
{
  "subject": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "network_user_id": 1042,
  "username": "alice",
  "display_name": "Alice",
  "avatar_url": null,
  "banned": false,
  "legacy_ids": [
    {
      "source_system": "live",
      "source_type": "user",
      "source_id": "17"
    }
  ]
}
Rejected: banned-text
{
  "subject": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "username": "alice",
  "display_name": "Alice",
  "avatar_url": null,
  "banned": "no"
}

Validate

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