DealsProductResolveRequest deals.product-resolve-request@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/product-resolve-request.v1.json

deals.product-resolve-request@1: the body of POST /api/v1/products/resolve on OpenVibe.Deals (deals.product.resolve): product aliases (gtin 8-14 digits, mpn, sku, url, name) to find the product by; with create (default true) a product is made when none matches (name then required, 2-200 characters).

Fields

FieldTypeRequiredDescriptionConstraints
namestring
brandstring | null
gtinstring
  • pattern ^[0-9]{8,14}$
mpnstring
skustring
urlstring
categorystring | null
descriptionstring | null
createboolean

Examples

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

Valid: gtin
{
  "name": "Example 4K Capture",
  "brand": "Example",
  "gtin": "0123456789012"
}
Rejected: bad-gtin
{
  "gtin": "12AB"
}

Validate

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