Skip to content

Reference

Validation utils

Validate OCF entity data before batch submission or ledger commands.

Helpers for validating OCF data before it reaches the ledger. All throw OcpValidationError with a dotted fieldPath on failure.


Entity validators

entityValidators — high-level validators for complete OCF objects.

import { entityValidators } from '@open-captable-protocol/canton';

Walk entire OCF entity shapes and throw on invalid fields (emails, phones, addresses, monetary values, names, security IDs, transaction base fields, etc.).

Key exports: validateIssuerData, validateStakeholderData, validateStockClassData, validateIssuanceData, validateValuationData, validateDocumentData


Validation primitives

validation — low-level field-level guards.

import { validateRequiredString, validateEnum, validateContractId } from '@open-captable-protocol/canton';

Key exports: validateRequiredString, validateEnum, validateContractId, validatePartyId, validatePositiveNumeric, validateArray, validateObject, createValidator


OCF Zod schemas

ocfZodSchemas — runtime parse helpers backed by the OCF JSON schema.

import { parseOcfObject, getOcfSchema } from '@open-captable-protocol/canton';

Use for validating unknown/external JSON before passing it into batch operations.

Key exports: getOcfSchema, parseOcfObject, parseOcfEntityInput, OCF_OBJECT_SCHEMA_PATHS, resolveOcfSchemaDir


Source