NewsSourceAttachRequest news.source-attach-request@1

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

Version
1.0.0
Owner
news
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/news/source-attach-request.v1.json

news.source-attach-request@1: bodies of news.source.attach on OpenVibe.News (editors). POST /api/v1/stories/:id/sources { item } (or { item_id }) attaches a source item to the story's source table under the next number (a detached item gets its old number back); 404 source_item.not_found, 409 source_item.removed for an item removed upstream. DELETE /api/v1/stories/:id/sources/:item takes no body and detaches it (its number is never reused; its timeline entries go with it; 404 story.source_not_attached).

Fields

This schema has no named fields.

Examples

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

Valid: by-item
{
  "item": "nsi_01JAB2Z8Y6X5W4V3T2S1R0QPNM"
}
Valid: by-sources-id
{
  "item_id": "itm_01JAB2Y9K9M1N2P3Q4R5S6T7VW"
}
Valid: detach
{}
Rejected: not-an-item-id
{
  "item": "harbour-gazette"
}

Validate

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