ChatiumFor developersPlaygroundPricing
Sign in

Heap.NonEmptyString

Declares a string field that cannot be an empty string or consist solely of whitespace characters.

Usage / Signature

import { Heap } from '@app/heap'
Heap.NonEmptyString(options)

Arguments

  • <b id="options">options</b>: {default, maxLength}
    An object with additional optional parameters for the field.

    • <b id="default">default</b>: string
      The default value for this field. For more information on how default values work, see Guide / Heap / Default Values

    • <b id="maxLength">maxLength</b>: number
      The maximum length of the string.

Return Value

A JSON schema for a string field.

Examples

Non-empty string with a maximum length of 20 characters
const products = Heap.Table('products', {
  shortName: Heap.NonEmptyString({ maxLength: 20 }),
})