# @http2/configuration ⚙️

These are the schemas for [@http2/server](https://www.npmjs.com/package/@http2/server) configuration files. They are shared between various related projects. This package acts as the versioned reference.

## `ConfigurationValidator` Class

Instance of the `Validator` class from [`jsonschema`](https://github.com/tdegrunt/jsonschema). Restricted to custom schemas and formats.

```js
const {ConfigurationValidator} = require('@http2/configuration')

const validator = new ConfigurationValidator()

const configuration = {
  hosts: [
    {
      domain: 'http2.live',
      root: 'public'
    }
  ]
}

// Throws the first encountered error if the configuration syntax is invalid,
// otherwise returns `true`.
validator.validate(configuration)
```

## JSON Schemas

### `options`

The overall options schema defines the main structure of a configuration file.

```js
const optionsSchema = require('@http2/configuration/schema/options')
```

### `host`

The schema specifically for validating a `host` section of the configuration.

```js
const hostSchema = require('@http2/configuration/schema/host')
```

### `manifest`

The HTTP/2 Server Push Manifest schema is available in [@http2/manifest](https://www.npmjs.com/package/@http2/manifest) and used to validate the `manifest` property of a host.

```js
const {schema: manifestSchema} = require('@http2/manifest')
```
