open-index/open-npm huggingface dataset:
npm package: @json-schema-tools/dereferencer
Description: Dereference (aka parse refs) from JSON Schemas
Author: BelfordZ
Latest version: 1.6.3

# JSON Schema Dereferencer

<center>
  <span>
    <img alt="CircleCI branch" src="https://img.shields.io/circleci/project/github/json-schema-tools/dereferencer/master.svg">
    <img src="https://codecov.io/gh/json-schema-tools/dereferencer/branch/master/graph/badge.svg" />
    <img alt="npm" src="https://img.shields.io/npm/dt/@json-schema-tools/dereferencer.svg" />
    <img alt="GitHub release" src="https://img.shields.io/github/release/json-schema-tools/dereferencer.svg" />
    <img alt="GitHub commits since latest release" src="https://img.shields.io/github/commits-since/json-schema-tools/dereferencer/latest.svg" />
  </span>
</center>

Otherwise known as a ref parser, this tool will replace json schema using $ref with the underlying reference, returning relevant errors otherwise.

Built using @json-schema-tools/traverse

## features

- minimal dependencies
- simple & fast
- cycle detection/handling
- switchable recusive dereferencing
- works in node & in browser (isomorphic)
- handles:
  - relative pointer refs
  - http/https uris
  - local filesystem references
- configurable
 - optionally de-reference internal references only, keeping it synchronous
 - ignore refs that match a set of patterns
- extensible
  - dependency injectable fetch and filesystem
  - middleware allows you to easily implement new $ref values.
  - easily add behaviors for custom reference locations
- option for mutating in place or returning a copy

## Getting Started

`npm install @json-schema-tools/dereferencer`

```typescript
const JsonSchemaDereferencer = require("@json-schema-tools/dereferencer").default;

const mySchema = {
    type: "object",
    properties: {
      foo: { anyOf: [
        { $ref: "#/properties/bar" },
        { type: "string" }
      ]},
      bar: { $ref: "#/properties/foo" },
      baz: { $ref: "../myschemas/baz.json" },
      jsonSchemaMetaSchema: { $ref: "https://meta.json-schema.tools" }
    },
    additionalProperties: {
        type: "array",
        items: [
            { type: "array", items: { $ref: "#" } },
            { type: "boolean" }
        ]
    }
};

const dereferencer = new JsonSchemaDereferencer(mySchema);

console.log(dereferencer.resolveSync());
console.log(await dereferencer.resolve());
```


### Add custom protocol handling

```typescript
import JsonSchemaDereferencer from "@json-schema-tools/dereferencer";

const mySchema = {
    type: "object",
    properties: {
      foo: { $ref: "ipfs://39420398420384" }
    }
};

const dereferencer = new JsonSchemaDereferencer(mySchema, {
  protocolHandlerMap: {
    "ipfs": (ref) => Promise.resolve({ type: "string", title: "pretend we got this from ipfs" })
});

console.log(dereferencer.resolveSync());
console.log(await dereferencer.resolve());
```


### Contributing

How to contribute, build and release are outlined in [CONTRIBUTING.md](CONTRIBUTING.md), [BUILDING.md](BUILDING.md) and [RELEASING.md](RELEASING.md) respectively. Commits in this repository follow the [CONVENTIONAL_COMMITS.md](CONVENTIONAL_COMMITS.md) specification.
npm package: @json-schema-tools/meta-schema
Description: JSON Schema Meta Schema & Generated types for typescript, rust, golang and python
Author: Zachary Belford
Latest version: 1.8.0

# JSON Schema Meta Schema

This repo contains the json schema meta schema and code to package it on npm, generate typings, etc.

## Installing

### Typescript

`npm install --save @json-schema-tools/meta-schema`

### Golang

`go get github.com/json-schema-tools/meta-schema`


### Rust

`cargo install json_schema`

## Using

### Typescript
```typescript
import JSONSchema, { JSONSchemaObject, Properties, Items } from "@json-schema-tools/meta-schema"
```

### Rust

#### From a string
```rust
let foo = r#"{
    "title": "helloworld",
    "type": "string"
}"#;

let as_json_schema: JSONSchemaObject = serde_json::from_str(foo).unwrap();
```

#### Using builder pattern
```rust
let schema = JSONSchemaObjectBuilder::default()
    .title("foobar".to_string())
    ._type(Type::SimpleTypes(SimpleTypes::String))
    .build()
    .unwrap();

let as_str = serde_json::to_string(&schema).unwrap();
```

