#json-schema #document #json-parser #tries #tool #derive #schema2000

app schema2000-cli

Schema2000 is a tool that parses exsiting JSON documents and tries to derive a JSON schema from these documents

1 unstable release

0.1.0 Dec 16, 2021

#17 in #tries

MIT/Apache

33KB
941 lines

Schema 2000

Rust crates.io schema2000 crates.io schema2000-cli docs.rs schema2000

Schema2000 is a tool that parses exsiting JSON documents and tries to derive a JSON schema from these documents.

Currently, Schema2000 is configuration-less command line tool that excepts line-separated JSON documents from stdin and emits the derived schema to stdout once the input is consumed.

How to install

Download the latest binaries for your operating system, and add them to your $PATH and make them executable.

macOS specific installation

macOS will not open the app as the developer can not be verified. As a work-around, open the folder containing schema2000_macOS in Finder, "ctrl-click" on schema2000_macOS and click on the menu item "open". You can then confirm to open the app. This will open a terminal app session, which you can simply close.

Usage

Consume a file with line separated JSON documents:

$ cat line_separated.json | schema2000

Consume via MQTT (using Eclipse Mosquitto):

$ mosquitto_sub -t homeassistant/event | schema2000

Consume from Kafka (using kcat):

$ kcat -b $KAFKA_BROKER_ADDRESS_LIST -t your_topic | schema2000

Verify schemas

You may use any JSON schema validator to validate the input documents with the derived schema. This example uses yajsv:

yajsv -s schema.json line_separated.json

Dependencies

~0.7–1.2MB
~23K SLoC