Skip to content
forked from zmap/zschema

A schema language for JSON documents that allows validation and compilation into various database engines

Notifications You must be signed in to change notification settings

becgabri/zschema

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://secure.travis-ci.org/zmap/zschema.svg?branch=master

ZSchema

ZSchema is a generic (meta-)schema language for defining database schemas that facilitates (1) validating JSON documents against a schema definition and (2) compilation into multiple database engines. For example, if you wanted to maintain a single database schema for both MongoDB and ElasticSearch. Properties can also be documented inline and documentation compiled to HTML or a console-friendly text document.

Currently, a schema is defined natively in Python. Example:

Record({
    "name":String(required=True),
    "addresses":ListOf(SubRecord({
        "street":String(),
        "zipcode":String()
    }),
    "area_code":Integer()
})

Command Line Interface

zschema [command] [schema] [file]

Commands:

  • elasticsearch (compile to Elastic Search)
  • bigquery (compile to Google BigQuery)
  • json (compile documentation to JSON)
  • text (compile documentation to plain text)
  • html (compile documentation to HTML)
  • validate (validate JSON file (one document per line) against schema)

The schema file can be defined on the command line as module:var.

Running Tests

Tests are run with nose. Run them via python setup.py test.

About

A schema language for JSON documents that allows validation and compilation into various database engines

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%