CommunityPostWriteRequest community.post-write-request@1

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

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

community.post-write-request@1: bodies of the forum writes on OpenVibe.Community (community.post.create; a service writes as X-OV-Subject, or as AI with X-OV-Origin: ai). POST /api/v1/spaces/:space/threads: { title, body, members_only?, category?, attachments?, pastes? } (title 3 to 200 characters after whitespace is collapsed; body Markdown, non-blank, at most 40000 characters; body_markdown is accepted for body). POST …/threads/:slug/posts (a reply) and PUT /api/v1/posts/:id (an edit): { body, attachments?, pastes? }. POST …/threads/:slug/votes: { value: 1 | -1 | 0 }. DELETE /api/v1/posts/:id and DELETE /api/v1/spaces/:space/threads/:slug take no body. Unknown fields are ignored; refusals are problem+json (post.empty, post.too_long, thread.invalid_title, vote.invalid, thread.locked, vip.members_only, …).

Fields

This schema has no named fields.

Examples

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

Valid: new-thread
{
  "title": "Restreaming to three platforms at once",
  "body": "What bitrates do you use?",
  "category": "help",
  "pastes": [
    "k3JfQ2"
  ]
}
Valid: reply
{
  "body_markdown": "6000 kbps works for me",
  "attachments": [
    "med_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  ]
}
Valid: vote
{
  "value": -1
}
Rejected: bad-attachment
{
  "body": "x",
  "attachments": [
    "med_1",
    "med_2"
  ]
}
Rejected: bad-vote
{
  "value": 2
}

Validate

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