Skip to content

Latest commit

 

History

History
46 lines (29 loc) · 2.05 KB

README.md

File metadata and controls

46 lines (29 loc) · 2.05 KB

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