A JavaScript library for building JSON Schema objects using a functional DSL. v1.0.0 (stable, no recent updates). Provides functions to define schema properties, types, arrays, enums, definitions, and $refs in a composable way. Supports Draft-06 and Draft-07. Differentiators: programmatic schema construction with nested object syntax, built-in type helpers, and definition management. Lightweight, no runtime dependencies.
npm install functional-json-schemaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage of `schema` and `types.type` to build a JSON Schema object in CommonJS style.
Use `import * as schema from 'functional-json-schema'` instead of `import schema from 'functional-json-schema'`.
Use `{ schema: 'http://json-schema.org/draft-07/schema#' }` option if upgrading to Draft-07.Always provide a type or definition to `arrayOf`, e.g., `types.arrayOf(types.type('string'))`.Ensure second argument is an object like `{ User: { ... } }` or `null` if no definitions.Use `import * as schema from 'functional-json-schema'` or `const schema = require('functional-json-schema')`.Check supported types: 'string', 'number', 'boolean', 'object', 'array', 'null'.
Pass definitions object as second argument to `schema()`: `schema(properties, { User: {...} })`.No dependency data recorded yet.