⚙️
@http2/configuration These are the schemas for @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
. Restricted to custom schemas and formats.
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.
const optionsSchema = require('@http2/configuration/schema/options')
host
The schema specifically for validating a host
section of the configuration.
const hostSchema = require('@http2/configuration/schema/host')
manifest
The HTTP/2 Server Push Manifest schema is available in @http2/manifest and used to validate the manifest
property of a host.
const {schema: manifestSchema} = require('@http2/manifest')