main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 2 weeks ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
717 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | import type {CodeKeywordDefinition, AnySchema} from "../../types"
|
---|
| 2 | import type {KeywordCxt} from "../../compile/validate"
|
---|
| 3 | import {alwaysValidSchema} from "../../compile/util"
|
---|
| 4 |
|
---|
| 5 | const def: CodeKeywordDefinition = {
|
---|
| 6 | keyword: "allOf",
|
---|
| 7 | schemaType: "array",
|
---|
| 8 | code(cxt: KeywordCxt) {
|
---|
| 9 | const {gen, schema, it} = cxt
|
---|
| 10 | /* istanbul ignore if */
|
---|
| 11 | if (!Array.isArray(schema)) throw new Error("ajv implementation error")
|
---|
| 12 | const valid = gen.name("valid")
|
---|
| 13 | schema.forEach((sch: AnySchema, i: number) => {
|
---|
| 14 | if (alwaysValidSchema(it, sch)) return
|
---|
| 15 | const schCxt = cxt.subschema({keyword: "allOf", schemaProp: i}, valid)
|
---|
| 16 | cxt.ok(valid)
|
---|
| 17 | cxt.mergeEvaluated(schCxt)
|
---|
| 18 | })
|
---|
| 19 | },
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | export default def
|
---|
Note:
See
TracBrowser
for help on using the repository browser.