mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
Add type object to schemas specifying properties and minItems to schemas specifying tuples. Disable strictTuples because it's desirable to be able to add additional items to the tuples in the future.
23 lines
461 B
JavaScript
23 lines
461 B
JavaScript
/**
|
|
* JSON schemas used for validating link messages
|
|
* @module lib/schema
|
|
*/
|
|
"use strict";
|
|
const Ajv = require("ajv");
|
|
const ajv = new Ajv({
|
|
allowUnionTypes: true,
|
|
strict: "log",
|
|
strictTuples: false,
|
|
verbose: true,
|
|
});
|
|
|
|
module.exports = {
|
|
/**
|
|
* Compile JSON schema into validator
|
|
* @function
|
|
* @param {Object} schema - JSON schema to create validator for.
|
|
* @returns {Function} Validator for the schema.
|
|
*/
|
|
compile: ajv.compile.bind(ajv),
|
|
};
|