This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

24
node_modules/ajv-keywords/src/definitions/_required.ts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import type {MacroKeywordDefinition} from "ajv"
import type {GetDefinition} from "./_types"
type RequiredKwd = "anyRequired" | "oneRequired"
export default function getRequiredDef(
keyword: RequiredKwd
): GetDefinition<MacroKeywordDefinition> {
return () => ({
keyword,
type: "object",
schemaType: "array",
macro(schema: string[]) {
if (schema.length === 0) return true
if (schema.length === 1) return {required: schema}
const comb = keyword === "anyRequired" ? "anyOf" : "oneOf"
return {[comb]: schema.map((p) => ({required: [p]}))}
},
metaSchema: {
type: "array",
items: {type: "string"},
},
})
}