NewsStoryCreateRequest news.story-create-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/story-create-request.v1.json

news.story-create-request@1: the body of news.story.create on OpenVibe.News: POST /api/v1/stories { headline, cluster?, topic?, slug?, body? | paragraphs? } opens a story (editors; a service acts for the editor in X-OV-Subject). The cluster's live, non-duplicate source items become its first sources, numbered by publication date; body or paragraphs (citing those numbers or item ids) becomes revision 1. Refusals: 422 story.no_headline (missing or over 200 characters), 404 cluster.not_found, 422 topic.not_found, 422 story.invalid_slug, 409 story.slug_taken, 422 story.claim_unsourced / story.unknown_source for a paragraph that cites nothing or a source not attached.

Fields

FieldTypeRequiredDescriptionConstraints
headlinestringyesThe working headline; at most 200 characters once whitespace is collapsed.
  • minLength 1
clusterstringThe cluster (clu_…) to open the story from; merged clusters are followed.
cluster_idstringSame as cluster.
topicstring | nullAn active topic, by id (top_…) or slug.
slugstringDefault: made from the headline.
bodystringParagraphs separated by a blank line, each ending with the source numbers it rests on, e.g. "… said on Monday. [1, 3]".
paragraphsarray of object
  • minItems 1
  • maxItems 60
paragraphs[].textstringyesAt most 3000 characters once whitespace is collapsed.
  • minLength 1
paragraphs[].sourcesarray of one ofyesThe attached sources the paragraph rests on (at least one).
  • minItems 1

Examples

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

Valid: from-cluster
{
  "cluster": "clu_01JAB2X3C4D5E6F7G8H9J0KMNP",
  "headline": "Harbour bridge closes for inspection",
  "topic": "local",
  "paragraphs": [
    {
      "text": "The harbour bridge closed on Tuesday morning after inspectors found cracks in a support.",
      "sources": [
        1
      ]
    }
  ]
}
Valid: with-body
{
  "headline": "Harbour bridge closes for inspection",
  "body": "The harbour bridge closed on Tuesday morning. [1]\n\nThe council expects the inspection to take two weeks. [2]"
}
Rejected: no-headline
{
  "cluster": "clu_01JAB2X3C4D5E6F7G8H9J0KMNP",
  "body": "The harbour bridge closed. [1]"
}
Rejected: uncited-paragraph
{
  "headline": "Harbour bridge closes",
  "paragraphs": [
    {
      "text": "The bridge closed.",
      "sources": []
    }
  ]
}

Validate

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