Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

json-schema-poet

meeshkan425MIT0.0.9TypeScript support: included

JSON Schema is a useful way to define input and output schemas.

readme

json-schema-poet

JSON Schema is a useful way to define input and output schemas.

Typescript is a useful way to verify the types of JavaScript objects.

json-schema-strictly-poet Write JSON Schema like you'd write poetry.

Example

import * as jsp from "json-schema-poet";

test("integer yields number schema", () => {
  expect(jsp.integer()).toEqual({ type: "integer" });
});

API

Here are all of the functions in the API.

  • nul()
  • cnst()
  • integer()
  • number()
  • string()
  • stringEnum()
  • numberEnum()
  • integerEnum()
  • regex()
  • boolean()
  • array()
  • tuple()
  • allOf()
  • anyOf()
  • oneOf()
  • not()
  • dictionary()
  • type()
  • object()
  • extend()

Todo

There is plenty of stuff that is not implemented yet. I'd really appreciate your help!