source: trip-planner-front/node_modules/ajv/dist/compile/validate/boolSchema.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[6a3a178]1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0;
4const errors_1 = require("../errors");
5const codegen_1 = require("../codegen");
6const names_1 = require("../names");
7const boolError = {
8 message: "boolean schema is false",
9};
10function topBoolOrEmptySchema(it) {
11 const { gen, schema, validateName } = it;
12 if (schema === false) {
13 falseSchemaError(it, false);
14 }
15 else if (typeof schema == "object" && schema.$async === true) {
16 gen.return(names_1.default.data);
17 }
18 else {
19 gen.assign(codegen_1._ `${validateName}.errors`, null);
20 gen.return(true);
21 }
22}
23exports.topBoolOrEmptySchema = topBoolOrEmptySchema;
24function boolOrEmptySchema(it, valid) {
25 const { gen, schema } = it;
26 if (schema === false) {
27 gen.var(valid, false); // TODO var
28 falseSchemaError(it);
29 }
30 else {
31 gen.var(valid, true); // TODO var
32 }
33}
34exports.boolOrEmptySchema = boolOrEmptySchema;
35function falseSchemaError(it, overrideAllErrors) {
36 const { gen, data } = it;
37 // TODO maybe some other interface should be used for non-keyword validation errors...
38 const cxt = {
39 gen,
40 keyword: "false schema",
41 data,
42 schema: false,
43 schemaCode: false,
44 schemaValue: false,
45 params: {},
46 it,
47 };
48 errors_1.reportError(cxt, boolError, undefined, overrideAllErrors);
49}
50//# sourceMappingURL=boolSchema.js.map
Note: See TracBrowser for help on using the repository browser.