HostSiteConfigRequest host.site-config-request@1

Generated at from openvibe-contracts v0.84.0 and openvibe-sdk v0.26.0.

Version
1.0.0
Owner
host
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/host/site-config-request.v1.json

host.site-config-request@1: the body of PUT /api/v1/sites/:id/config on OpenVibe.Host (host.site.config; the acting principal must be a maintainer or owner of the site's project). { headers?, redirects?, spa? } replaces the whole configuration: a field left out is reset to its default. A redirect's status defaults to 301. Refusals are 422 problem+json: site_config.reserved_header, site_config.header_name, site_config.header_value (longer than 1024 characters or a control character), site_config.too_many (over 50 headers or 200 redirects), site_config.redirect (not a local path, a duplicate from, or a status outside 301/302/307/308), site_config.headers and site_config.redirects (wrong type). GET and DELETE /api/v1/sites/:id/config take no body (DELETE resets to the defaults).

Fields

FieldTypeRequiredDescriptionConstraints
headersobject
redirectsarray of object
  • items: no other fields
redirects[].fromstringyes
redirects[].tostringyes
redirects[].statusenum
  • one of 301, 302, 307, 308
spaboolean

Examples

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

Valid: full
{
  "headers": {
    "X-Frame-Options": "SAMEORIGIN"
  },
  "redirects": [
    {
      "from": "/docs",
      "to": "/docs/"
    }
  ],
  "spa": true
}
Valid: reset
{}
Rejected: bad-status
{
  "redirects": [
    {
      "from": "/a",
      "to": "/b",
      "status": 303
    }
  ]
}

Validate

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