limitContains.ts 485 B

12345678910111213141516
  1. import type {CodeKeywordDefinition} from "../../types"
  2. import type {KeywordCxt} from "../../compile/validate"
  3. import {checkStrictMode} from "../../compile/util"
  4. const def: CodeKeywordDefinition = {
  5. keyword: ["maxContains", "minContains"],
  6. type: "array",
  7. schemaType: "number",
  8. code({keyword, parentSchema, it}: KeywordCxt) {
  9. if (parentSchema.contains === undefined) {
  10. checkStrictMode(it, `"${keyword}" without "contains" is ignored`)
  11. }
  12. },
  13. }
  14. export default def