({ schema, opts, self, errSchemaPath }, def, keyword)
| 3391 | } |
| 3392 | exports.validSchemaType = validSchemaType; |
| 3393 | function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def, keyword) { |
| 3394 | /* istanbul ignore if */ |
| 3395 | if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) { |
| 3396 | throw new Error("ajv implementation error"); |
| 3397 | } |
| 3398 | const deps = def.dependencies; |
| 3399 | if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) { |
| 3400 | throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`); |
| 3401 | } |
| 3402 | if (def.validateSchema) { |
| 3403 | const valid = def.validateSchema(schema[keyword]); |
| 3404 | if (!valid) { |
| 3405 | const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + |
| 3406 | self.errorsText(def.validateSchema.errors); |
| 3407 | if (opts.validateSchema === "log") |
| 3408 | self.logger.error(msg); |
| 3409 | else |
| 3410 | throw new Error(msg); |
| 3411 | } |
| 3412 | } |
| 3413 | } |
| 3414 | exports.validateKeywordUsage = validateKeywordUsage; |
| 3415 | //# sourceMappingURL=keyword.js.map |
| 3416 |
nothing calls this directly
no test coverage detected