# Appsemble Schemas

> JSON schemas used by Appsemble.

These schemas follow the [Swagger specification][swagger specification].


## Installation

> **Note**: As long as this package hasn't been published, it should be installed directly from the Git repository.


### JavaScript (npm)

```
npm install --save @appsemble/schemas
```


### Python

Test cases for this package depend on unicode support in YAML. In order to support this, `pyyaml` must be built with `libyaml-dev` installed.

```
sudo apt-get install libyaml-dev
pip install appsemble-schemas
```


## Usage

### JavaScript (webpack)

Add the following section to your wepback configuration:

```javascript
module: {
  rules: [
    {
      test: /\.yaml$/,
      use: [
        {loader: 'json-loader'},
        {loader: 'yaml-loader'},
      ],
    },
  ],
},
```

Then simply import the schema:

```javascript
import createValidator from '@appsemble/schemas';
import appSchema from '@appsemble/schemas/appsemble/schemas/app.yaml'


const validator = createValidator(appSchema);
```


### Python

```python
import jsonschema
from appsemble import schemas


app_schema = schemas.get('app')
validator = jsonschema.Draft4Validator(app_schema)
```


[swagger specification]: http://swagger.io/specification/
