# jsg07

> JSON Schema Generator with draft 07 support

Latest version **1.0.4** (published 2020-08-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install jsg07
pnpm add jsg07
yarn add jsg07
bun add jsg07
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2020-08-03 |
| First published | 2018-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 29.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | pearl |
| Maintainers | harttle |

## Links

- npm: https://www.npmjs.com/package/jsg07
- Repository: https://github.com/harttle/json-schema-generator
- Homepage: https://github.com/harttle/json-schema-generator#readme
- Issues: https://github.com/harttle/json-schema-generator/issues
- npm.io page: https://npm.io/package/jsg07

## Recent versions

- 1.0.4 (latest) — 2020-08-03
- 1.0.3 — 2020-06-22
- 1.0.1 — 2018-11-15

## README

# JSON Schema Generator

[![Build Status](https://travis-ci.com/harttle/json-schema-generator.svg?branch=master)](https://travis-ci.com/harttle/json-schema-generator)
[![Coverage Status](https://coveralls.io/repos/github/harttle/json-schema-generator/badge.svg?branch=master)](https://coveralls.io/github/harttle/json-schema-generator?branch=master)

Spec: http://json-schema.org/latest/json-schema-validation.html

## Install

```bash
npm install --save jsg07
```

## Usage

```javascript
const jsg = require('jsg07');

let schema = jsg.infer({
    name: 'Mike',
    male: true,
    tags: ['Gentle', 'Nice']
});
console.log(JSON.stringify(schema, null, 4));
```

## Output

```
{
    "title": "An object value",
    "required": [
        "name",
        "male",
        "tags"
    ],
    "properties": {
        "name": {
            "title": "A string value",
            "default": "",
            "pattern": "^(.*)$",
            "examples": [
                "Mike"
            ],
            "$id": "#/properties/name",
            "type": "string"
        },
        "male": {
            "title": "A boolean value",
            "default": false,
            "examples": [
                true
            ],
            "$id": "#/properties/male",
            "type": "boolean"
        },
        "tags": {
            "title": "An array of items",
            "items": {
                "title": "A string value",
                "default": "",
                "pattern": "^(.*)$",
                "examples": [
                    "Gentle"
                ],
                "$id": "#/properties/tags/items",
                "type": "string"
            },
            "$id": "#/properties/tags",
            "type": "array"
        }
    },
    "$id": "http://example.org/root.json#",
    "type": "object",
    "definitions": {},
    "$schema": "http://json-schema.org/draft-07/schema#"
}
```

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