Skip to content

@camera.ui/sdk / plugin / getContractValidationErrors

Function: getContractValidationErrors() ​

getContractValidationErrors(contract): string[]

Defined in: plugin/helper.ts:23

Check the structural validity of an unknown contract object: required fields present, enum values inside the accepted sets. Returns one human-readable error per problem found, empty when the contract is valid.

Parameters ​

contract ​

unknown

Untrusted candidate contract (e.g. from manifest JSON).

Returns ​

string[]

Error messages, empty if the contract is valid.

Example ​

ts
import { getContractValidationErrors } from '@camera.ui/sdk';

const errors = getContractValidationErrors(rawManifest);
if (errors.length) throw new Error(errors.join('\n'));