Files
factorio-clusterio/packages/lib/schema.js
T
Hornwitser 2de029b96e Fix strict mode warnings from Ajv
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.
2023-07-27 00:35:26 +02:00

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),
};