Skip to content

Commit

Permalink
docs(env): Add environment section to describe options
Browse files Browse the repository at this point in the history
  • Loading branch information
korzio committed Sep 27, 2017
1 parent a98cb5d commit 5e0e1a9
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,25 @@ This is a part of **djv** packages aimed to work with json-schema.

Any contributions are welcome. Check [contribution guide](./CONTRIBUTING.md).

**New!!!**

Since version *1.2.0* `djv` package supports `draft-06`.
The default version is still *draft-04* for the backward compatibility and due to the semantic versioning.
For `draft-06` use a *version* option in [constructor](#constructor) arguments.

```javascript
const env = new djv({ version: 'draft-06' });
```

## Table of contents <a name="content"></a>

* [djv](#title)
* [Table of contents](#content)
* [Install](#install)
* [Usage](#usage)
* [API](#api)
* [Environment](#environment)
* [addSchema](#addSchema)
* [addSchema](#addSchema)
* [validate](#validate)
* [removeSchema](#removeSchema)
Expand Down Expand Up @@ -52,8 +64,8 @@ There are 2 versions of validator
## Usage <a name="usage"></a>

```javascript
var env = new djv();
var jsonSchema = {
const env = new djv();
const jsonSchema = {
"common": {
"properties": {
"type": {
Expand All @@ -77,6 +89,19 @@ env.validate('test#/common', { type: 'custom' });

## API <a name="api"></a>

### Environment <a name="environment"></a>

To instantiate `djv` environment

```javascript
const djv = require('djv');
const env = djv({
version: 'draft-06', // use json-schema draft-06
formats: { /*...*/ }, // custom formats @see #addFormat
errorHandler: () => { /*...*/ }, // custom error handler, @see #setErrorHandler
});
```

### addSchema(name: string, schema: object?) -> resolved: object <a name="addSchema"></a>

Add a schema to a current djv environment,
Expand Down

0 comments on commit 5e0e1a9

Please sign in to comment.