ajv-json-logic
Version:
JSON Logic integration for Ajv validator
91 lines (87 loc) • 1.59 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var $schema = "http://json-schema.org/draft-07/schema#";
var $id = "http://jsonlogic.com/schemas/operators/logic/if.json";
var title = "if";
var description = "The if statement typically takes 3 arguments: a condition (if), what to do if it’s true (then), and what to do if it’s false (else), like: {\"if\" : [ true, \"yes\", \"no\" ]}.\nIf can also take more than 3 arguments, and will pair up arguments like if/then elseif/then elseif/then else.";
var oneOf = [
{
type: "object",
additionalProperties: false,
required: [
"if"
],
properties: {
"if": {
$ref: "http://jsonlogic.com/schemas/common/one-or-more-args.json"
}
}
},
{
type: "object",
additionalProperties: false,
required: [
"?:"
],
properties: {
"?:": {
$ref: "http://jsonlogic.com/schemas/common/one-or-more-args.json"
}
}
}
];
var examples = [
{
"if": [
true,
"yes",
"no"
]
},
{
"if": [
false,
"yes",
"no"
]
},
{
"if": [
{
"<": [
{
"var": "temp"
},
0
]
},
"freezing",
{
"<": [
{
"var": "temp"
},
100
]
},
"liquid",
"gas"
]
}
];
var logicIf = {
$schema: $schema,
$id: $id,
title: title,
description: description,
oneOf: oneOf,
examples: examples
};
exports.$id = $id;
exports.$schema = $schema;
exports.default = logicIf;
exports.description = description;
exports.examples = examples;
exports.oneOf = oneOf;
exports.title = title;
//# sourceMappingURL=if.json.cjs.map