🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@doubter/json-schema

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@doubter/json-schema

Converts Doubter shapes from and to JSON schemas.

0.0.1
Source
npm
Version published
Weekly downloads
10
-9.09%
Maintainers
1
Weekly downloads
 
Created
Source

Doubter × JSON Schema build

Converts Doubter shapes from and to JSON schemas.

Warning This project is at the early development stage.

npm install --save-prod @doubter/json-schema

Define a shape:

import * as d from 'doubter';

const shape = d.object({
  foo: d.string().optional(),
  bar: d.number().gt(10)
});
// ⮕ Shape<{ foo: string | undefined, bar: number }>

const schema = toJSONSchema(shape);

The schema is a JSON schema object:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "foo": {
      "oneOf": [
        { "type": "null" },
        { "type": "string" }
      ]
    },
    "bar": {
      "type": "number",
      "exclusiveMinimum": 10
    }
  },
  "required": ["bar"]
}

Keywords

doubter

FAQs

Package last updated on 23 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts