# json-schema-strictly-typed

> [![CircleCI](https://circleci.com/gh/unmock/json-schema-fast-check.svg?style=svg)](https://circleci.com/gh/unmock/json-schema-fast-check) [![codecov](https://codecov.io/gh/unmock/json-schema-fast-check/branch/master/graph/badge.svg)](https://codecov.io/g

Latest version **0.0.14** (published 2019-09-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install json-schema-strictly-typed
pnpm add json-schema-strictly-typed
yarn add json-schema-strictly-typed
bun add json-schema-strictly-typed
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.14 |
| Published | 2019-09-06 |
| First published | 2019-09-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 346.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | meeshkan |

## Links

- npm: https://www.npmjs.com/package/json-schema-strictly-typed
- npm.io page: https://npm.io/package/json-schema-strictly-typed

## Dependencies (1)

- [io-ts](https://npm.io/package/io-ts.md) ^2.0.1

## Recent versions

- 0.0.14 (latest) — 2019-09-06
- 0.0.13 — 2019-09-06
- 0.0.12 — 2019-09-05
- 0.0.11 — 2019-09-04
- 0.0.10 — 2019-09-03
- 0.0.9 — 2019-09-03
- 0.0.8 — 2019-09-03
- 0.0.7 — 2019-09-03
- 0.0.6 — 2019-09-03
- 0.0.5 — 2019-09-03
- 0.0.4 — 2019-09-01
- 0.0.3 — 2019-09-01
- 0.0.2 — 2019-09-01
- 0.0.1 — 2019-09-01
- 0.0.0 — 2019-09-01

## README

[![CircleCI](https://circleci.com/gh/unmock/json-schema-fast-check.svg?style=svg)](https://circleci.com/gh/unmock/json-schema-fast-check)
[![codecov](https://codecov.io/gh/unmock/json-schema-fast-check/branch/master/graph/badge.svg)](https://codecov.io/gh/unmock/json-schema-fast-check)

# json-schema-strictly-typed

[JSON Schema](https://json-schema.org) 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-typed` implements a strict flavor of the JSON Schema 7 specification for typing. By strict, we mean that it is organized into logical types that represent real usage, disallowing certain "nonsense" combinations of fields.

## Example

```typescript
import { JSSTInteger } from "json-schema-strictly-typed";

test("my schema is an integer", () => {
    JSSTInteger.is({ type: "integer" });
});
```

## API

Here are all of the types in the API.  Some of them also have sub-types for useful validation. In addition to canonical JSON Schema 6, we have added an optional `faker` field to the `string` type to use faker-like packages.

* `JSSTEmpty`
* `JSSTConst`
* `JSSTRefer`ence
* `JSSTNull`
* `JSSTBoolean`
* `JSSTInteger`
  * `JSSTSimpleInteger`
  * `JSSTIntegerWithMinimum`
  * `JSSTIntegerWithMaximum`
  * `JSSTIntegerWithBounds`
  * `JSSTIntegerWithNumericExclusiveBounds`
  * `JSSTIntegerWithNumericExclusiveMaximum`
  * `JSSTIntegerWithNumericExclusiveMinimum`
  * `JSSTIntegerEnum`
* `JSSTNumber`
  * `JSSTSimpleNumber`
  * `JSSTNumberEnum`
* `JSSTString`
  * `JSSTSimpleString`
  * `JSSTRegex`
  * `JSSTStringEnum`
* `JSSTArray`
  * `JSSTList`
  * `JSSTTuple`
* `JSSTObject`
* `JSSTOneOf`
* `JSSTAnyOf`
* `JSSTAllOf`
* `JSSTNot`

Additionally, top-level versions of all of these are available by adding `TopLevel` to the definition. Top-level JSON Schema objects contain optional fields like `$id`, `$schema` and `definitions`.

## Todo

There is plenty of stuff that is not implemented yet.  I'd really appreciate your help!

* finish implementing the JSON Schema 7 Specification
* add various schema extensions
* use XOR combinator instead of `|` for types to avoid nonsense unoins

---
_Source: https://npm.io/package/json-schema-strictly-typed · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