### Contributing

How to contribute, build and release are outlined in [CONTRIBUTING.md](CONTRIBUTING.md), [BUILDING.md](BUILDING.md) and [RELEASING.md](RELEASING.md) respectively. Commits in this repository follow the [CONVENTIONAL_COMMITS.md](CONVENTIONAL_COMMITS.md) specification.
npm package: @json-schema-tools/reference-resolver
Description: Turns a $ref into a JSONSchema
Author: BelfordZ
Latest version: 1.2.6

# JSON Schema Reference Resolver

<center>
  <span>
    <img alt="CircleCI branch" src="https://img.shields.io/circleci/project/github/json-schema-tools/reference-resolver/master.svg">
    <img src="https://codecov.io/gh/json-schema-tools/reference-resolver/branch/master/graph/badge.svg" />
    <img alt="npm" src="https://img.shields.io/npm/dt/@json-schema-tools/reference-resolver.svg" />
    <img alt="GitHub release" src="https://img.shields.io/github/release/json-schema-tools/reference-resolver.svg" />
    <img alt="GitHub commits since latest release" src="https://img.shields.io/github/commits-since/json-schema-tools/reference-resolver/latest.svg" />
  </span>
</center>

Takes a $ref string and a root object, and returns the referenced value.

Works in browser & in node (file system refs ignored in browser).

Easily add support for your own protocols.

## Getting Started

`npm install @json-schema-tools/reference-resolver`

```typescript
import refRes from "@json-schema-tools/reference-resolver";

refRes.resolve("#/properties/foo", { properties: { foo: true } }); // returns true
refRes.resolve("https://foo.com/"); // returns what ever json foo.com returns
refRef.resolve("../my-object.json"); // you get teh idea
```

## Adding custom protocol handlers

```typescript
import referenceResolver from "@json-schema-tools/reference-resolver";
import JSONSchema from "@json-schema-tools/meta-schema";

referenceResolver.protocolHandlerMap.ipfs = (uri) => {
   const pretendItsFetchedFromIpfs = {
     title: "foo",
     type: "string",
   } as JSONSchema;
   return Promise.resolve(fetchedFromIpfs);
};

referenceResolver.protocolHandlerMap["customprotocol"] = (uri) => {
   return Promise.resolve({
     type: "string",
     title: uri.replace("customprotocol://", ""),
   });
};

referenceResolver.resolve("ipfs://80088008800880088008");
referenceResolver.resolve("customprotocol://foobar");
```


### Contributing

How to contribute, build and release are outlined in [CONTRIBUTING.md](CONTRIBUTING.md), [BUILDING.md](BUILDING.md) and [RELEASING.md](RELEASING.md) respectively. Commits in this repository follow the [CONVENTIONAL_COMMITS.md](CONVENTIONAL_COMMITS.md) specification.
npm package: @json-schema-tools/referencer
Description: Get a copy of a JSON Schema where all subschemas are turned into `$ref`s with corresponding definitions section.
Author: BelfordZ
Latest version: 1.1.3

# JSON Schema Referencer

<center>
  <span>
    <img alt="CircleCI branch" src="https://img.shields.io/circleci/project/github/json-schema-tools/referencer/master.svg">
    <img alt="npm" src="https://img.shields.io/npm/dt/@json-schema-tools/referencer.svg" />
    <img alt="GitHub release" src="https://img.shields.io/github/release/json-schema-tools/referencer.svg" />
    <img alt="GitHub commits since latest release" src="https://img.shields.io/github/commits-since/json-schema-tools/referencer/latest.svg" />
  </span>
</center>

Referencer is a package that exports a single function - a function that accepts and returns a JSON Schema. The returned schema is 'flat', as in, any subschemas of the schema have been converted into $refs. Further, any of the subschemas' subschema are also $reffed, recurively until everything is a $ref, and the definition section is fully populated.

The input schema may have refs, but the refs must already be in the definitions section.
The input schema, as well as all of its subschemas must have titles. Their titles must also be unique for their content. We would like to use $id, but it has special meaning and therefor title is used as the unique identifier on-which schemas will be referenced.

