SearchWriteResult search.write-result@1

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

Version
1.0.0
Owner
search
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/search/write-result.v1.json

search.write-result@1: the answer of PUT /api/v1/documents/:owner/:type/:id (search.document.write). applied: stored (or a tombstone recorded); unchanged: the same revision with the same content. A revision older than the stored one is a 409 problem search.stale_revision; the same revision with different content is 409 search.revision_conflict.

Fields

FieldTypeRequiredDescriptionConstraints
outcomeenumyes
  • one of "applied", "unchanged"
revisionintegeryes
  • minimum 1
stored_revisioninteger | nullWhat Search held before this write (null: nothing).
deletedboolean

Examples

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

Valid: applied
{
  "outcome": "applied",
  "revision": 2,
  "stored_revision": 1,
  "deleted": false
}
Rejected: stale-is-a-problem
{
  "outcome": "stale",
  "revision": 1
}

Validate

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