2 Object.defineProperty(exports, "__esModule", { value: true });
3 exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0;
4 const errors_1 = require("../errors");
5 const codegen_1 = require("../codegen");
6 const names_1 = require("../names");
8 message: "boolean schema is false",
10 function topBoolOrEmptySchema(it) {
11 const { gen, schema, validateName } = it;
12 if (schema === false) {
13 falseSchemaError(it, false);
15 else if (typeof schema == "object" && schema.$async === true) {
16 gen.return(names_1.default.data);
19 gen.assign((0, codegen_1._) `${validateName}.errors`, null);
23 exports.topBoolOrEmptySchema = topBoolOrEmptySchema;
24 function boolOrEmptySchema(it, valid) {
25 const { gen, schema } = it;
26 if (schema === false) {
27 gen.var(valid, false); // TODO var
31 gen.var(valid, true); // TODO var
34 exports.boolOrEmptySchema = boolOrEmptySchema;
35 function falseSchemaError(it, overrideAllErrors) {
36 const { gen, data } = it;
37 // TODO maybe some other interface should be used for non-keyword validation errors...
40 keyword: "false schema",
48 (0, errors_1.reportError)(cxt, boolError, undefined, overrideAllErrors);
50 //# sourceMappingURL=boolSchema.js.map