<commit_before># JSON Schema Converter

A translation and validation library between [JSON Schema](http://json-schema.org/) and any other schema.

Don't get locked into your database schema forever- make sure you can always
use the latest, <del>most buggy</del> most trendy database with minimal work.

With the JSON Schema converter, you can also validate your schemas. No
matter what db client you're using, you can be confident a schema matches
what the client expects.

###Currently supported:
- [mongoose schema](http://mongoosejs.com/)

## Installation

    npm install json-schema-converter

## Usage

```coffee
json_schema = require 'json-schema-converter'
your_schema = require 'your_schema.json'

# to make sure
json_schema.is_valid your_schema

# the actual conversion
your_mongoose_schema = json_schema.to_mongoose_schema your_schema

# now instantiate
your_mongoose_object = new mongoose.Schema your_mongoose_schema<commit_msg>better showing of is_valid and validate in README<commit_after># JSON Schema Converter

A translation and validation library between [JSON Schema](http://json-schema.org/) and any other schema.

Don't get locked into your database schema forever- make sure you can always
use the latest, <del>most buggy</del> most trendy database with minimal work.

With the JSON Schema converter, you can also validate your schemas. No
matter what db client you're using, you can be confident a schema matches
what the client expects.

###Currently supported:
- [mongoose schema](http://mongoosejs.com/)

## Installation

    npm install json-schema-converter

## Usage

```coffee
{inspect} = require 'util'
json_schema = require 'json-schema-converter'
your_schema = require 'your_schema.json'

# to make sure - validate returns a structure that describes the error
unless json_schema.is_valid your_schema
  throw new Error "JSON Schema is invalid, error is: #{inspect json_schema.validate(your_schema)}"

# the actual conversion
your_mongoose_schema = json_schema.to_mongoose_schema your_schema

# now instantiate
your_mongoose_object = new mongoose.Schema your_mongoose_schema
{'fraction_non_alphanumeric': 0.07315914489311164, 'fraction_numerical': 0.0, 'mean_word_length': 5.249258160237389, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3966294', 'n_tokens_mistral': 597, 'n_tokens_neox': 586, 'n_words': 233}