Features:
 - Cyclic schemas become cyclic references
 - Completely synchronous
 - immutable by default, option to mutate in place.
 - No external dependencies
 - Fully typed against the generated [meta-schema typings](https://github.com/json-schema-tools/meta-schema/)
 - magically makes your json schema smaller.

## Usage

install it:
`npm install @json-schema-tools/referencer`

use it:
```typescript
import referencer from "@json-schema-tools/referencer";

const result = referencer({
  title: "example",
  type: "object",
  properties: {
    foo: { title: "foo", type: "number" },
    bar: { title: "bar", type: "string" }
  }
});

console.log(result);

// outputs
{
  title: "example",
  type: "object",
  properties: {
    foo: {$ref: "#/definitions/foo" },
    bar: { $ref: "#/definitions/bar" }
  },
  definitions: {
    foo: { title: "foo", type: "number" }
    bar: { title: "bar", type: "string" }
  }
}
```

## License

Apache-2.0


### Contributing

How to contribute, build and release are outlined in [CONTRIBUTING.md](CONTRIBUTING.md), [BUILDING.md](BUILDING.md) and [RELEASING.md](RELEASING.md) respectively. Commits in this repository follow the [CONVENTIONAL_COMMITS.md](CONVENTIONAL_COMMITS.md) specification.
npm package: @json-schema-tools/semantic-release-transpiler
Description: Semantic release plugin to generate typings using the transpiler
Author: BelfordZ
Latest version: 1.6.16

# semantic-release-transpiler
Semantic release plugin to generate typings using the transpiler


## Example:
```
{
  "tagFormat": "${version}",
  "branch": "master",
  "plugins": [
    "@semantic-release/commit-analyzer",
    ["@json-schema-tools/semantic-release-transpiler", {
      "outpath": "./",
      "schemaLocation": "./meta-schema.json",
      "languages": { "ts": true }
    }],
    "@semantic-release/release-notes-generator",
    "@semantic-release/changelog",
    "@semantic-release/github",
    "@semantic-release/git",
    "@semantic-release/npm"
  ],
  "verifyConditions": [
    ["@json-schema-tools/semantic-release-transpiler", {
      "outpath": "./",
      "schemaLocation": "./meta-schema.json",
      "languages": { "ts": true }
    }],
    "@semantic-release/changelog",
    "@semantic-release/npm",
    "@semantic-release/git",
    "@semantic-release/github"
  ],
  "prepare": [
    ["@json-schema-tools/semantic-release-transpiler", {
      "outpath": "./",
      "schemaLocation": "./meta-schema.json",
      "languages": { "ts": true }
    }],
    "@semantic-release/changelog"
  ],
  "publish": [
    ["@semantic-release/github", {
      "assets": [
        "build/generated-typings.js",
        "build/generated-typings.d.ts",
        "build/index.js",
        "build/index.d.ts"
      ]
    }],
    "@semantic-release/npm"
  ],
  "success": [
    "@semantic-release/github"
  ],
  "fail": [
    "@semantic-release/github"
  ]
}
```
npm package: @json-schema-tools/titleizer
Description: Generate deterministic titles for json schemas (AKA ensureAllSchemasHaveTitles)
Author: BelfordZ
Latest version: 1.0.9

# JSON Schema Titleizer

<center>
  <span>
    <img alt="CircleCI branch" src="https://img.shields.io/circleci/project/github/json-schema-tools/titleizer/master.svg">
    <img src="https://codecov.io/gh/json-schema-tools/titleizer/branch/master/graph/badge.svg" />
    <img alt="Dependabot status" src="https://api.dependabot.com/badges/status?host=github&repo=json-schema-tools/titleizer" />
    <img alt="npm" src="https://img.shields.io/npm/dt/@json-schema-tools/titleizer.svg" />
    <img alt="GitHub release" src="https://img.shields.io/github/release/json-schema-tools/titleizer.svg" />
    <img alt="GitHub commits since latest release" src="https://img.shields.io/github/commits-since/json-schema-tools/titleizer/latest.svg" />
  </span>
</center>

A tool to ensure that a schema and all its subschemas have a title. If there is no title present, one will be deterministically generated based on the schemas contents.

## Features

 - circular reference detection & handling
 - synchronous - doesn't touch the filesystem or make network requests. (use @json-schema-tools/dereferencer first if you have references)
 - generate subschema-dependent titles
 - always have unique titles for your json-schema

## Getting Started

```sh
npm install @json-schema-tools/titleizer
```

```js
const titleizer = require("@json-schema-tools/titleizer").default;
//import titleizer from "@json-schema-tools/titleizer"

const mySchema = {
  type: "object",
  properties: {
    foo: {
      title: "foo",
      type: "array",
      items: { type: "string" }
    },
    bar: {
      title: "bar",
      anyOf: [
        { type: "string" },
        { type: "number" }
      ]
    }
  }
};

console.log(JSON.stringify(titleizer(mySchema), undefined, "  "));
```
Output from running the above:
```
{
  "type": "object",
  "properties": {
    "foo": {
      "title": "foo",
      "type": "array",
      "items": {
        "type": "string",
        "title": "string_doaGddGA"
      }
    },
    "bar": {
      "title": "bar",
      "anyOf": [
        {
          "type": "string",
          "title": "string_doaGddGA"
        },
        {
          "type": "number",
          "title": "number_Ho1clIqD"
        }
      ]
    }
  },
  "title": "objectOf_foo_bar_Bd1o3wyq"
}
```

### Contributing

How to contribute, build and release are outlined in [CONTRIBUTING.md](CONTRIBUTING.md), [BUILDING.md](BUILDING.md) and [RELEASING.md](RELEASING.md) respectively. Commits in this repository follow the [CONVENTIONAL_COMMITS.md](CONVENTIONAL_COMMITS.md) specification.
npm package: @json-schema-tools/transpiler
Description: Turn your json schema into typings for various languages. Achieve master class dev tooling.
Author: Zachary Belford
Latest version: 1.10.5

# JSON Schema Transpiler

<center>
  <span>
    <img alt="CircleCI branch" src="https://img.shields.io/circleci/project/github/json-schema-tools/transpiler/master.svg">
    <img src="https://codecov.io/gh/json-schema-tools/transpiler/branch/master/graph/badge.svg" />
    <img alt="npm" src="https://img.shields.io/npm/dt/@json-schema-tools/transpiler.svg" />
    <img alt="GitHub release" src="https://img.shields.io/github/release/json-schema-tools/transpiler.svg" />
    <img alt="GitHub commits since latest release" src="https://img.shields.io/github/commits-since/json-schema-tools/transpiler/latest.svg" />
  </span>
</center>

Turn your JSON Schemas into types to be used in various languages.

[Try Me](https://json-schema.tools/)

- Generate types for:
  - Golang
  - Typescript
  - Rust
  - Python
- handles cycle detection
- automatically determines references
- includes documentation annotations for easy documentation generation with native language tools.
- minimal dependencies (wip)
- Creates 1 type alias per 1 schema
- Autogenerated deterministic titles where missing
- Autoreferencer (removes duplication)
- Code is synchronous - no IO keeps it lean and fast
- [Convert schema to types in browser too!](https://json-schema.tools)

## Getting Started

`npm install @json-schema-tools/transpiler`

```typescript
const JsonSchemaTranspiler = require("@json-schema-tools/transpiler").default;

const mySchema = {
  "title": "PlowAnimals",
  "description": "an array of animals that are good at pulling things",
  "type": "array",
  "items": {
    "oneOf": [
      { "title": "Horse" },
      { "title": "Donkey" },
      { "title": "Elephant" },
    ]
  }
};

const transpiler = new JsonSchemaTranspiler(mySchema);

console.log(transpiler.toTypescript());
console.log(transpiler.toRust());
console.log(transpiler.to("go")); // same thing, different form/interface
console.log(transpiler.to("python")); // works with shorthand of the language aswell (py or python)
```

## Testing

### Generate a test case

`npm run generateTest`

outputs:

```
> @json-schema-tools/transpiler@0.0.0-development generateTest /Users/zb/Code/json-schema-tools/transpiler
> tsc && node ./build/integration-tests/generator.js

? What is the name of the test schema? type-as-array
? Enter a url to a JSON Schema, or press enter to get an empty one? false
Detecting languages...
Found 4 languages: go, py, rs, ts


Writing files...
All done
```

Edit schema if necessary, and run `npm test`. Update expected results as needed.

### Contributing

How to contribute, build and release are outlined in [CONTRIBUTING.md](CONTRIBUTING.md), [BUILDING.md](BUILDING.md) and [RELEASING.md](RELEASING.md) respectively. Commits in this repository follow the [CONVENTIONAL_COMMITS.md](CONVENTIONAL_COMMITS.md) specification.
npm package: @json-schema-tools/traverse
Description: This package exports a method that will traverse a JSON-Schema, calling a mutation function for each sub schema found. It is useful for building tools to work with JSON Schemas.
Author: Zachary Belford
Latest version: 1.11.0

# JSON Schema Traverse

<center>
  <span>
    <img alt="CircleCI branch" src="https://img.shields.io/circleci/project/github/json-schema-tools/traverse/master.svg">
    <img src="https://codecov.io/gh/json-schema-tools/traverse/branch/master/graph/badge.svg" />
    <img alt="npm" src="https://img.shields.io/npm/dt/@json-schema-tools/traverse.svg" />
    <img alt="GitHub release" src="https://img.shields.io/github/release/json-schema-tools/traverse.svg" />
    <img alt="GitHub commits since latest release" src="https://img.shields.io/github/commits-since/json-schema-tools/traverse/latest.svg" />
  </span>
</center>

This package exports a method that will traverse a JSON-Schema, calling a "mutation" function for each sub schema found. It is useful for building tools to work with JSON Schemas.

## Features

 - circular reference detection & handling
 - synchronous - doesn't touch the filesystem or make network requests.
 - easily perform schema mutations while traversing
 - optional mutability (toggle updating original schema object)
 - returns [JSONPaths](https://www.ietf.org/archive/id/draft-goessner-dispatch-jsonpath-00.html) as it traverses

## Getting Started

```sh
npm install @json-schema-tools/traverse
```

```js
const traverse = require("@json-schema-tools/traverse").default;
//import traverse from "@json-schema-tools/traverse"

const mySchema = {
  title: "baz",
  type: "object",
  properties: {
    foo: {
      title: "foo",
      type: "array",
      items: { type: "string" }
    },
    bar: {
      title: "bar",
      anyOf: [
        { title: "stringerific", type: "string" },
        { title: "numberoo", type: "number" }
      ]
    }
  }
};

traverse(mySchema, (schemaOrSubschema) => {
  console.log(schemaOrSubschema.title);
});
```

## API Docs

https://json-schema-tools.github.io/traverse/

### Contributing

How to contribute, build and release are outlined in [CONTRIBUTING.md](CONTRIBUTING.md), [BUILDING.md](BUILDING.md) and [RELEASING.md](RELEASING.md) respectively. Commits in this repository follow the [CONVENTIONAL_COMMITS.md](CONVENTIONAL_COMMITS.md) specification.
npm package: @json-schema-tools/validator
Description: JSON Schema validator. Simple, fast, handles circular references.
Author: Zachary Belford
Latest version: 1.4.0

# JSON Schema Validator

<center>
  <span>
    <img alt="CircleCI branch" src="https://img.shields.io/circleci/project/github/json-schema-tools/validator/master.svg">
    <img src="https://codecov.io/gh/json-schema-tools/validator/branch/master/graph/badge.svg" />
    <img alt="npm" src="https://img.shields.io/npm/dt/@json-schema-tools/validator.svg" />
    <img alt="GitHub release" src="https://img.shields.io/github/release/json-schema-tools/validator.svg" />
    <img alt="GitHub commits since latest release" src="https://img.shields.io/github/commits-since/json-schema-tools/validator/latest.svg" />
  </span>
</center>

This package implements a JSON Schema validator.

## Features
 - dead simple
 - faster than sonic
 - completely synchronous
 - circular reference detection & handling
 - errors if it finds any $refs - use the [dereferencer](https://github.com/json-schema-tools/dereferencer) before using the validator.
 - you get the json schema draft based on [meta-schema](https://github.com/json-schema-tools/meta-schema).

## Getting Started

```sh
npm install @json-schema-tools/validator
```

```typescript
import Validator, { ValidatorErrors, ReferenceError } from "@json-schema-tools/validator"
import { JSONSchema } from "@json-schema-tools/meta-schema";

const mySchema: JSONSchema = {
  title: "baz",
  type: "object",
  properties: {
    foo: {
      title: "foo",
      type: "array",
      items: { type: "string" }
    },
    bar: {
      title: "bar",
      anyOf: [
        { title: "stringerific", type: "string" },
        { title: "numberoo", type: "number" }
      ]
    }
  }
};

const valid = validator(mySchema, { foo: ["hello", "world" ], bar: 1 });
// true

const invalid = validator(mySchema, { foo: ["hello", "world" ], bar: true });
// invalid instanceof ValidationErrors === true
// invalid.errors is an array of the error types
```

See https://json-schema-tools.github.io/validator/ for typedocs

### Contributing

How to contribute, build and release are outlined in [CONTRIBUTING.md](CONTRIBUTING.md), [BUILDING.md](BUILDING.md) and [RELEASING.md](RELEASING.md) respectively. Commits in this repository follow the [CONVENTIONAL_COMMITS.md](CONVENTIONAL_COMMITS.md) specification.