1.5.0 • Published 3 years ago

@schema-kit/common v1.5.0

Weekly downloads
53
License
MIT
Repository
-
Last release
3 years ago

Common types for Schema Kit

Usage

import {
  boolean,
  integer,
  buildNull,
  number,
  object,
  optional,
  string,
} from "@schema-kit/common"

A description of each type can be found on the wiki.

Common options

  • title: Optional.
  • description: Optional.

never(opts)

Creates a never node.

any(opts)

Creates an any node.

buildConst(value, opts)

Creates a const node.

Parameters:

  • value: A constant value.

buildNull(opts)

Creates a null node.

boolean(opts)

Creates a boolean node.

integer(opts)

Creates an integer node.

number(opts)

Creates a number node.

object(properties, opts)

Creates an object node.

Parameters:

  • properties: A key-value object containing string keys and their corresponding schema nodes.

optional(child, opts)

Creates an optional node.

Parameters:

  • child: The child schema node. The child node cannot be another optional node.

array(child, opts)

Creates an array node.

Parameters:

  • child: The child schema node.

union(children, opts)

Creates a union node.

Parameters:

  • children: An array of the children schema nodes.