<!-- This is generated by make-readme.py do not edit -->
# Short Schema

A proof-of-concept succinct [JSON schema](http://json-schema.org/) language. This can be used together with [genson](https://github.com/wolverdude/genson/) to quickly understand the shape of JSON data.

# Motivation

JSON is a commonly used machine-readable data format.
Placing your data in JSON makes it very easy for people to programmatically use your data.
It is, therefore, unsurprising that JSON schemas are written in JSON.

However, machine-readable is not the same as human-readable and even though JSON is more readable than XML it is not as readable as a format explicitly designed to be read by a human.

# Purpose of this tool

At present this tool takes JSON schemas in JSON and outputs the same schema in our more human-readable standard.

This can be used together with tools that create JSON schema from sample data to quickly understand the format of json data.


# Caveats

- There is at present no parser for this schema language: only a way of producing this schema from JSON schemas.
- There may well not support all features of JSON schema only those aspects.

The issue of standardisation can provoke strong opinions. Creating new formats and languages results in people having to understand new things and may require more tooling. The main focus of this tool at present is the *understanding of data formats* rather than the sharing of these formats.

# Installing

```
pip install git+https://github.com/talwrii/short_schema#egg=short_schema
```

# Examples / Cheat sheet

```bash
$ echo '{"one": 1}' | genson  | short_schema
{
    one: integer
}
$ echo '[{"one": 1, "two": [1]}, {"one": 2}]' | genson  | short_schema
[
    {
        one: integer,
        ?two: [integer]
    }
]

```

# Usage

```
usage: short_schema [-h] [--debug] [--one-line]

A succinct language for json schema

optional arguments:
  -h, --help      show this help message and exit
  --debug         Print debug output
  --one-line, -1  Put all the output on one line

```

# Alternatives and prior work

Other tools approach this problem from the point of view of generating JSON schemas:

 * https://github.com/zweifisch/yaddle-py
 * https://github.com/zweifisch/kontur

This tool very much extends the work of [genson](https://github.com/wolverdude/genson/) and was created in the context of using this tool.


# Development

There are [tests](tests.py).

These can be run against [various versions of python](tox.ini) with tox using: `python setup.py test`. This is considered the canonical acceptance test for this project.
