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
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
subject | identity.subject-ref | yes | ||
network_user_id | integer | |||
network_anon_id | integer | |||
username | string | yes | ||
display_name | string | yes | ||
avatar_url | string | null | yes | ||
banned | boolean | yes | ||
legacy_ids | array of object | |||
legacy_ids[].source_system | string | yes | ||
legacy_ids[].source_type | string | yes | ||
legacy_ids[].source_id | string | yes |
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 }] }