ajv-json-logic
Version:
JSON Logic integration for Ajv validator
81 lines (79 loc) • 1.41 kB
JavaScript
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
};
export { $id, $schema, logicIf as default, description, examples, oneOf, title };
//# sourceMappingURL=if.json.js.map