From d1d9f00b1bd660842addf5e6b1d1b64c852a9eea Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 5 Nov 2023 17:16:09 +0800 Subject: added hover prefixer --- node_modules/ajv-keywords/keywords/oneRequired.js | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 node_modules/ajv-keywords/keywords/oneRequired.js (limited to 'node_modules/ajv-keywords/keywords/oneRequired.js') diff --git a/node_modules/ajv-keywords/keywords/oneRequired.js b/node_modules/ajv-keywords/keywords/oneRequired.js new file mode 100644 index 00000000..5468463b --- /dev/null +++ b/node_modules/ajv-keywords/keywords/oneRequired.js @@ -0,0 +1,24 @@ +'use strict'; + +module.exports = function defFunc(ajv) { + defFunc.definition = { + type: 'object', + macro: function (schema) { + if (schema.length == 0) return true; + if (schema.length == 1) return {required: schema}; + var schemas = schema.map(function (prop) { + return {required: [prop]}; + }); + return {oneOf: schemas}; + }, + metaSchema: { + type: 'array', + items: { + type: 'string' + } + } + }; + + ajv.addKeyword('oneRequired', defFunc.definition); + return ajv; +}; -- cgit v1.2.3