DealsVoteResult deals.vote-result@1
Generated at from
openvibe-contracts v0.53.0 and
openvibe-sdk v0.11.0.
- Version
- 1.0.0
- Owner
- deals
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/deals/vote-result.v1.json
deals.vote-result@1: the answer of PUT and DELETE /api/v1/offers/:id/vote on OpenVibe.Deals: { offer_id, value (0 after a removal), previous, changed, votes } — the vote lands on the canonical offer of a merge group.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
offer_id | string | yes | ||
value | enum | yes |
| |
previous | enum | yes |
| |
changed | boolean | yes | ||
votes | object | yes | ||
votes.up | integer | yes |
| |
votes.down | integer | yes |
| |
votes.up_weight | number | yes | ||
votes.down_weight | number | yes |
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: up
{
"offer_id": "dof_01JAB2C3D4E5F6G7H8J9K0MNPR",
"value": 1,
"previous": 0,
"changed": true,
"votes": {
"up": 13,
"down": 1,
"up_weight": 12.5,
"down_weight": 1
}
}Rejected: bad-value
{
"offer_id": "d",
"value": 5,
"previous": 0,
"changed": true,
"votes": {
"up": 0,
"down": 0,
"up_weight": 0,
"down_weight": 0
}
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('deals.vote-result@1', value); // { valid, errors: [{ path, message }] }