@earendil-works/pi-schema 0.0.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -1
- package/README.md +31 -8
- package/dist/builders.d.ts +29 -0
- package/dist/builders.d.ts.map +1 -1
- package/dist/builders.js +28 -0
- package/dist/builders.js.map +1 -1
- package/dist/checks.d.ts +38 -11
- package/dist/checks.d.ts.map +1 -1
- package/dist/checks.js +180 -49
- package/dist/checks.js.map +1 -1
- package/dist/coerce.d.ts.map +1 -1
- package/dist/coerce.js +42 -3
- package/dist/coerce.js.map +1 -1
- package/dist/compiler.d.ts.map +1 -1
- package/dist/compiler.js +33 -14
- package/dist/compiler.js.map +1 -1
- package/dist/explain.d.ts.map +1 -1
- package/dist/explain.js +29 -18
- package/dist/explain.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/resolver.d.ts +3 -2
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +11 -4
- package/dist/resolver.js.map +1 -1
- package/dist/typebox-static.d.ts +9 -1
- package/dist/typebox-static.d.ts.map +1 -1
- package/dist/typebox-static.js +3 -1
- package/dist/typebox-static.js.map +1 -1
- package/dist/validator.d.ts +9 -0
- package/dist/validator.d.ts.map +1 -1
- package/dist/validator.js +12 -2
- package/dist/validator.js.map +1 -1
- package/package.json +2 -2
- /package/{LICENSES → THIRD_PARTY_NOTICES}/typebox-LICENSE +0 -0
package/dist/compiler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.js","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,kHAAkH;AAClH,kDAAkD;AAElD,OAAO,EACN,gBAAgB,EAChB,eAAe,EAEf,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,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they constrain, so a value\n// is classified once per schema, and the common shapes (closed objects, arrays of one item schema, tagged unions,\n// leaf schemas) get one specialized closure each.\n\nimport {\n\tANNOTATING_FALSE,\n\tANNOTATING_TRUE,\n\ttype AnnotatingCheck,\n\tannotateAll,\n\tannotateAny,\n\tannotateArray,\n\tannotateDependent,\n\tannotateIf,\n\tannotateObject,\n\tignoreAnnotations,\n\tindirectAnnotating,\n\tisolateAnnotations,\n\tscopedAnnotating,\n\tunevaluatedItems,\n\tunevaluatedProperties,\n\twithFreshAnnotations,\n} from \"./annotations.ts\";\nimport {\n\tALWAYS,\n\tand,\n\tanyCheck,\n\tbytesCheck,\n\tconstCheck,\n\tcontainsCheck,\n\tdeclaredObject,\n\tdependentRequiredCheck,\n\tdependentSchemasCheck,\n\tenumCheck,\n\tGUARD_LOOSE,\n\tGUARD_NONE,\n\tGUARD_STRICT,\n\ttype Guard,\n\tguardArray,\n\tguardObject,\n\tINHERITED,\n\tIS_ARRAY,\n\tIS_OBJECT,\n\tifCheck,\n\tindirect,\n\titemsCheck,\n\tLEAF_CODES,\n\tlengthCheck,\n\tlistCheck,\n\tNEVER,\n\tnotCheck,\n\tnumberCheck,\n\toneCheck,\n\topenObject,\n\tpropertyCountCheck,\n\tpropertyNamesCheck,\n\tREQUIRED,\n\tscopedCheck,\n\tstringCheck,\n\tTYPE_CHECKS,\n\ttaggedCheck,\n\ttypeCheck,\n\tuniqueCheck,\n} from \"./checks.ts\";\nimport { documentOf, isSchemaObject, Resolver, resolveUri } from \"./resolver.ts\";\nimport { sharedRegex } from \"./shared.ts\";\nimport type { Check, CompileOptions, FormatCheck, JsonSchema, SchemaObject } from \"./types.ts\";\n\n/** Thrown when a compile without dynamic scope tracking meets a bookended `$dynamicRef`: compile again with it. */\nexport const RESTART = Symbol(\"restart\");\n\n/** One compile of a schema. Its caches and indexes are garbage once the root check is built. */\nexport class Compiler {\n\treadonly r: Resolver;\n\treadonly draft: \"2020-12\" | \"7\";\n\treadonly formats: Readonly<Record<string, FormatCheck>> | undefined;\n\t/** Whether checks track the dynamic scope (the schema has a bookended `$dynamicRef`). */\n\treadonly dynamic: boolean;\n\tprivate readonly schema: JsonSchema;\n\tprivate readonly scope: string[];\n\tprivate readonly cache = new Map<object, Check>();\n\tprivate readonly annotatingCache = new Map<object, AnnotatingCheck>();\n\n\tconstructor(schema: JsonSchema, options: CompileOptions, dynamic: boolean) {\n\t\tthis.schema = schema;\n\t\tthis.r = new Resolver(schema, options);\n\t\tthis.draft = this.r.draft;\n\t\tthis.formats = options.formats;\n\t\tthis.dynamic = dynamic;\n\t\tthis.scope = [];\n\t}\n\n\t/** The check of the root schema. */\n\troot(): Check {\n\t\treturn this.check(this.schema, this.r.rootBase);\n\t}\n\n\t/** The check of a schema (cached by schema object; a recursive reference goes through an indirection). */\n\tcheck(node: unknown, base: string): Check {\n\t\tif (node === true) return ALWAYS;\n\t\tif (node === false) return NEVER;\n\t\tif (!isSchemaObject(node))\n\t\t\tthrow new Error(`A schema must be an object or a boolean, got ${JSON.stringify(node)}`);\n\t\tconst cached = this.cache.get(node);\n\t\tif (cached !== undefined) return cached;\n\t\tconst bare = this.bareType(node);\n\t\tif (bare !== undefined) return bare;\n\t\tconst slot: { check: Check | undefined } = { check: undefined };\n\t\tthis.cache.set(node, indirect(slot));\n\t\tconst check = this.build(node, this.r.baseFor(node, base));\n\t\tslot.check = check;\n\t\tthis.cache.set(node, check);\n\t\treturn check;\n\t}\n\n\tprivate build(node: SchemaObject, base: string): Check {\n\t\tif (this.draft === \"7\" && typeof node.$ref === \"string\") return this.ref(node.$ref, base);\n\t\tif (this.draft !== \"7\" && (node.unevaluatedProperties !== undefined || node.unevaluatedItems !== undefined)) {\n\t\t\treturn withFreshAnnotations(this.annotating(node, base));\n\t\t}\n\t\tconst check = this.plain(node, base);\n\t\treturn this.dynamic && this.r.isResource(node, base) ? scopedCheck(this.scope, base, check) : check;\n\t}\n\n\t/**\n\t * The module-level check of a schema that is only a `type` (with annotations), `ALWAYS` for one with no assertion\n\t * at all; undefined for every other schema. These are the most common subschemas and cost nothing to share.\n\t */\n\tprivate bareType(node: SchemaObject): Check | undefined {\n\t\tlet type: unknown;\n\t\tfor (const k in node) {\n\t\t\tif (k === \"type\") type = node.type;\n\t\t\telse if (!NEUTRAL_KEYWORDS.has(k)) return undefined;\n\t\t}\n\t\tif (type === undefined) return ALWAYS;\n\t\treturn typeof type === \"string\" ? TYPE_CHECKS.get(type) : undefined;\n\t}\n\n\t/** Every keyword of `node`, not tracking annotations. */\n\tprivate plain(node: SchemaObject, base: string): Check {\n\t\tconst parts: Check[] = [];\n\t\tconst types = node.type === undefined ? undefined : Array.isArray(node.type) ? node.type : [node.type];\n\t\tconst single = types?.length === 1 ? types[0] : undefined;\n\t\tlet typeInGroup = false;\n\t\tif (single === \"bytes\") {\n\t\t\tparts.push(bytesCheck(number(node.minLength) ?? 0, number(node.maxLength) ?? Number.POSITIVE_INFINITY));\n\t\t\ttypeInGroup = true;\n\t\t} else {\n\t\t\tconst string = this.stringGroup(node, single === \"string\");\n\t\t\tif (string !== undefined) parts.push(string);\n\t\t\tconst numeric = single === \"number\" || single === \"integer\";\n\t\t\tconst number = this.numberGroup(node, single === \"number\" ? 1 : single === \"integer\" ? 2 : 0);\n\t\t\tif (number !== undefined) parts.push(number);\n\t\t\tconst object = this.objectGroup(node, base, single === \"object\");\n\t\t\tif (object !== undefined) parts.push(object);\n\t\t\tconst array = this.arrayGroup(node, base, single === \"array\");\n\t\t\tif (array !== undefined) parts.push(array);\n\t\t\ttypeInGroup =\n\t\t\t\t(single === \"string\" && string !== undefined) ||\n\t\t\t\t(numeric && number !== undefined) ||\n\t\t\t\t(single === \"object\" && object !== undefined) ||\n\t\t\t\t(single === \"array\" && array !== undefined);\n\t\t}\n\t\tif (types !== undefined && !typeInGroup) parts.unshift(typeCheck(types));\n\t\tthis.inPlace(node, base, parts);\n\t\treturn and(parts);\n\t}\n\n\t// The keywords that apply to the value itself, whatever its type.\n\tprivate inPlace(node: SchemaObject, base: string, parts: Check[]): void {\n\t\tif (Array.isArray(node.enum)) parts.push(enumCheck(node.enum));\n\t\tif (Object.hasOwn(node, \"const\")) parts.push(constCheck(node.const));\n\t\tif (Array.isArray(node.allOf)) parts.push(and(node.allOf.map((s) => this.check(s, base))));\n\t\tif (Array.isArray(node.anyOf)) parts.push(this.union(node.anyOf, base, false));\n\t\tif (Array.isArray(node.oneOf)) parts.push(this.union(node.oneOf, base, true));\n\t\tif (node.not !== undefined) parts.push(notCheck(this.check(node.not, base)));\n\t\tif (node.if !== undefined && (node.then !== undefined || node.else !== undefined)) {\n\t\t\tconst then = node.then === undefined ? ALWAYS : this.check(node.then, base);\n\t\t\tconst otherwise = node.else === undefined ? ALWAYS : this.check(node.else, base);\n\t\t\tparts.push(ifCheck(this.check(node.if, base), then, otherwise));\n\t\t}\n\t\tif (typeof node.$ref === \"string\") parts.push(this.ref(node.$ref, base));\n\t\tif (this.draft !== \"7\" && typeof node.$dynamicRef === \"string\") {\n\t\t\tparts.push(this.dynamicRef(node.$dynamicRef, base));\n\t\t}\n\t}\n\n\tprivate union(branches: readonly unknown[], base: string, exactlyOne: boolean): Check {\n\t\tconst checks = () => branches.map((s) => this.check(s, base));\n\t\treturn (\n\t\t\tconstUnion(branches, exactlyOne) ??\n\t\t\tthis.tagged(branches, base) ??\n\t\t\t(exactlyOne ? oneCheck(checks()) : anyCheck(checks()))\n\t\t);\n\t}\n\n\tprivate ref(ref: string, base: string): Check {\n\t\tconst target = this.r.resolve(ref, base);\n\t\tconst check = this.check(target.node, target.base);\n\t\treturn this.dynamic && target.base !== base ? scopedCheck(this.scope, target.base, check) : check;\n\t}\n\n\tprivate dynamicRef(ref: string, base: string): Check {\n\t\tconst resolved = this.bookended(ref, base);\n\t\tif (resolved === undefined) return this.ref(ref, base);\n\t\tconst { initial, name } = resolved;\n\t\tconst fallback = this.check(initial.node, initial.base);\n\t\tconst lookup = this.dynamicLookup(name, (node, b) => this.check(node, b));\n\t\tconst scope = this.scope;\n\t\treturn (v) => {\n\t\t\tfor (let i = 0; i < scope.length; i++) {\n\t\t\t\tconst check = lookup(scope[i]);\n\t\t\t\tif (check !== null) return check(v);\n\t\t\t}\n\t\t\treturn fallback(v);\n\t\t};\n\t}\n\n\t/** The initial target and anchor name of a `$dynamicRef` that resolves dynamically, or undefined for a plain ref. */\n\tprivate bookended(\n\t\tref: string,\n\t\tbase: string,\n\t): { initial: { node: unknown; base: string }; name: string } | undefined {\n\t\tconst initial = this.r.resolve(ref, base);\n\t\tconst uri = resolveUri(ref, base);\n\t\tconst name = uri.slice(documentOf(uri).length + 1);\n\t\tconst anchored = isSchemaObject(initial.node) && initial.node.$dynamicAnchor === name;\n\t\tif (name === \"\" || name.startsWith(\"/\") || !anchored) return undefined;\n\t\tif (!this.dynamic) throw RESTART;\n\t\treturn { initial, name };\n\t}\n\n\t// Resolved at run time against the dynamic scope, so a schema with a bookended $dynamicRef keeps its compiler.\n\tprivate dynamicLookup<T>(name: string, compile: (node: SchemaObject, base: string) => T): (uri: string) => T | null {\n\t\tconst found = new Map<string, T | null>();\n\t\treturn (uri) => {\n\t\t\tconst key = `${uri}#${name}`;\n\t\t\tlet check = found.get(key);\n\t\t\tif (check === undefined) {\n\t\t\t\tconst target = this.r.dynamicAnchors.get(key);\n\t\t\t\tcheck = target === undefined ? null : compile(target, this.r.baseOf.get(target) ?? uri);\n\t\t\t\tfound.set(key, check);\n\t\t\t}\n\t\t\treturn check;\n\t\t};\n\t}\n\n\t/** anyOf/oneOf whose branches are all objects with a distinct required const on one key: the tag picks the branch. */\n\tprivate tagged(branches: readonly unknown[], base: string): Check | undefined {\n\t\tif (branches.length < 2) return undefined;\n\t\tconst resolved: SchemaObject[] = [];\n\t\tfor (const branch of branches) {\n\t\t\tif (!isSchemaObject(branch)) return undefined;\n\t\t\tconst ref = typeof branch.$ref === \"string\" && Object.keys(branch).length === 1 ? branch.$ref : undefined;\n\t\t\tconst node = ref === undefined ? branch : this.r.resolve(ref, this.r.baseFor(branch, base)).node;\n\t\t\tif (!isSchemaObject(node)) return undefined;\n\t\t\tresolved.push(node);\n\t\t}\n\t\tconst first = resolved[0].properties;\n\t\tif (!isSchemaObject(first)) return undefined;\n\t\tfor (const key of Object.keys(first)) {\n\t\t\tconst tags = resolved.map((s) => tagOf(s, key));\n\t\t\tif (tags.some((t) => t === undefined) || new Set(tags).size !== tags.length) continue;\n\t\t\treturn taggedCheck(\n\t\t\t\tkey,\n\t\t\t\ttags,\n\t\t\t\tbranches.map((s) => this.check(s, base)),\n\t\t\t);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate stringGroup(node: SchemaObject, strict: boolean): Check | undefined {\n\t\tconst min = number(node.minLength) ?? 0;\n\t\tconst max = number(node.maxLength) ?? Number.POSITIVE_INFINITY;\n\t\tconst re = typeof node.pattern === \"string\" ? sharedRegex(node.pattern) : undefined;\n\t\tconst format =\n\t\t\tthis.formats !== undefined && typeof node.format === \"string\" && Object.hasOwn(this.formats, node.format)\n\t\t\t\t? this.formats[node.format]\n\t\t\t\t: undefined;\n\t\tif (min === 0 && max === Number.POSITIVE_INFINITY && re === undefined && format === undefined) return undefined;\n\t\treturn stringCheck(strict, min, max, re, format);\n\t}\n\n\tprivate numberGroup(node: SchemaObject, mode: 0 | 1 | 2): Check | undefined {\n\t\tconst min = number(node.minimum);\n\t\tconst max = number(node.maximum);\n\t\tconst xmin = number(node.exclusiveMinimum);\n\t\tconst xmax = number(node.exclusiveMaximum);\n\t\tconst multipleOf = number(node.multipleOf);\n\t\tif ([min, max, xmin, xmax, multipleOf].every((x) => x === undefined)) return undefined;\n\t\tconst inf = Number.POSITIVE_INFINITY;\n\t\treturn numberCheck(mode, min ?? -inf, max ?? inf, xmin ?? -inf, xmax ?? inf, multipleOf);\n\t}\n\n\tprivate objectGroup(node: SchemaObject, base: string, strict: boolean): Check | undefined {\n\t\tconst onlyCore = OBJECT_EXTRAS.every((k) => node[k] === undefined);\n\t\t// A schema with only the core object keywords gets one closure that also does the type guard.\n\t\tconst core = this.objectCore(node, base, onlyCore ? (strict ? GUARD_STRICT : GUARD_LOOSE) : GUARD_NONE);\n\t\tif (core !== undefined && onlyCore) return core;\n\t\tconst parts: Check[] = core === undefined ? [] : [core];\n\t\tif (node.propertyNames !== undefined) parts.push(propertyNamesCheck(this.check(node.propertyNames, base)));\n\t\tconst minProperties = number(node.minProperties);\n\t\tconst maxProperties = number(node.maxProperties);\n\t\tif (minProperties !== undefined || maxProperties !== undefined) {\n\t\t\tparts.push(propertyCountCheck(minProperties ?? 0, maxProperties ?? Number.POSITIVE_INFINITY));\n\t\t}\n\t\tconst dependentRequired: [string, string[]][] = [];\n\t\tconst dependentSchemas: [string, Check][] = [];\n\t\tif (this.draft !== \"7\") {\n\t\t\tfor (const [k, list] of entries(node.dependentRequired))\n\t\t\t\tif (Array.isArray(list)) dependentRequired.push([k, list]);\n\t\t\tfor (const [k, s] of entries(node.dependentSchemas)) dependentSchemas.push([k, this.check(s, base)]);\n\t\t}\n\t\tfor (const [k, d] of entries(node.dependencies)) {\n\t\t\tif (Array.isArray(d)) dependentRequired.push([k, d]);\n\t\t\telse dependentSchemas.push([k, this.check(d, base)]);\n\t\t}\n\t\tif (dependentRequired.length > 0) parts.push(dependentRequiredCheck(dependentRequired));\n\t\tif (dependentSchemas.length > 0) parts.push(dependentSchemasCheck(dependentSchemas));\n\t\tif (parts.length === 0) return strict ? IS_OBJECT : undefined;\n\t\treturn guardObject(and(parts), strict);\n\t}\n\n\tprivate objectCore(node: SchemaObject, base: string, guard: Guard): Check | undefined {\n\t\tconst properties = isSchemaObject(node.properties) ? node.properties : {};\n\t\tconst required = Array.isArray(node.required) ? node.required.filter((k) => typeof k === \"string\") : [];\n\t\tconst patterns = isSchemaObject(node.patternProperties) ? node.patternProperties : {};\n\t\tconst additional = node.additionalProperties;\n\t\tconst keys = Object.keys(properties);\n\t\tconst patternKeys = Object.keys(patterns);\n\t\tif (\n\t\t\tkeys.length + required.length + patternKeys.length === 0 &&\n\t\t\t(additional === undefined || additional === true)\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\t// One array per object: key, check, flags (leaf code, required, key also names an Object.prototype member).\n\t\tconst entries: unknown[] = [];\n\t\tfor (const k of keys) {\n\t\t\tconst check = this.check(properties[k], base);\n\t\t\tconst flags =\n\t\t\t\t(LEAF_CODES.get(check) ?? 0) |\n\t\t\t\t(required.includes(k) ? REQUIRED : 0) |\n\t\t\t\t(k in Object.prototype ? INHERITED : 0);\n\t\t\tentries.push(k, check, flags);\n\t\t}\n\t\tconst extraRequired = required.filter((k) => !Object.hasOwn(properties, k));\n\t\tconst pats = patternKeys.map((p) => [sharedRegex(p), this.check(patterns[p], base)] as const);\n\t\tconst extra = additional === undefined || additional === true ? undefined : this.check(additional, base);\n\t\tif (pats.length === 0 && extraRequired.length === 0 && (extra === undefined || additional === false)) {\n\t\t\tconst requiredCount = keys.filter((k) => required.includes(k)).length;\n\t\t\treturn declaredObject(entries, requiredCount, additional === false, guard);\n\t\t}\n\t\treturn openObject(entries, keys, extraRequired, pats, extra, guard);\n\t}\n\n\tprivate arrayGroup(node: SchemaObject, base: string, strict: boolean): Check | undefined {\n\t\tlet prefix: readonly unknown[] = [];\n\t\tlet rest: unknown;\n\t\tif (Array.isArray(node.items)) {\n\t\t\tprefix = node.items;\n\t\t\trest = node.additionalItems;\n\t\t} else {\n\t\t\tif (this.draft !== \"7\" && Array.isArray(node.prefixItems)) prefix = node.prefixItems;\n\t\t\trest = node.items;\n\t\t}\n\t\tconst prefixChecks = prefix.map((s) => this.check(s, base));\n\t\tconst restCheck = rest === undefined || rest === true ? undefined : this.check(rest, base);\n\t\tconst minItems = number(node.minItems);\n\t\tconst maxItems = number(node.maxItems);\n\t\tif (\n\t\t\tnode.contains === undefined &&\n\t\t\tnode.uniqueItems !== true &&\n\t\t\t(prefixChecks.length > 0 || restCheck !== undefined)\n\t\t) {\n\t\t\t// The common array: one closure for the guard, the length bounds and the items.\n\t\t\tconst guard = strict ? GUARD_STRICT : GUARD_LOOSE;\n\t\t\treturn listCheck(guard, minItems ?? 0, maxItems ?? Number.POSITIVE_INFINITY, prefixChecks, restCheck);\n\t\t}\n\t\tconst parts: Check[] = [];\n\t\tif (prefixChecks.length > 0 || restCheck !== undefined) parts.push(itemsCheck(prefixChecks, restCheck));\n\t\tif (minItems !== undefined || maxItems !== undefined) {\n\t\t\tparts.push(lengthCheck(minItems ?? 0, maxItems ?? Number.POSITIVE_INFINITY));\n\t\t}\n\t\tif (node.contains !== undefined) {\n\t\t\tconst min = this.draft === \"7\" ? 1 : (number(node.minContains) ?? 1);\n\t\t\tconst max =\n\t\t\t\tthis.draft === \"7\" ? Number.POSITIVE_INFINITY : (number(node.maxContains) ?? Number.POSITIVE_INFINITY);\n\t\t\tparts.push(containsCheck(this.check(node.contains, base), min, max));\n\t\t}\n\t\tif (node.uniqueItems === true) parts.push(uniqueCheck);\n\t\tif (parts.length === 0) return strict ? IS_ARRAY : undefined;\n\t\treturn guardArray(and(parts), strict);\n\t}\n\n\t/** The annotating check of a schema evaluated in place (only below `unevaluatedProperties`/`unevaluatedItems`). */\n\tannotating(node: unknown, base: string): AnnotatingCheck {\n\t\tif (node === true) return ANNOTATING_TRUE;\n\t\tif (node === false) return ANNOTATING_FALSE;\n\t\tif (!isSchemaObject(node))\n\t\t\tthrow new Error(`A schema must be an object or a boolean, got ${JSON.stringify(node)}`);\n\t\tconst cached = this.annotatingCache.get(node);\n\t\tif (cached !== undefined) return cached;\n\t\tconst slot: { check: AnnotatingCheck | undefined } = { check: undefined };\n\t\tthis.annotatingCache.set(node, indirectAnnotating(slot));\n\t\tconst check = this.buildAnnotating(node, this.r.baseFor(node, base));\n\t\tslot.check = check;\n\t\tthis.annotatingCache.set(node, check);\n\t\treturn check;\n\t}\n\n\tprivate buildAnnotating(node: SchemaObject, base: string): AnnotatingCheck {\n\t\tconst rest: Record<string, unknown> = {};\n\t\tlet annotates = false;\n\t\tfor (const k of Object.keys(node)) {\n\t\t\tif (ANNOTATING.has(k)) annotates = true;\n\t\t\telse rest[k] = node[k];\n\t\t}\n\t\tconst plain = this.plain(rest, base);\n\t\tconst parts: AnnotatingCheck[] = [];\n\t\tif (annotates) this.annotatingParts(node, base, parts);\n\t\tconst all = parts.length === 0 ? ignoreAnnotations(plain) : annotateAll(plain, parts);\n\t\tconst own =\n\t\t\tnode.unevaluatedProperties !== undefined || node.unevaluatedItems !== undefined\n\t\t\t\t? isolateAnnotations(all)\n\t\t\t\t: all;\n\t\treturn this.dynamic && this.r.isResource(node, base) ? scopedAnnotating(this.scope, base, own) : own;\n\t}\n\n\tprivate annotatingParts(node: SchemaObject, base: string, parts: AnnotatingCheck[]): void {\n\t\tif (\n\t\t\tnode.properties !== undefined ||\n\t\t\tnode.patternProperties !== undefined ||\n\t\t\tnode.additionalProperties !== undefined\n\t\t) {\n\t\t\tconst props = entries(node.properties).map(([k, s]) => [k, this.check(s, base)] as const);\n\t\t\tconst pats = entries(node.patternProperties).map(([p, s]) => [sharedRegex(p), this.check(s, base)] as const);\n\t\t\tconst extra =\n\t\t\t\tnode.additionalProperties === undefined ? undefined : this.check(node.additionalProperties, base);\n\t\t\tparts.push(annotateObject(props, pats, extra));\n\t\t}\n\t\tif (node.prefixItems !== undefined || node.items !== undefined || node.contains !== undefined) {\n\t\t\tconst prefix = Array.isArray(node.prefixItems)\n\t\t\t\t? node.prefixItems\n\t\t\t\t: Array.isArray(node.items)\n\t\t\t\t\t? node.items\n\t\t\t\t\t: [];\n\t\t\tconst rest = Array.isArray(node.items) ? node.additionalItems : node.items;\n\t\t\tparts.push(\n\t\t\t\tannotateArray(\n\t\t\t\t\tprefix.map((s) => this.check(s, base)),\n\t\t\t\t\trest === undefined ? undefined : this.check(rest, base),\n\t\t\t\t\tnode.contains === undefined ? undefined : this.check(node.contains, base),\n\t\t\t\t\tnumber(node.minContains) ?? 1,\n\t\t\t\t\tnumber(node.maxContains) ?? Number.POSITIVE_INFINITY,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tif (Array.isArray(node.allOf)) for (const s of node.allOf) parts.push(this.annotating(s, base));\n\t\tif (Array.isArray(node.anyOf))\n\t\t\tparts.push(\n\t\t\t\tannotateAny(\n\t\t\t\t\tnode.anyOf.map((s) => this.annotating(s, base)),\n\t\t\t\t\tfalse,\n\t\t\t\t),\n\t\t\t);\n\t\tif (Array.isArray(node.oneOf))\n\t\t\tparts.push(\n\t\t\t\tannotateAny(\n\t\t\t\t\tnode.oneOf.map((s) => this.annotating(s, base)),\n\t\t\t\t\ttrue,\n\t\t\t\t),\n\t\t\t);\n\t\tif (node.if !== undefined) {\n\t\t\tconst then = node.then === undefined ? undefined : this.annotating(node.then, base);\n\t\t\tconst otherwise = node.else === undefined ? undefined : this.annotating(node.else, base);\n\t\t\tparts.push(annotateIf(this.annotating(node.if, base), then, otherwise));\n\t\t}\n\t\tif (typeof node.$ref === \"string\") parts.push(this.annotatingRef(node.$ref, base));\n\t\tif (typeof node.$dynamicRef === \"string\") parts.push(this.annotatingDynamicRef(node.$dynamicRef, base));\n\t\tfor (const [k, s] of entries(node.dependentSchemas)) parts.push(annotateDependent(k, this.annotating(s, base)));\n\t\tif (node.unevaluatedProperties !== undefined) {\n\t\t\tparts.push(unevaluatedProperties(this.check(node.unevaluatedProperties, base)));\n\t\t}\n\t\tif (node.unevaluatedItems !== undefined) parts.push(unevaluatedItems(this.check(node.unevaluatedItems, base)));\n\t}\n\n\tprivate annotatingRef(ref: string, base: string): AnnotatingCheck {\n\t\tconst target = this.r.resolve(ref, base);\n\t\tconst check = this.annotating(target.node, target.base);\n\t\treturn this.dynamic && target.base !== base ? scopedAnnotating(this.scope, target.base, check) : check;\n\t}\n\n\tprivate annotatingDynamicRef(ref: string, base: string): AnnotatingCheck {\n\t\tconst resolved = this.bookended(ref, base);\n\t\tif (resolved === undefined) return this.annotatingRef(ref, base);\n\t\tconst { initial, name } = resolved;\n\t\tconst fallback = this.annotating(initial.node, initial.base);\n\t\tconst lookup = this.dynamicLookup(name, (node, b) => this.annotating(node, b));\n\t\tconst scope = this.scope;\n\t\treturn (v, a) => {\n\t\t\tfor (let i = 0; i < scope.length; i++) {\n\t\t\t\tconst check = lookup(scope[i]);\n\t\t\t\tif (check !== null) return check(v, a);\n\t\t\t}\n\t\t\treturn fallback(v, a);\n\t\t};\n\t}\n}\n\n/** Keywords that never affect a check. */\nexport const NEUTRAL_KEYWORDS = new Set([\n\t\"$schema\",\n\t\"$comment\",\n\t\"title\",\n\t\"description\",\n\t\"default\",\n\t\"examples\",\n\t\"deprecated\",\n\t\"readOnly\",\n\t\"writeOnly\",\n\t\"$defs\",\n\t\"definitions\",\n\t\"contentEncoding\",\n\t\"contentMediaType\",\n\t\"minContains\",\n\t\"maxContains\",\n\t\"$vocabulary\",\n]);\n\n// The object keywords besides the core (properties, required, patternProperties, additionalProperties).\nconst OBJECT_EXTRAS = [\n\t\"propertyNames\",\n\t\"minProperties\",\n\t\"maxProperties\",\n\t\"dependentRequired\",\n\t\"dependentSchemas\",\n\t\"dependencies\",\n];\n\n// The keywords an annotating check handles itself; every other keyword compiles into its plain part.\nconst ANNOTATING = new Set([\n\t\"properties\",\n\t\"patternProperties\",\n\t\"additionalProperties\",\n\t\"prefixItems\",\n\t\"items\",\n\t\"additionalItems\",\n\t\"contains\",\n\t\"minContains\",\n\t\"maxContains\",\n\t\"allOf\",\n\t\"anyOf\",\n\t\"oneOf\",\n\t\"if\",\n\t\"then\",\n\t\"else\",\n\t\"$ref\",\n\t\"$dynamicRef\",\n\t\"dependentSchemas\",\n\t\"unevaluatedProperties\",\n\t\"unevaluatedItems\",\n]);\n\n/** anyOf/oneOf whose branches are all `{ const: primitive }`: an enum (distinct values make oneOf the same). */\nfunction constUnion(branches: readonly unknown[], exactlyOne: boolean): Check | undefined {\n\tconst values: unknown[] = [];\n\tfor (const branch of branches) {\n\t\tif (!isSchemaObject(branch) || !Object.hasOwn(branch, \"const\")) return undefined;\n\t\tfor (const k of Object.keys(branch)) if (k !== \"const\" && !NEUTRAL_KEYWORDS.has(k)) return undefined;\n\t\tif (typeof branch.const === \"object\" && branch.const !== null) return undefined;\n\t\tif (exactlyOne && values.includes(branch.const)) return undefined;\n\t\tvalues.push(branch.const);\n\t}\n\treturn enumCheck(values);\n}\n\n// The tag of a tagged-union branch: a primitive const on a required property of an object schema.\nfunction tagOf(branch: SchemaObject, key: string): unknown {\n\tconst properties = branch.properties;\n\tif (branch.type !== \"object\" || !Array.isArray(branch.required) || !branch.required.includes(key)) return undefined;\n\tconst tag = isSchemaObject(properties) ? properties[key] : undefined;\n\tif (!isSchemaObject(tag) || !Object.hasOwn(tag, \"const\")) return undefined;\n\treturn typeof tag.const === \"object\" && tag.const !== null ? undefined : tag.const;\n}\n\nfunction number(value: unknown): number | undefined {\n\treturn typeof value === \"number\" ? value : undefined;\n}\n\nfunction entries(value: unknown): [string, unknown][] {\n\treturn isSchemaObject(value) ? Object.entries(value) : [];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compiler.js","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,kHAAkH;AAClH,kDAAkD;AAElD,OAAO,EACN,gBAAgB,EAChB,eAAe,EAEf,WAAW,EACX,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,MAAM,EACN,GAAG,EACH,QAAQ,EAER,UAAU,EACV,UAAU,EACV,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,SAAS,EACT,WAAW,EACX,UAAU,EACV,YAAY,EAEZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,EACR,UAAU,EACV,MAAM,EACN,WAAW,EACX,SAAS,EACT,cAAc,EACd,KAAK,EACL,QAAQ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M,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3E,OAAO,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC;AACpF,CAAC;AAED,wFAAwF;AACxF,SAAS,KAAK,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACnF,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAC7B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC9B,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,CAAC","sourcesContent":["// The compiler: a schema to one check closure, built once. Keywords group by the type they constrain, so a value\n// is classified once per schema, and the common shapes (closed objects, arrays of one item schema, tagged unions,\n// leaf schemas) get one specialized closure each.\n\nimport {\n\tANNOTATING_FALSE,\n\tANNOTATING_TRUE,\n\ttype AnnotatingCheck,\n\tannotateAll,\n\tannotateAny,\n\tannotateArray,\n\tannotateDependent,\n\tannotateIf,\n\tannotateObject,\n\tignoreAnnotations,\n\tindirectAnnotating,\n\tisolateAnnotations,\n\tscopedAnnotating,\n\tunevaluatedItems,\n\tunevaluatedProperties,\n\twithFreshAnnotations,\n} from \"./annotations.ts\";\nimport {\n\tALWAYS,\n\tand,\n\tanyCheck,\n\ttype Bound,\n\tbytesCheck,\n\tconstCheck,\n\tcontainsCheck,\n\tdeclaredObject,\n\tdependentRequiredCheck,\n\tdependentSchemasCheck,\n\tenumCheck,\n\tGUARD_LOOSE,\n\tGUARD_NONE,\n\tGUARD_STRICT,\n\ttype Guard,\n\tguardArray,\n\tguardObject,\n\tINHERITED,\n\tIS_ARRAY,\n\tIS_OBJECT,\n\tifCheck,\n\tindirect,\n\titemsCheck,\n\tleafOf,\n\tlengthCheck,\n\tlistCheck,\n\tmaskedAnyCheck,\n\tNEVER,\n\tnotCheck,\n\tnumberCheck,\n\toneCheck,\n\topenObject,\n\tpropertyCountCheck,\n\tpropertyNamesCheck,\n\tREQUIRED,\n\tscopedCheck,\n\tstringCheck,\n\tTYPE_CHECKS,\n\ttaggedCheck,\n\ttypeCheck,\n\ttypeMask,\n\tuniqueCheck,\n} from \"./checks.ts\";\nimport { documentOf, isSchemaObject, Resolver, resolveUri } from \"./resolver.ts\";\nimport { sharedRegex } from \"./shared.ts\";\nimport type { Check, CompileOptions, FormatCheck, JsonSchema, SchemaObject } from \"./types.ts\";\n\n/** Thrown when a compile without dynamic scope tracking meets a bookended `$dynamicRef`: compile again with it. */\nexport const RESTART = Symbol(\"restart\");\n\n/** One compile of a schema. Its caches and indexes are garbage once the root check is built. */\nexport class Compiler {\n\treadonly r: Resolver;\n\treadonly draft: \"2020-12\" | \"7\";\n\treadonly formats: Readonly<Record<string, FormatCheck>> | undefined;\n\t/** Whether checks track the dynamic scope (the schema has a bookended `$dynamicRef`). */\n\treadonly dynamic: boolean;\n\tprivate readonly schema: JsonSchema;\n\tprivate readonly scope: string[];\n\tprivate readonly cache = new Map<object, Check>();\n\tprivate readonly annotatingCache = new Map<object, AnnotatingCheck>();\n\n\tconstructor(schema: JsonSchema, options: CompileOptions, dynamic: boolean) {\n\t\tthis.schema = schema;\n\t\tthis.r = new Resolver(schema, options);\n\t\tthis.draft = this.r.draft;\n\t\tthis.formats = options.formats;\n\t\tthis.dynamic = dynamic;\n\t\tthis.scope = [];\n\t}\n\n\t/** The check of the root schema. */\n\troot(): Check {\n\t\treturn this.check(this.schema, this.r.rootBase);\n\t}\n\n\t/** The check of a schema (cached by schema object; a recursive reference goes through an indirection). */\n\tcheck(node: unknown, base: string): Check {\n\t\tif (node === true) return ALWAYS;\n\t\tif (node === false) return NEVER;\n\t\tif (!isSchemaObject(node))\n\t\t\tthrow new Error(`A schema must be an object or a boolean, got ${JSON.stringify(node)}`);\n\t\tconst cached = this.cache.get(node);\n\t\tif (cached !== undefined) return cached;\n\t\tconst bare = this.bareType(node);\n\t\tif (bare !== undefined) return bare;\n\t\tconst slot: { check: Check | undefined } = { check: undefined };\n\t\tthis.cache.set(node, indirect(slot));\n\t\tconst check = this.build(node, this.r.baseFor(node, base));\n\t\tslot.check = check;\n\t\tthis.cache.set(node, check);\n\t\treturn check;\n\t}\n\n\tprivate build(node: SchemaObject, base: string): Check {\n\t\tif (this.draft === \"7\" && typeof node.$ref === \"string\") return this.ref(node.$ref, base);\n\t\tif (this.draft !== \"7\" && (node.unevaluatedProperties !== undefined || node.unevaluatedItems !== undefined)) {\n\t\t\treturn withFreshAnnotations(this.annotating(node, base));\n\t\t}\n\t\tconst check = this.plain(node, base);\n\t\treturn this.dynamic && this.r.isResource(node, base) ? scopedCheck(this.scope, base, check) : check;\n\t}\n\n\t/**\n\t * The module-level check of a schema that is only a `type` (with annotations), `ALWAYS` for one with no assertion\n\t * at all; undefined for every other schema. These are the most common subschemas and cost nothing to share.\n\t */\n\tprivate bareType(node: SchemaObject): Check | undefined {\n\t\tlet type: unknown;\n\t\tfor (const k in node) {\n\t\t\tif (k === \"type\") type = node.type;\n\t\t\telse if (!NEUTRAL_KEYWORDS.has(k)) return undefined;\n\t\t}\n\t\tif (type === undefined) return ALWAYS;\n\t\treturn typeof type === \"string\" ? TYPE_CHECKS.get(type) : undefined;\n\t}\n\n\t/** Every keyword of `node`, not tracking annotations. */\n\tprivate plain(node: SchemaObject, base: string): Check {\n\t\tconst parts: Check[] = [];\n\t\tconst types = node.type === undefined ? undefined : Array.isArray(node.type) ? node.type : [node.type];\n\t\tconst single = types?.length === 1 ? types[0] : undefined;\n\t\tlet typeInGroup = false;\n\t\tif (single === \"bytes\") {\n\t\t\tparts.push(bytesCheck(number(node.minLength) ?? 0, number(node.maxLength) ?? Number.POSITIVE_INFINITY));\n\t\t\ttypeInGroup = true;\n\t\t} else {\n\t\t\tconst string = this.stringGroup(node, single === \"string\");\n\t\t\tif (string !== undefined) parts.push(string);\n\t\t\tconst numeric = single === \"number\" || single === \"integer\" || single === \"bigint\";\n\t\t\tconst mode = single === \"number\" ? 1 : single === \"integer\" ? 2 : single === \"bigint\" ? 3 : 0;\n\t\t\tconst number = this.numberGroup(node, mode);\n\t\t\tif (number !== undefined) parts.push(number);\n\t\t\tconst object = this.objectGroup(node, base, single === \"object\");\n\t\t\tif (object !== undefined) parts.push(object);\n\t\t\tconst array = this.arrayGroup(node, base, single === \"array\");\n\t\t\tif (array !== undefined) parts.push(array);\n\t\t\ttypeInGroup =\n\t\t\t\t(single === \"string\" && string !== undefined) ||\n\t\t\t\t(numeric && number !== undefined) ||\n\t\t\t\t(single === \"object\" && object !== undefined) ||\n\t\t\t\t(single === \"array\" && array !== undefined);\n\t\t}\n\t\tif (types !== undefined && !typeInGroup) parts.unshift(typeCheck(types));\n\t\tthis.inPlace(node, base, parts);\n\t\treturn and(parts);\n\t}\n\n\t// The keywords that apply to the value itself, whatever its type.\n\tprivate inPlace(node: SchemaObject, base: string, parts: Check[]): void {\n\t\tif (Array.isArray(node.enum)) parts.push(enumCheck(node.enum));\n\t\tif (Object.hasOwn(node, \"const\")) parts.push(constCheck(node.const));\n\t\tif (Array.isArray(node.allOf)) parts.push(and(node.allOf.map((s) => this.check(s, base))));\n\t\tif (Array.isArray(node.anyOf)) parts.push(this.union(node.anyOf, base, false));\n\t\tif (Array.isArray(node.oneOf)) parts.push(this.union(node.oneOf, base, true));\n\t\tif (node.not !== undefined) parts.push(notCheck(this.check(node.not, base)));\n\t\tif (node.if !== undefined && (node.then !== undefined || node.else !== undefined)) {\n\t\t\tconst then = node.then === undefined ? ALWAYS : this.check(node.then, base);\n\t\t\tconst otherwise = node.else === undefined ? ALWAYS : this.check(node.else, base);\n\t\t\tparts.push(ifCheck(this.check(node.if, base), then, otherwise));\n\t\t}\n\t\tif (typeof node.$ref === \"string\") parts.push(this.ref(node.$ref, base));\n\t\tif (this.draft !== \"7\" && typeof node.$dynamicRef === \"string\") {\n\t\t\tparts.push(this.dynamicRef(node.$dynamicRef, base));\n\t\t}\n\t}\n\n\tprivate union(branches: readonly unknown[], base: string, exactlyOne: boolean): Check {\n\t\tconst checks = () => branches.map((s) => this.check(s, base));\n\t\treturn (\n\t\t\tconstUnion(branches, exactlyOne) ??\n\t\t\tthis.tagged(branches, base) ??\n\t\t\t(exactlyOne ? oneCheck(checks()) : anyOf(checks()))\n\t\t);\n\t}\n\n\tprivate ref(ref: string, base: string): Check {\n\t\tconst target = this.r.resolve(ref, base);\n\t\tconst check = this.check(target.node, target.base);\n\t\treturn this.dynamic && target.base !== base ? scopedCheck(this.scope, target.base, check) : check;\n\t}\n\n\tprivate dynamicRef(ref: string, base: string): Check {\n\t\tconst resolved = this.bookended(ref, base);\n\t\tif (resolved === undefined) return this.ref(ref, base);\n\t\tconst { initial, name } = resolved;\n\t\tconst fallback = this.check(initial.node, initial.base);\n\t\tconst lookup = this.dynamicLookup(name, (node, b) => this.check(node, b));\n\t\tconst scope = this.scope;\n\t\treturn (v) => {\n\t\t\tfor (let i = 0; i < scope.length; i++) {\n\t\t\t\tconst check = lookup(scope[i]);\n\t\t\t\tif (check !== null) return check(v);\n\t\t\t}\n\t\t\treturn fallback(v);\n\t\t};\n\t}\n\n\t/** The initial target and anchor name of a `$dynamicRef` that resolves dynamically, or undefined for a plain ref. */\n\tprivate bookended(\n\t\tref: string,\n\t\tbase: string,\n\t): { initial: { node: unknown; base: string }; name: string } | undefined {\n\t\tconst initial = this.r.resolve(ref, base);\n\t\tconst uri = resolveUri(ref, base);\n\t\tconst name = uri.slice(documentOf(uri).length + 1);\n\t\tconst anchored = isSchemaObject(initial.node) && initial.node.$dynamicAnchor === name;\n\t\tif (name === \"\" || name.startsWith(\"/\") || !anchored) return undefined;\n\t\tif (!this.dynamic) throw RESTART;\n\t\treturn { initial, name };\n\t}\n\n\t// Resolved at run time against the dynamic scope, so a schema with a bookended $dynamicRef keeps its compiler.\n\tprivate dynamicLookup<T>(name: string, compile: (node: SchemaObject, base: string) => T): (uri: string) => T | null {\n\t\tconst found = new Map<string, T | null>();\n\t\treturn (uri) => {\n\t\t\tconst key = `${uri}#${name}`;\n\t\t\tlet check = found.get(key);\n\t\t\tif (check === undefined) {\n\t\t\t\tconst target = this.r.dynamicAnchors.get(key);\n\t\t\t\tcheck = target === undefined ? null : compile(target, this.r.baseOf.get(target) ?? uri);\n\t\t\t\tfound.set(key, check);\n\t\t\t}\n\t\t\treturn check;\n\t\t};\n\t}\n\n\t/** anyOf/oneOf whose branches are all objects with a distinct required const on one key: the tag picks the branch. */\n\tprivate tagged(branches: readonly unknown[], base: string): Check | undefined {\n\t\tif (branches.length < 2) return undefined;\n\t\tconst resolved: SchemaObject[] = [];\n\t\tfor (const branch of branches) {\n\t\t\tif (!isSchemaObject(branch)) return undefined;\n\t\t\tconst ref = typeof branch.$ref === \"string\" && Object.keys(branch).length === 1 ? branch.$ref : undefined;\n\t\t\tconst node = ref === undefined ? branch : this.r.resolve(ref, this.r.baseFor(branch, base)).node;\n\t\t\tif (!isSchemaObject(node)) return undefined;\n\t\t\tresolved.push(node);\n\t\t}\n\t\tconst first = resolved[0].properties;\n\t\tif (!isSchemaObject(first)) return undefined;\n\t\tfor (const key of Object.keys(first)) {\n\t\t\tconst tags = resolved.map((s) => tagOf(s, key));\n\t\t\tif (tags.some((t) => t === undefined) || new Set(tags).size !== tags.length) continue;\n\t\t\treturn taggedCheck(\n\t\t\t\tkey,\n\t\t\t\ttags,\n\t\t\t\tbranches.map((s) => this.check(s, base)),\n\t\t\t);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate stringGroup(node: SchemaObject, strict: boolean): Check | undefined {\n\t\tconst min = number(node.minLength) ?? 0;\n\t\tconst max = number(node.maxLength) ?? Number.POSITIVE_INFINITY;\n\t\tconst re = typeof node.pattern === \"string\" ? sharedRegex(node.pattern) : undefined;\n\t\tconst format =\n\t\t\tthis.formats !== undefined && typeof node.format === \"string\" && Object.hasOwn(this.formats, node.format)\n\t\t\t\t? this.formats[node.format]\n\t\t\t\t: undefined;\n\t\tif (min === 0 && max === Number.POSITIVE_INFINITY && re === undefined && format === undefined) return undefined;\n\t\treturn stringCheck(strict, min, max, re, format);\n\t}\n\n\tprivate numberGroup(node: SchemaObject, mode: 0 | 1 | 2 | 3): Check | undefined {\n\t\tconst min = bound(node.minimum);\n\t\tconst max = bound(node.maximum);\n\t\tconst xmin = bound(node.exclusiveMinimum);\n\t\tconst xmax = bound(node.exclusiveMaximum);\n\t\tconst multipleOf = bound(node.multipleOf);\n\t\tif ([min, max, xmin, xmax, multipleOf].every((x) => x === undefined)) return undefined;\n\t\tconst inf = Number.POSITIVE_INFINITY;\n\t\treturn numberCheck(mode, min ?? -inf, max ?? inf, xmin ?? -inf, xmax ?? inf, multipleOf);\n\t}\n\n\tprivate objectGroup(node: SchemaObject, base: string, strict: boolean): Check | undefined {\n\t\tconst onlyCore = OBJECT_EXTRAS.every((k) => node[k] === undefined);\n\t\t// A schema with only the core object keywords gets one closure that also does the type guard.\n\t\tconst core = this.objectCore(node, base, onlyCore ? (strict ? GUARD_STRICT : GUARD_LOOSE) : GUARD_NONE);\n\t\tif (core !== undefined && onlyCore) return core;\n\t\tconst parts: Check[] = core === undefined ? [] : [core];\n\t\tif (node.propertyNames !== undefined) parts.push(propertyNamesCheck(this.check(node.propertyNames, base)));\n\t\tconst minProperties = number(node.minProperties);\n\t\tconst maxProperties = number(node.maxProperties);\n\t\tif (minProperties !== undefined || maxProperties !== undefined) {\n\t\t\tparts.push(propertyCountCheck(minProperties ?? 0, maxProperties ?? Number.POSITIVE_INFINITY));\n\t\t}\n\t\tconst dependentRequired: [string, string[]][] = [];\n\t\tconst dependentSchemas: [string, Check][] = [];\n\t\tif (this.draft !== \"7\") {\n\t\t\tfor (const [k, list] of entries(node.dependentRequired))\n\t\t\t\tif (Array.isArray(list)) dependentRequired.push([k, list]);\n\t\t\tfor (const [k, s] of entries(node.dependentSchemas)) dependentSchemas.push([k, this.check(s, base)]);\n\t\t}\n\t\tfor (const [k, d] of entries(node.dependencies)) {\n\t\t\tif (Array.isArray(d)) dependentRequired.push([k, d]);\n\t\t\telse dependentSchemas.push([k, this.check(d, base)]);\n\t\t}\n\t\tif (dependentRequired.length > 0) parts.push(dependentRequiredCheck(dependentRequired));\n\t\tif (dependentSchemas.length > 0) parts.push(dependentSchemasCheck(dependentSchemas));\n\t\tif (parts.length === 0) return strict ? IS_OBJECT : undefined;\n\t\treturn guardObject(and(parts), strict);\n\t}\n\n\tprivate objectCore(node: SchemaObject, base: string, guard: Guard): Check | undefined {\n\t\tconst properties = isSchemaObject(node.properties) ? node.properties : {};\n\t\tconst required = Array.isArray(node.required) ? node.required.filter((k) => typeof k === \"string\") : [];\n\t\tconst patterns = isSchemaObject(node.patternProperties) ? node.patternProperties : {};\n\t\tconst additional = node.additionalProperties;\n\t\tconst keys = Object.keys(properties);\n\t\tconst patternKeys = Object.keys(patterns);\n\t\tif (\n\t\t\tkeys.length + required.length + patternKeys.length === 0 &&\n\t\t\t(additional === undefined || additional === true)\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\t// One array per object: key, check (or a leaf's argument), flags (leaf code, required, key also names an\n\t\t// Object.prototype member).\n\t\tconst entries: unknown[] = [];\n\t\tfor (const k of keys) {\n\t\t\tconst check = this.check(properties[k], base);\n\t\t\tconst leaf = leafOf(check);\n\t\t\tconst flags =\n\t\t\t\t(leaf?.[0] ?? 0) | (required.includes(k) ? REQUIRED : 0) | (k in Object.prototype ? INHERITED : 0);\n\t\t\tentries.push(k, leaf === undefined ? check : leaf[1], flags);\n\t\t}\n\t\tconst extraRequired = required.filter((k) => !Object.hasOwn(properties, k));\n\t\tconst pats = patternKeys.map((p) => [sharedRegex(p), this.check(patterns[p], base)] as const);\n\t\tconst extra = additional === undefined || additional === true ? undefined : this.check(additional, base);\n\t\tif (pats.length === 0 && extraRequired.length === 0 && (extra === undefined || additional === false)) {\n\t\t\tconst requiredCount = keys.filter((k) => required.includes(k)).length;\n\t\t\treturn declaredObject(entries, requiredCount, additional === false, guard);\n\t\t}\n\t\treturn openObject(entries, keys, extraRequired, pats, extra, guard);\n\t}\n\n\tprivate arrayGroup(node: SchemaObject, base: string, strict: boolean): Check | undefined {\n\t\tlet prefix: readonly unknown[] = [];\n\t\tlet rest: unknown;\n\t\tif (Array.isArray(node.items)) {\n\t\t\tprefix = node.items;\n\t\t\trest = node.additionalItems;\n\t\t} else {\n\t\t\tif (this.draft !== \"7\" && Array.isArray(node.prefixItems)) prefix = node.prefixItems;\n\t\t\trest = node.items;\n\t\t}\n\t\tconst prefixChecks = prefix.map((s) => this.check(s, base));\n\t\tconst restCheck = rest === undefined || rest === true ? undefined : this.check(rest, base);\n\t\tconst minItems = number(node.minItems);\n\t\tconst maxItems = number(node.maxItems);\n\t\tif (\n\t\t\tnode.contains === undefined &&\n\t\t\tnode.uniqueItems !== true &&\n\t\t\t(prefixChecks.length > 0 || restCheck !== undefined)\n\t\t) {\n\t\t\t// The common array: one closure for the guard, the length bounds and the items.\n\t\t\tconst guard = strict ? GUARD_STRICT : GUARD_LOOSE;\n\t\t\treturn listCheck(guard, minItems ?? 0, maxItems ?? Number.POSITIVE_INFINITY, prefixChecks, restCheck);\n\t\t}\n\t\tconst parts: Check[] = [];\n\t\tif (prefixChecks.length > 0 || restCheck !== undefined) parts.push(itemsCheck(prefixChecks, restCheck));\n\t\tif (minItems !== undefined || maxItems !== undefined) {\n\t\t\tparts.push(lengthCheck(minItems ?? 0, maxItems ?? Number.POSITIVE_INFINITY));\n\t\t}\n\t\tif (node.contains !== undefined) {\n\t\t\tconst min = this.draft === \"7\" ? 1 : (number(node.minContains) ?? 1);\n\t\t\tconst max =\n\t\t\t\tthis.draft === \"7\" ? Number.POSITIVE_INFINITY : (number(node.maxContains) ?? Number.POSITIVE_INFINITY);\n\t\t\tparts.push(containsCheck(this.check(node.contains, base), min, max));\n\t\t}\n\t\tif (node.uniqueItems === true) parts.push(uniqueCheck);\n\t\tif (parts.length === 0) return strict ? IS_ARRAY : undefined;\n\t\treturn guardArray(and(parts), strict);\n\t}\n\n\t/** The annotating check of a schema evaluated in place (only below `unevaluatedProperties`/`unevaluatedItems`). */\n\tannotating(node: unknown, base: string): AnnotatingCheck {\n\t\tif (node === true) return ANNOTATING_TRUE;\n\t\tif (node === false) return ANNOTATING_FALSE;\n\t\tif (!isSchemaObject(node))\n\t\t\tthrow new Error(`A schema must be an object or a boolean, got ${JSON.stringify(node)}`);\n\t\tconst cached = this.annotatingCache.get(node);\n\t\tif (cached !== undefined) return cached;\n\t\tconst slot: { check: AnnotatingCheck | undefined } = { check: undefined };\n\t\tthis.annotatingCache.set(node, indirectAnnotating(slot));\n\t\tconst check = this.buildAnnotating(node, this.r.baseFor(node, base));\n\t\tslot.check = check;\n\t\tthis.annotatingCache.set(node, check);\n\t\treturn check;\n\t}\n\n\tprivate buildAnnotating(node: SchemaObject, base: string): AnnotatingCheck {\n\t\tconst rest: Record<string, unknown> = {};\n\t\tlet annotates = false;\n\t\tfor (const k of Object.keys(node)) {\n\t\t\tif (ANNOTATING.has(k)) annotates = true;\n\t\t\telse rest[k] = node[k];\n\t\t}\n\t\tconst plain = this.plain(rest, base);\n\t\tconst parts: AnnotatingCheck[] = [];\n\t\tif (annotates) this.annotatingParts(node, base, parts);\n\t\tconst all = parts.length === 0 ? ignoreAnnotations(plain) : annotateAll(plain, parts);\n\t\tconst own =\n\t\t\tnode.unevaluatedProperties !== undefined || node.unevaluatedItems !== undefined\n\t\t\t\t? isolateAnnotations(all)\n\t\t\t\t: all;\n\t\treturn this.dynamic && this.r.isResource(node, base) ? scopedAnnotating(this.scope, base, own) : own;\n\t}\n\n\tprivate annotatingParts(node: SchemaObject, base: string, parts: AnnotatingCheck[]): void {\n\t\tif (\n\t\t\tnode.properties !== undefined ||\n\t\t\tnode.patternProperties !== undefined ||\n\t\t\tnode.additionalProperties !== undefined\n\t\t) {\n\t\t\tconst props = entries(node.properties).map(([k, s]) => [k, this.check(s, base)] as const);\n\t\t\tconst pats = entries(node.patternProperties).map(([p, s]) => [sharedRegex(p), this.check(s, base)] as const);\n\t\t\tconst extra =\n\t\t\t\tnode.additionalProperties === undefined ? undefined : this.check(node.additionalProperties, base);\n\t\t\tparts.push(annotateObject(props, pats, extra));\n\t\t}\n\t\tif (node.prefixItems !== undefined || node.items !== undefined || node.contains !== undefined) {\n\t\t\tconst prefix = Array.isArray(node.prefixItems)\n\t\t\t\t? node.prefixItems\n\t\t\t\t: Array.isArray(node.items)\n\t\t\t\t\t? node.items\n\t\t\t\t\t: [];\n\t\t\tconst rest = Array.isArray(node.items) ? node.additionalItems : node.items;\n\t\t\tparts.push(\n\t\t\t\tannotateArray(\n\t\t\t\t\tprefix.map((s) => this.check(s, base)),\n\t\t\t\t\trest === undefined ? undefined : this.check(rest, base),\n\t\t\t\t\tnode.contains === undefined ? undefined : this.check(node.contains, base),\n\t\t\t\t\tnumber(node.minContains) ?? 1,\n\t\t\t\t\tnumber(node.maxContains) ?? Number.POSITIVE_INFINITY,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tif (Array.isArray(node.allOf)) for (const s of node.allOf) parts.push(this.annotating(s, base));\n\t\tif (Array.isArray(node.anyOf))\n\t\t\tparts.push(\n\t\t\t\tannotateAny(\n\t\t\t\t\tnode.anyOf.map((s) => this.annotating(s, base)),\n\t\t\t\t\tfalse,\n\t\t\t\t),\n\t\t\t);\n\t\tif (Array.isArray(node.oneOf))\n\t\t\tparts.push(\n\t\t\t\tannotateAny(\n\t\t\t\t\tnode.oneOf.map((s) => this.annotating(s, base)),\n\t\t\t\t\ttrue,\n\t\t\t\t),\n\t\t\t);\n\t\tif (node.if !== undefined) {\n\t\t\tconst then = node.then === undefined ? undefined : this.annotating(node.then, base);\n\t\t\tconst otherwise = node.else === undefined ? undefined : this.annotating(node.else, base);\n\t\t\tparts.push(annotateIf(this.annotating(node.if, base), then, otherwise));\n\t\t}\n\t\tif (typeof node.$ref === \"string\") parts.push(this.annotatingRef(node.$ref, base));\n\t\tif (typeof node.$dynamicRef === \"string\") parts.push(this.annotatingDynamicRef(node.$dynamicRef, base));\n\t\tfor (const [k, s] of entries(node.dependentSchemas)) parts.push(annotateDependent(k, this.annotating(s, base)));\n\t\tif (node.unevaluatedProperties !== undefined) {\n\t\t\tparts.push(unevaluatedProperties(this.check(node.unevaluatedProperties, base)));\n\t\t}\n\t\tif (node.unevaluatedItems !== undefined) parts.push(unevaluatedItems(this.check(node.unevaluatedItems, base)));\n\t}\n\n\tprivate annotatingRef(ref: string, base: string): AnnotatingCheck {\n\t\tconst target = this.r.resolve(ref, base);\n\t\tconst check = this.annotating(target.node, target.base);\n\t\treturn this.dynamic && target.base !== base ? scopedAnnotating(this.scope, target.base, check) : check;\n\t}\n\n\tprivate annotatingDynamicRef(ref: string, base: string): AnnotatingCheck {\n\t\tconst resolved = this.bookended(ref, base);\n\t\tif (resolved === undefined) return this.annotatingRef(ref, base);\n\t\tconst { initial, name } = resolved;\n\t\tconst fallback = this.annotating(initial.node, initial.base);\n\t\tconst lookup = this.dynamicLookup(name, (node, b) => this.annotating(node, b));\n\t\tconst scope = this.scope;\n\t\treturn (v, a) => {\n\t\t\tfor (let i = 0; i < scope.length; i++) {\n\t\t\t\tconst check = lookup(scope[i]);\n\t\t\t\tif (check !== null) return check(v, a);\n\t\t\t}\n\t\t\treturn fallback(v, a);\n\t\t};\n\t}\n}\n\n/** Keywords that never affect a check. */\nexport const NEUTRAL_KEYWORDS = new Set([\n\t\"$schema\",\n\t\"$comment\",\n\t\"title\",\n\t\"description\",\n\t\"default\",\n\t\"examples\",\n\t\"deprecated\",\n\t\"readOnly\",\n\t\"writeOnly\",\n\t\"$defs\",\n\t\"definitions\",\n\t\"contentEncoding\",\n\t\"contentMediaType\",\n\t\"minContains\",\n\t\"maxContains\",\n\t\"$vocabulary\",\n]);\n\n// The object keywords besides the core (properties, required, patternProperties, additionalProperties).\nconst OBJECT_EXTRAS = [\n\t\"propertyNames\",\n\t\"minProperties\",\n\t\"maxProperties\",\n\t\"dependentRequired\",\n\t\"dependentSchemas\",\n\t\"dependencies\",\n];\n\n// The keywords an annotating check handles itself; every other keyword compiles into its plain part.\nconst ANNOTATING = new Set([\n\t\"properties\",\n\t\"patternProperties\",\n\t\"additionalProperties\",\n\t\"prefixItems\",\n\t\"items\",\n\t\"additionalItems\",\n\t\"contains\",\n\t\"minContains\",\n\t\"maxContains\",\n\t\"allOf\",\n\t\"anyOf\",\n\t\"oneOf\",\n\t\"if\",\n\t\"then\",\n\t\"else\",\n\t\"$ref\",\n\t\"$dynamicRef\",\n\t\"dependentSchemas\",\n\t\"unevaluatedProperties\",\n\t\"unevaluatedItems\",\n]);\n\n/** anyOf/oneOf whose branches are all `{ const: primitive }`: an enum (distinct values make oneOf the same). */\nfunction constUnion(branches: readonly unknown[], exactlyOne: boolean): Check | undefined {\n\tconst values: unknown[] = [];\n\tfor (const branch of branches) {\n\t\tif (!isSchemaObject(branch) || !Object.hasOwn(branch, \"const\")) return undefined;\n\t\tfor (const k of Object.keys(branch)) if (k !== \"const\" && !NEUTRAL_KEYWORDS.has(k)) return undefined;\n\t\tif (typeof branch.const === \"object\" && branch.const !== null) return undefined;\n\t\tif (exactlyOne && values.includes(branch.const)) return undefined;\n\t\tvalues.push(branch.const);\n\t}\n\treturn enumCheck(values);\n}\n\n/** `anyOf`: its bare-type branches (`nullable` gives one) run as one type test. */\nfunction anyOf(checks: readonly Check[]): Check {\n\tconst types: string[] = [];\n\tconst rest: Check[] = [];\n\tfor (const check of checks) {\n\t\tconst type = BARE_TYPES.get(check);\n\t\tif (type === undefined) rest.push(check);\n\t\telse types.push(type);\n\t}\n\treturn types.length === 0 ? anyCheck(rest) : maskedAnyCheck(typeMask(types), rest);\n}\n\nconst BARE_TYPES: ReadonlyMap<Check, string> = new Map([...TYPE_CHECKS].map(([type, check]) => [check, type]));\n\n// The tag of a tagged-union branch: a primitive const on a required property of an object schema.\nfunction tagOf(branch: SchemaObject, key: string): unknown {\n\tconst properties = branch.properties;\n\tif (branch.type !== \"object\" || !Array.isArray(branch.required) || !branch.required.includes(key)) return undefined;\n\tconst tag = isSchemaObject(properties) ? properties[key] : undefined;\n\tif (!isSchemaObject(tag) || !Object.hasOwn(tag, \"const\")) return undefined;\n\treturn typeof tag.const === \"object\" && tag.const !== null ? undefined : tag.const;\n}\n\n/** A number keyword's value: a number, or a bigint (TypeBox's `Type.BigInt` bounds). */\nfunction bound(value: unknown): Bound | undefined {\n\treturn typeof value === \"number\" || typeof value === \"bigint\" ? value : undefined;\n}\n\nfunction number(value: unknown): number | undefined {\n\treturn typeof value === \"number\" ? value : undefined;\n}\n\nfunction entries(value: unknown): [string, unknown][] {\n\treturn isSchemaObject(value) ? Object.entries(value) : [];\n}\n"]}
|
package/dist/explain.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explain.d.ts","sourceRoot":"","sources":["../src/explain.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"explain.d.ts","sourceRoot":"","sources":["../src/explain.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,KAAK,EAAgB,eAAe,EAAE,MAAM,YAAY,CAAC;AAEhE,gDAAgD;AAChD,qBAAa,SAAS;IACrB,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAW;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC;;;OAGG;IACH,OAAO,CAAC,IAAI,CAAgG;IAE5G,YAAY,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAI9C;IAED,sEAAsE;IACtE,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,CASxC;IAED,OAAO,CAAC,EAAE;IAKV,OAAO,CAAC,IAAI;IAmDZ,OAAO,CAAC,OAAO;IA2Bf,OAAO,CAAC,UAAU;IAmBlB,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,UAAU;IA4DlB,OAAO,CAAC,SAAS;IAsCjB,OAAO,CAAC,SAAS;IA6CjB,8FAA8F;IAC9F,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,KAAK;IAiBb,OAAO,CAAC,eAAe;CAsBvB"}
|
package/dist/explain.js
CHANGED
|
@@ -71,7 +71,7 @@ export class Explainer {
|
|
|
71
71
|
this.walkString(node, v, push);
|
|
72
72
|
if (v instanceof Uint8Array && node.type === "bytes")
|
|
73
73
|
this.walkBytes(node, v, push);
|
|
74
|
-
if (typeof v === "number")
|
|
74
|
+
if (typeof v === "number" || typeof v === "bigint")
|
|
75
75
|
this.walkNumber(node, v, push);
|
|
76
76
|
if (isObject(v))
|
|
77
77
|
this.walkObject(node, b, v, path, out, push);
|
|
@@ -152,26 +152,29 @@ export class Explainer {
|
|
|
152
152
|
push("maxLength", `expected at most ${node.maxLength} bytes`);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
+
// Numbers and bigints alike: bounds of either kind compare with values of either kind.
|
|
155
156
|
walkNumber(node, v, push) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if (
|
|
164
|
-
push("exclusiveMaximum", `expected < ${
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
push("multipleOf", `expected a multiple of ${node.multipleOf}`);
|
|
168
|
-
}
|
|
157
|
+
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf } = node;
|
|
158
|
+
if (isBound(minimum) && v < minimum)
|
|
159
|
+
push("minimum", `expected >= ${minimum}`);
|
|
160
|
+
if (isBound(maximum) && v > maximum)
|
|
161
|
+
push("maximum", `expected <= ${maximum}`);
|
|
162
|
+
if (isBound(exclusiveMinimum) && v <= exclusiveMinimum)
|
|
163
|
+
push("exclusiveMinimum", `expected > ${exclusiveMinimum}`);
|
|
164
|
+
if (isBound(exclusiveMaximum) && v >= exclusiveMaximum)
|
|
165
|
+
push("exclusiveMaximum", `expected < ${exclusiveMaximum}`);
|
|
166
|
+
if (isBound(multipleOf) && !isMultiple(v, multipleOf))
|
|
167
|
+
push("multipleOf", `expected a multiple of ${multipleOf}`);
|
|
169
168
|
}
|
|
170
169
|
walkObject(node, b, v, path, out, push) {
|
|
171
170
|
const properties = isSchemaObject(node.properties) ? node.properties : {};
|
|
172
171
|
const required = Array.isArray(node.required) ? node.required : [];
|
|
173
172
|
for (const k of required) {
|
|
174
|
-
if (typeof k
|
|
173
|
+
if (typeof k !== "string")
|
|
174
|
+
continue;
|
|
175
|
+
// Present and set to undefined: missing unless its schema takes undefined (see declaredObject).
|
|
176
|
+
const accepted = v[k] === undefined && Object.hasOwn(properties, k) && this.ok(properties[k], b, undefined);
|
|
177
|
+
if (!Object.hasOwn(v, k) || (v[k] === undefined && !accepted))
|
|
175
178
|
push("required", "missing", pointer(path, k));
|
|
176
179
|
}
|
|
177
180
|
for (const k of Object.keys(properties)) {
|
|
@@ -300,12 +303,12 @@ export class Explainer {
|
|
|
300
303
|
}
|
|
301
304
|
/** How many of the keys of `v` the branch `s` (through a `$ref`) declares in `properties`. */
|
|
302
305
|
declaredKeys(s, b, v) {
|
|
303
|
-
const node = isSchemaObject(s) && typeof s.$ref === "string" ? this.c.r.resolve(s.$ref, b).node : s;
|
|
306
|
+
const node = isSchemaObject(s) && typeof s.$ref === "string" ? this.c.r.resolve(s.$ref, this.c.r.baseFor(s, b)).node : s;
|
|
304
307
|
const properties = isSchemaObject(node) && isSchemaObject(node.properties) ? node.properties : {};
|
|
305
308
|
return Object.keys(v).filter((k) => Object.hasOwn(properties, k)).length;
|
|
306
309
|
}
|
|
307
310
|
tagOf(branches, b) {
|
|
308
|
-
const resolved = branches.map((s) => isSchemaObject(s) && typeof s.$ref === "string" ? this.c.r.resolve(s.$ref, b).node : s);
|
|
311
|
+
const resolved = branches.map((s) => isSchemaObject(s) && typeof s.$ref === "string" ? this.c.r.resolve(s.$ref, this.c.r.baseFor(s, b)).node : s);
|
|
309
312
|
const first = resolved[0];
|
|
310
313
|
if (!isSchemaObject(first) || !isSchemaObject(first.properties))
|
|
311
314
|
return undefined;
|
|
@@ -321,7 +324,8 @@ export class Explainer {
|
|
|
321
324
|
return undefined;
|
|
322
325
|
}
|
|
323
326
|
walkUnevaluated(node, b, v, path, out) {
|
|
324
|
-
|
|
327
|
+
// `b` already applies the node's `$id`; the copy must not apply it again.
|
|
328
|
+
const { unevaluatedProperties, unevaluatedItems, $id: _id, ...rest } = node;
|
|
325
329
|
const a = newAnnotations();
|
|
326
330
|
this.c.annotating(rest, b)(v, a);
|
|
327
331
|
if (isObject(v) && unevaluatedProperties !== undefined && !a.allProps) {
|
|
@@ -364,6 +368,9 @@ function containsMessage(min, max) {
|
|
|
364
368
|
return `expected at most ${max} matching ${max === 1 ? "item" : "items"}`;
|
|
365
369
|
return `expected between ${min} and ${max} matching items`;
|
|
366
370
|
}
|
|
371
|
+
function isBound(value) {
|
|
372
|
+
return typeof value === "number" || typeof value === "bigint";
|
|
373
|
+
}
|
|
367
374
|
function pointer(path, key) {
|
|
368
375
|
return `${path}/${String(key).replace(/~/g, "~0").replace(/\//g, "~1")}`;
|
|
369
376
|
}
|
|
@@ -374,8 +381,12 @@ function typeName(v) {
|
|
|
374
381
|
return "array";
|
|
375
382
|
if (v instanceof Uint8Array)
|
|
376
383
|
return "bytes";
|
|
384
|
+
if (typeof v === "bigint")
|
|
385
|
+
return "bigint";
|
|
377
386
|
if (typeof v === "number" && Number.isInteger(v))
|
|
378
387
|
return "integer";
|
|
388
|
+
if (typeof v === "number" && !Number.isFinite(v))
|
|
389
|
+
return String(v);
|
|
379
390
|
return typeof v;
|
|
380
391
|
}
|
|
381
392
|
//# sourceMappingURL=explain.js.map
|
package/dist/explain.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explain.js","sourceRoot":"","sources":["../src/explain.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,6FAA6F;AAE7F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACN,UAAU,EACV,UAAU,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACV,QAAQ,EACR,KAAK,EACL,WAAW,EACX,WAAW,GACX,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,gDAAgD;AAChD,MAAM,OAAO,SAAS;IACJ,CAAC,CAAW;IACZ,MAAM,CAAU;IACjC;;;OAGG;IACK,IAAI,GAAsF,SAAS,CAAC;IAE5G,YAAY,QAAkB,EAAE,MAAe;QAC9C,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,QAAQ,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC;IAED,sEAAsE;IACtE,MAAM,CAAC,KAAc;QACpB,MAAM,GAAG,GAAsB,EAAE,CAAC;QAClC,IAAI,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;QAC3D,CAAC;gBAAS,CAAC;YACV,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACvB,CAAC;QACD,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,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AC9B,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,OAAO,CAAC;IACrC,IAAI,CAAC,YAAY,UAAU;QAAE,OAAO,OAAO,CAAC;IAC5C,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACnE,OAAO,OAAO,CAAC,CAAC;AACjB,CAAC","sourcesContent":["// Errors of a failed value: a walk over the schema that reports each failing keyword at the value it failed on.\n// It runs only for values that failed the check, using the compiler's checks for subschemas.\n\nimport { newAnnotations } from \"./annotations.ts\";\nimport {\n\tcodePoints,\n\tconstCheck,\n\tcontainsCheck,\n\tenumCheck,\n\tisMultiple,\n\tisObject,\n\tNEVER,\n\tTYPE_CHECKS,\n\tuniqueCheck,\n} from \"./checks.ts\";\nimport type { Compiler } from \"./compiler.ts\";\nimport { isSchemaObject } from \"./resolver.ts\";\nimport { sharedRegex } from \"./shared.ts\";\nimport type { SchemaObject, ValidationError } from \"./types.ts\";\n\n/** Explains failures of one compiled schema. */\nexport class Explainer {\n\tprivate readonly c: Compiler;\n\tprivate readonly schema: unknown;\n\t/**\n\t * The errors of `$ref` targets for object values, within one errors() call: a recursive union explains each branch\n\t * to pick the one to blame, and every branch would explain the same children again, exponentially in the depth.\n\t */\n\tprivate memo: Map<object, Map<object, { path: string; errors: ValidationError[] }>> | undefined = undefined;\n\n\tconstructor(compiler: Compiler, schema: unknown) {\n\t\tthis.c = compiler;\n\t\tthis.schema = schema;\n\t\tcompiler.root();\n\t}\n\n\t/** The errors of `value`, at least one (`value` failed the check). */\n\terrors(value: unknown): ValidationError[] {\n\t\tconst out: ValidationError[] = [];\n\t\ttry {\n\t\t\tthis.walk(this.schema, this.c.r.rootBase, value, \"\", out);\n\t\t} finally {\n\t\t\tthis.memo = undefined;\n\t\t}\n\t\tif (out.length === 0) out.push({ path: \"\", keyword: \"schema\", message: \"invalid\" });\n\t\treturn out;\n\t}\n\n\tprivate ok(node: unknown, base: string, v: unknown): boolean {\n\t\treturn this.c.check(node, base)(v);\n\t}\n\n\t// For $dynamicRef schemas this check runs outside the original dynamic scope, so their errors are approximate.\n\tprivate walk(node: unknown, base: string, v: unknown, path: string, out: ValidationError[]): void {\n\t\tif (node === true) return;\n\t\tif (node === false) {\n\t\t\tout.push({ path, keyword: \"false\", message: \"no value is allowed here\" });\n\t\t\treturn;\n\t\t}\n\t\tif (!isSchemaObject(node)) return;\n\t\tconst b = this.c.r.baseFor(node, base);\n\t\tif (this.ok(node, b, v)) return;\n\t\tconst start = out.length;\n\t\tconst push = (keyword: string, message: string, at = path) => {\n\t\t\tout.push({ path: at, keyword, message });\n\t\t};\n\t\tif (this.c.draft === \"7\" && typeof node.$ref === \"string\") {\n\t\t\tthis.walkRef(node.$ref, b, v, path, out);\n\t\t\treturn;\n\t\t}\n\t\tif (node.type !== undefined) {\n\t\t\tconst types = Array.isArray(node.type) ? node.type : [node.type];\n\t\t\tconst checks = types.map((t) => (typeof t === \"string\" ? TYPE_CHECKS.get(t) : undefined) ?? NEVER);\n\t\t\tif (!checks.some((check) => check(v))) {\n\t\t\t\tpush(\"type\", `expected ${types.join(\" or \")}, got ${typeName(v)}`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (Array.isArray(node.enum) && !enumCheck(node.enum)(v))\n\t\t\tpush(\"enum\", `expected one of ${listValues(node.enum)}`);\n\t\tif (Object.hasOwn(node, \"const\") && !constCheck(node.const)(v))\n\t\t\tpush(\"const\", `expected ${JSON.stringify(node.const)}`);\n\t\tif (typeof v === \"string\" && node.type !== \"bytes\") this.walkString(node, v, push);\n\t\tif (v instanceof Uint8Array && node.type === \"bytes\") this.walkBytes(node, v, push);\n\t\tif (typeof v === \"number\") this.walkNumber(node, v, push);\n\t\tif (isObject(v)) this.walkObject(node, b, v, path, out, push);\n\t\tif (Array.isArray(v)) this.walkArray(node, b, v, path, out, push);\n\t\tif (Array.isArray(node.allOf)) for (const s of node.allOf) this.walk(s, b, v, path, out);\n\t\tif (Array.isArray(node.anyOf)) this.walkUnion(node.anyOf, b, v, path, out, false);\n\t\tif (Array.isArray(node.oneOf)) this.walkUnion(node.oneOf, b, v, path, out, true);\n\t\tif (node.not !== undefined && this.ok(node.not, b, v)) push(\"not\", \"must not match the schema in not\");\n\t\tif (node.if !== undefined) {\n\t\t\tconst branch = this.ok(node.if, b, v) ? node.then : node.else;\n\t\t\tif (branch !== undefined) this.walk(branch, b, v, path, out);\n\t\t}\n\t\tif (typeof node.$ref === \"string\") this.walkRef(node.$ref, b, v, path, out);\n\t\tif (out.length === start && (node.unevaluatedProperties !== undefined || node.unevaluatedItems !== undefined)) {\n\t\t\tthis.walkUnevaluated(node, b, v, path, out);\n\t\t}\n\t\tif (out.length === start && typeof node.$dynamicRef === \"string\") {\n\t\t\tpush(\"$dynamicRef\", \"does not match the dynamically referenced schema\");\n\t\t}\n\t}\n\n\tprivate walkRef(ref: string, base: string, v: unknown, path: string, out: ValidationError[]): void {\n\t\tconst target = this.c.r.resolve(ref, base);\n\t\tif (target.node === false && this.c.r.isUnresolved(ref, base)) {\n\t\t\tout.push({ path, keyword: \"$ref\", message: `unresolved reference ${ref}` });\n\t\t\treturn;\n\t\t}\n\t\tif (!isSchemaObject(target.node) || typeof v !== \"object\" || v === null) {\n\t\t\tthis.walk(target.node, target.base, v, path, out);\n\t\t\treturn;\n\t\t}\n\t\tthis.memo ??= new Map();\n\t\tlet values = this.memo.get(target.node);\n\t\tconst known = values?.get(v);\n\t\tif (known !== undefined && known.path === path) {\n\t\t\tout.push(...known.errors);\n\t\t\treturn;\n\t\t}\n\t\tconst errors: ValidationError[] = [];\n\t\tthis.walk(target.node, target.base, v, path, errors);\n\t\tif (values === undefined) {\n\t\t\tvalues = new Map();\n\t\t\tthis.memo.set(target.node, values);\n\t\t}\n\t\tvalues.set(v, { path, errors });\n\t\tout.push(...errors);\n\t}\n\n\tprivate walkString(node: SchemaObject, v: string, push: Push): void {\n\t\tconst n = codePoints(v);\n\t\tif (typeof node.minLength === \"number\" && n < node.minLength) {\n\t\t\tpush(\"minLength\", `expected at least ${node.minLength} characters`);\n\t\t}\n\t\tif (typeof node.maxLength === \"number\" && n > node.maxLength) {\n\t\t\tpush(\"maxLength\", `expected at most ${node.maxLength} characters`);\n\t\t}\n\t\tif (typeof node.pattern === \"string\" && !sharedRegex(node.pattern).test(v)) {\n\t\t\tpush(\"pattern\", `expected to match ${node.pattern}`);\n\t\t}\n\t\tconst formats = this.c.formats;\n\t\tconst format =\n\t\t\tformats !== undefined && typeof node.format === \"string\" && Object.hasOwn(formats, node.format)\n\t\t\t\t? formats[node.format]\n\t\t\t\t: undefined;\n\t\tif (format !== undefined && !format(v)) push(\"format\", `expected format ${node.format}`);\n\t}\n\n\tprivate walkBytes(node: SchemaObject, v: Uint8Array, push: Push): void {\n\t\tif (typeof node.minLength === \"number\" && v.length < node.minLength) {\n\t\t\tpush(\"minLength\", `expected at least ${node.minLength} bytes`);\n\t\t}\n\t\tif (typeof node.maxLength === \"number\" && v.length > node.maxLength) {\n\t\t\tpush(\"maxLength\", `expected at most ${node.maxLength} bytes`);\n\t\t}\n\t}\n\n\tprivate walkNumber(node: SchemaObject, v: number, push: Push): void {\n\t\tif (typeof node.minimum === \"number\" && v < node.minimum) push(\"minimum\", `expected >= ${node.minimum}`);\n\t\tif (typeof node.maximum === \"number\" && v > node.maximum) push(\"maximum\", `expected <= ${node.maximum}`);\n\t\tif (typeof node.exclusiveMinimum === \"number\" && v <= node.exclusiveMinimum) {\n\t\t\tpush(\"exclusiveMinimum\", `expected > ${node.exclusiveMinimum}`);\n\t\t}\n\t\tif (typeof node.exclusiveMaximum === \"number\" && v >= node.exclusiveMaximum) {\n\t\t\tpush(\"exclusiveMaximum\", `expected < ${node.exclusiveMaximum}`);\n\t\t}\n\t\tif (typeof node.multipleOf === \"number\" && !isMultiple(v, node.multipleOf)) {\n\t\t\tpush(\"multipleOf\", `expected a multiple of ${node.multipleOf}`);\n\t\t}\n\t}\n\n\tprivate walkObject(\n\t\tnode: SchemaObject,\n\t\tb: string,\n\t\tv: Record<string, unknown>,\n\t\tpath: string,\n\t\tout: ValidationError[],\n\t\tpush: Push,\n\t): void {\n\t\tconst properties = isSchemaObject(node.properties) ? node.properties : {};\n\t\tconst required = Array.isArray(node.required) ? node.required : [];\n\t\tfor (const k of required) {\n\t\t\tif (typeof k === \"string\" && (!Object.hasOwn(v, k) || v[k] === undefined))\n\t\t\t\tpush(\"required\", \"missing\", pointer(path, k));\n\t\t}\n\t\tfor (const k of Object.keys(properties)) {\n\t\t\tif (Object.hasOwn(v, k) && v[k] !== undefined) this.walk(properties[k], b, v[k], pointer(path, k), out);\n\t\t}\n\t\tconst patterns = isSchemaObject(node.patternProperties) ? Object.entries(node.patternProperties) : [];\n\t\tfor (const k of Object.keys(v)) {\n\t\t\tlet matched = Object.hasOwn(properties, k);\n\t\t\tfor (const [p, s] of patterns) {\n\t\t\t\tif (sharedRegex(p).test(k)) {\n\t\t\t\t\tmatched = true;\n\t\t\t\t\tthis.walk(s, b, v[k], pointer(path, k), out);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!matched && node.additionalProperties !== undefined) {\n\t\t\t\tif (node.additionalProperties === false) push(\"additionalProperties\", \"unknown field\", pointer(path, k));\n\t\t\t\telse this.walk(node.additionalProperties, b, v[k], pointer(path, k), out);\n\t\t\t}\n\t\t\tif (node.propertyNames !== undefined && !this.ok(node.propertyNames, b, k)) {\n\t\t\t\tpush(\"propertyNames\", \"invalid property name\", pointer(path, k));\n\t\t\t}\n\t\t}\n\t\tconst count = Object.keys(v).length;\n\t\tif (typeof node.minProperties === \"number\" && count < node.minProperties) {\n\t\t\tpush(\"minProperties\", `expected at least ${node.minProperties} properties`);\n\t\t}\n\t\tif (typeof node.maxProperties === \"number\" && count > node.maxProperties) {\n\t\t\tpush(\"maxProperties\", `expected at most ${node.maxProperties} properties`);\n\t\t}\n\t\tconst dependencies = {\n\t\t\t...(this.c.draft === \"7\" || !isSchemaObject(node.dependentRequired) ? {} : node.dependentRequired),\n\t\t\t...(isSchemaObject(node.dependencies) ? node.dependencies : {}),\n\t\t};\n\t\tfor (const [k, d] of Object.entries(dependencies)) {\n\t\t\tif (!Object.hasOwn(v, k)) continue;\n\t\t\tif (!Array.isArray(d)) this.walk(d, b, v, path, out);\n\t\t\telse\n\t\t\t\tfor (const r of d)\n\t\t\t\t\tif (!Object.hasOwn(v, r)) push(\"dependentRequired\", `required when ${k} is present`, pointer(path, r));\n\t\t}\n\t\tif (this.c.draft !== \"7\" && isSchemaObject(node.dependentSchemas)) {\n\t\t\tfor (const [k, s] of Object.entries(node.dependentSchemas))\n\t\t\t\tif (Object.hasOwn(v, k)) this.walk(s, b, v, path, out);\n\t\t}\n\t}\n\n\tprivate walkArray(\n\t\tnode: SchemaObject,\n\t\tb: string,\n\t\tv: unknown[],\n\t\tpath: string,\n\t\tout: ValidationError[],\n\t\tpush: Push,\n\t): void {\n\t\tlet prefix: readonly unknown[] = [];\n\t\tlet rest: unknown;\n\t\tif (Array.isArray(node.items)) {\n\t\t\tprefix = node.items;\n\t\t\trest = node.additionalItems;\n\t\t} else {\n\t\t\tif (this.c.draft !== \"7\" && Array.isArray(node.prefixItems)) prefix = node.prefixItems;\n\t\t\trest = node.items;\n\t\t}\n\t\tfor (let i = 0; i < v.length; i++) {\n\t\t\tconst s = i < prefix.length ? prefix[i] : rest;\n\t\t\tif (s !== undefined) this.walk(s, b, v[i], `${path}/${i}`, out);\n\t\t}\n\t\tif (typeof node.minItems === \"number\" && v.length < node.minItems) {\n\t\t\tpush(\"minItems\", `expected at least ${node.minItems} items`);\n\t\t}\n\t\tif (typeof node.maxItems === \"number\" && v.length > node.maxItems) {\n\t\t\tpush(\"maxItems\", `expected at most ${node.maxItems} items`);\n\t\t}\n\t\tif (node.uniqueItems === true && !uniqueCheck(v)) push(\"uniqueItems\", \"expected unique items\");\n\t\tif (node.contains !== undefined) {\n\t\t\tconst draft7 = this.c.draft === \"7\";\n\t\t\tconst min = draft7 || typeof node.minContains !== \"number\" ? 1 : node.minContains;\n\t\t\tconst max = draft7 || typeof node.maxContains !== \"number\" ? Number.POSITIVE_INFINITY : node.maxContains;\n\t\t\tif (!containsCheck(this.c.check(node.contains, b), min, max)(v)) {\n\t\t\t\tpush(\"contains\", containsMessage(min, max));\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate walkUnion(\n\t\tbranches: readonly unknown[],\n\t\tb: string,\n\t\tv: unknown,\n\t\tpath: string,\n\t\tout: ValidationError[],\n\t\texactlyOne: boolean,\n\t): void {\n\t\tconst matches = branches.filter((s) => this.ok(s, b, v)).length;\n\t\tif (matches === 1 || (!exactlyOne && matches > 0)) return;\n\t\tconst keyword = exactlyOne ? \"oneOf\" : \"anyOf\";\n\t\tif (matches > 1) {\n\t\t\tout.push({ path, keyword, message: \"matches more than one alternative\" });\n\t\t\treturn;\n\t\t}\n\t\t// A tagged union reports the branch its tag selects; otherwise the branch whose first error is deepest.\n\t\tconst tag = this.tagOf(branches, b);\n\t\tif (tag !== undefined && isObject(v)) {\n\t\t\tconst i = tag.values.indexOf(v[tag.key]);\n\t\t\tif (i < 0)\n\t\t\t\tout.push({\n\t\t\t\t\tpath: pointer(path, tag.key),\n\t\t\t\t\tkeyword,\n\t\t\t\t\tmessage: `expected one of ${listValues(tag.values)}`,\n\t\t\t\t});\n\t\t\telse this.walk(branches[i], b, v, path, out);\n\t\t\treturn;\n\t\t}\n\t\t// An object is blamed on the branch that declares most of its properties (the one it was most likely meant for),\n\t\t// then on the branch whose first error is deepest.\n\t\tlet best: { errors: ValidationError[]; declared: number } | undefined;\n\t\tfor (const s of branches) {\n\t\t\tconst errors: ValidationError[] = [];\n\t\t\tthis.walk(s, b, v, path, errors);\n\t\t\tif (errors.length === 0) continue;\n\t\t\tconst declared = isObject(v) ? this.declaredKeys(s, b, v) : 0;\n\t\t\tconst better =\n\t\t\t\tbest === undefined ||\n\t\t\t\tdeclared > best.declared ||\n\t\t\t\t(declared === best.declared && errors[0].path.length > best.errors[0].path.length);\n\t\t\tif (better) best = { errors, declared };\n\t\t}\n\t\tout.push(...(best?.errors ?? [{ path, keyword, message: \"matches no alternative\" }]));\n\t}\n\n\t/** How many of the keys of `v` the branch `s` (through a `$ref`) declares in `properties`. */\n\tprivate declaredKeys(s: unknown, b: string, v: Record<string, unknown>): number {\n\t\tconst node = isSchemaObject(s) && typeof s.$ref === \"string\" ? this.c.r.resolve(s.$ref, b).node : s;\n\t\tconst properties = isSchemaObject(node) && isSchemaObject(node.properties) ? node.properties : {};\n\t\treturn Object.keys(v).filter((k) => Object.hasOwn(properties, k)).length;\n\t}\n\n\tprivate tagOf(branches: readonly unknown[], b: string): { key: string; values: unknown[] } | undefined {\n\t\tconst resolved = branches.map((s) =>\n\t\t\tisSchemaObject(s) && typeof s.$ref === \"string\" ? this.c.r.resolve(s.$ref, b).node : s,\n\t\t);\n\t\tconst first = resolved[0];\n\t\tif (!isSchemaObject(first) || !isSchemaObject(first.properties)) return undefined;\n\t\tfor (const key of Object.keys(first.properties)) {\n\t\t\tconst values = resolved.map((s) => {\n\t\t\t\tconst tag = isSchemaObject(s) && isSchemaObject(s.properties) ? s.properties[key] : undefined;\n\t\t\t\treturn isSchemaObject(tag) ? tag.const : undefined;\n\t\t\t});\n\t\t\tconst primitive = values.every((x) => x !== undefined && (typeof x !== \"object\" || x === null));\n\t\t\tif (primitive && new Set(values).size === values.length) return { key, values };\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate walkUnevaluated(node: SchemaObject, b: string, v: unknown, path: string, out: ValidationError[]): void {\n\t\tconst { unevaluatedProperties, unevaluatedItems, ...rest } = node;\n\t\tconst a = newAnnotations();\n\t\tthis.c.annotating(rest, b)(v, a);\n\t\tif (isObject(v) && unevaluatedProperties !== undefined && !a.allProps) {\n\t\t\tfor (const k of Object.keys(v)) {\n\t\t\t\tif (a.props?.has(k)) continue;\n\t\t\t\tif (unevaluatedProperties === false) {\n\t\t\t\t\tout.push({ path: pointer(path, k), keyword: \"unevaluatedProperties\", message: \"unknown field\" });\n\t\t\t\t} else this.walk(unevaluatedProperties, b, v[k], pointer(path, k), out);\n\t\t\t}\n\t\t}\n\t\tif (Array.isArray(v) && unevaluatedItems !== undefined && !a.allItems) {\n\t\t\tfor (let i = a.items; i < v.length; i++) {\n\t\t\t\tif (a.indexes?.has(i)) continue;\n\t\t\t\tif (unevaluatedItems === false) {\n\t\t\t\t\tout.push({ path: `${path}/${i}`, keyword: \"unevaluatedItems\", message: \"unexpected item\" });\n\t\t\t\t} else this.walk(unevaluatedItems, b, v[i], `${path}/${i}`, out);\n\t\t\t}\n\t\t}\n\t}\n}\n\ntype Push = (keyword: string, message: string, at?: string) => void;\n\n// Enum errors name the allowed values; a long list (an enum of thousands) is cut, so the message stays readable.\nconst LISTED_VALUES = 20;\n\n/** `values` as JSON, at most LISTED_VALUES of them, then how many more there are. */\nfunction listValues(values: readonly unknown[]): string {\n\tif (values.length <= LISTED_VALUES) return JSON.stringify(values);\n\tconst listed = JSON.stringify(values.slice(0, LISTED_VALUES));\n\treturn `${listed.slice(0, -1)}, ... and ${values.length - LISTED_VALUES} more]`;\n}\n\nfunction containsMessage(min: number, max: number): string {\n\tif (max === Number.POSITIVE_INFINITY) return `expected at least ${min} matching ${min === 1 ? \"item\" : \"items\"}`;\n\tif (min === 0) return `expected at most ${max} matching ${max === 1 ? \"item\" : \"items\"}`;\n\treturn `expected between ${min} and ${max} matching items`;\n}\n\nfunction pointer(path: string, key: string | number): string {\n\treturn `${path}/${String(key).replace(/~/g, \"~0\").replace(/\\//g, \"~1\")}`;\n}\n\nfunction typeName(v: unknown): string {\n\tif (v === null) return \"null\";\n\tif (Array.isArray(v)) return \"array\";\n\tif (v instanceof Uint8Array) return \"bytes\";\n\tif (typeof v === \"number\" && Number.isInteger(v)) return \"integer\";\n\treturn typeof v;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"explain.js","sourceRoot":"","sources":["../src/explain.ts"],"names":[],"mappings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AAE,GAAoB;IAClD,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,SAAS,QAAQ,CAAC,CAAU;IAC3B,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,OAAO,CAAC;IACrC,IAAI,CAAC,YAAY,UAAU;QAAE,OAAO,OAAO,CAAC;IAC5C,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC3C,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACnE,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACnE,OAAO,OAAO,CAAC,CAAC;AACjB,CAAC","sourcesContent":["// Errors of a failed value: a walk over the schema that reports each failing keyword at the value it failed on.\n// It runs only for values that failed the check, using the compiler's checks for subschemas.\n\nimport { newAnnotations } from \"./annotations.ts\";\nimport {\n\ttype Bound,\n\tcodePoints,\n\tconstCheck,\n\tcontainsCheck,\n\tenumCheck,\n\tisMultiple,\n\tisObject,\n\tNEVER,\n\tTYPE_CHECKS,\n\tuniqueCheck,\n} from \"./checks.ts\";\nimport type { Compiler } from \"./compiler.ts\";\nimport { isSchemaObject } from \"./resolver.ts\";\nimport { sharedRegex } from \"./shared.ts\";\nimport type { SchemaObject, ValidationError } from \"./types.ts\";\n\n/** Explains failures of one compiled schema. */\nexport class Explainer {\n\tprivate readonly c: Compiler;\n\tprivate readonly schema: unknown;\n\t/**\n\t * The errors of `$ref` targets for object values, within one errors() call: a recursive union explains each branch\n\t * to pick the one to blame, and every branch would explain the same children again, exponentially in the depth.\n\t */\n\tprivate memo: Map<object, Map<object, { path: string; errors: ValidationError[] }>> | undefined = undefined;\n\n\tconstructor(compiler: Compiler, schema: unknown) {\n\t\tthis.c = compiler;\n\t\tthis.schema = schema;\n\t\tcompiler.root();\n\t}\n\n\t/** The errors of `value`, at least one (`value` failed the check). */\n\terrors(value: unknown): ValidationError[] {\n\t\tconst out: ValidationError[] = [];\n\t\ttry {\n\t\t\tthis.walk(this.schema, this.c.r.rootBase, value, \"\", out);\n\t\t} finally {\n\t\t\tthis.memo = undefined;\n\t\t}\n\t\tif (out.length === 0) out.push({ path: \"\", keyword: \"schema\", message: \"invalid\" });\n\t\treturn out;\n\t}\n\n\tprivate ok(node: unknown, base: string, v: unknown): boolean {\n\t\treturn this.c.check(node, base)(v);\n\t}\n\n\t// For $dynamicRef schemas this check runs outside the original dynamic scope, so their errors are approximate.\n\tprivate walk(node: unknown, base: string, v: unknown, path: string, out: ValidationError[]): void {\n\t\tif (node === true) return;\n\t\tif (node === false) {\n\t\t\tout.push({ path, keyword: \"false\", message: \"no value is allowed here\" });\n\t\t\treturn;\n\t\t}\n\t\tif (!isSchemaObject(node)) return;\n\t\tconst b = this.c.r.baseFor(node, base);\n\t\tif (this.ok(node, b, v)) return;\n\t\tconst start = out.length;\n\t\tconst push = (keyword: string, message: string, at = path) => {\n\t\t\tout.push({ path: at, keyword, message });\n\t\t};\n\t\tif (this.c.draft === \"7\" && typeof node.$ref === \"string\") {\n\t\t\tthis.walkRef(node.$ref, b, v, path, out);\n\t\t\treturn;\n\t\t}\n\t\tif (node.type !== undefined) {\n\t\t\tconst types = Array.isArray(node.type) ? node.type : [node.type];\n\t\t\tconst checks = types.map((t) => (typeof t === \"string\" ? TYPE_CHECKS.get(t) : undefined) ?? NEVER);\n\t\t\tif (!checks.some((check) => check(v))) {\n\t\t\t\tpush(\"type\", `expected ${types.join(\" or \")}, got ${typeName(v)}`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (Array.isArray(node.enum) && !enumCheck(node.enum)(v))\n\t\t\tpush(\"enum\", `expected one of ${listValues(node.enum)}`);\n\t\tif (Object.hasOwn(node, \"const\") && !constCheck(node.const)(v))\n\t\t\tpush(\"const\", `expected ${JSON.stringify(node.const)}`);\n\t\tif (typeof v === \"string\" && node.type !== \"bytes\") this.walkString(node, v, push);\n\t\tif (v instanceof Uint8Array && node.type === \"bytes\") this.walkBytes(node, v, push);\n\t\tif (typeof v === \"number\" || typeof v === \"bigint\") this.walkNumber(node, v, push);\n\t\tif (isObject(v)) this.walkObject(node, b, v, path, out, push);\n\t\tif (Array.isArray(v)) this.walkArray(node, b, v, path, out, push);\n\t\tif (Array.isArray(node.allOf)) for (const s of node.allOf) this.walk(s, b, v, path, out);\n\t\tif (Array.isArray(node.anyOf)) this.walkUnion(node.anyOf, b, v, path, out, false);\n\t\tif (Array.isArray(node.oneOf)) this.walkUnion(node.oneOf, b, v, path, out, true);\n\t\tif (node.not !== undefined && this.ok(node.not, b, v)) push(\"not\", \"must not match the schema in not\");\n\t\tif (node.if !== undefined) {\n\t\t\tconst branch = this.ok(node.if, b, v) ? node.then : node.else;\n\t\t\tif (branch !== undefined) this.walk(branch, b, v, path, out);\n\t\t}\n\t\tif (typeof node.$ref === \"string\") this.walkRef(node.$ref, b, v, path, out);\n\t\tif (out.length === start && (node.unevaluatedProperties !== undefined || node.unevaluatedItems !== undefined)) {\n\t\t\tthis.walkUnevaluated(node, b, v, path, out);\n\t\t}\n\t\tif (out.length === start && typeof node.$dynamicRef === \"string\") {\n\t\t\tpush(\"$dynamicRef\", \"does not match the dynamically referenced schema\");\n\t\t}\n\t}\n\n\tprivate walkRef(ref: string, base: string, v: unknown, path: string, out: ValidationError[]): void {\n\t\tconst target = this.c.r.resolve(ref, base);\n\t\tif (target.node === false && this.c.r.isUnresolved(ref, base)) {\n\t\t\tout.push({ path, keyword: \"$ref\", message: `unresolved reference ${ref}` });\n\t\t\treturn;\n\t\t}\n\t\tif (!isSchemaObject(target.node) || typeof v !== \"object\" || v === null) {\n\t\t\tthis.walk(target.node, target.base, v, path, out);\n\t\t\treturn;\n\t\t}\n\t\tthis.memo ??= new Map();\n\t\tlet values = this.memo.get(target.node);\n\t\tconst known = values?.get(v);\n\t\tif (known !== undefined && known.path === path) {\n\t\t\tout.push(...known.errors);\n\t\t\treturn;\n\t\t}\n\t\tconst errors: ValidationError[] = [];\n\t\tthis.walk(target.node, target.base, v, path, errors);\n\t\tif (values === undefined) {\n\t\t\tvalues = new Map();\n\t\t\tthis.memo.set(target.node, values);\n\t\t}\n\t\tvalues.set(v, { path, errors });\n\t\tout.push(...errors);\n\t}\n\n\tprivate walkString(node: SchemaObject, v: string, push: Push): void {\n\t\tconst n = codePoints(v);\n\t\tif (typeof node.minLength === \"number\" && n < node.minLength) {\n\t\t\tpush(\"minLength\", `expected at least ${node.minLength} characters`);\n\t\t}\n\t\tif (typeof node.maxLength === \"number\" && n > node.maxLength) {\n\t\t\tpush(\"maxLength\", `expected at most ${node.maxLength} characters`);\n\t\t}\n\t\tif (typeof node.pattern === \"string\" && !sharedRegex(node.pattern).test(v)) {\n\t\t\tpush(\"pattern\", `expected to match ${node.pattern}`);\n\t\t}\n\t\tconst formats = this.c.formats;\n\t\tconst format =\n\t\t\tformats !== undefined && typeof node.format === \"string\" && Object.hasOwn(formats, node.format)\n\t\t\t\t? formats[node.format]\n\t\t\t\t: undefined;\n\t\tif (format !== undefined && !format(v)) push(\"format\", `expected format ${node.format}`);\n\t}\n\n\tprivate walkBytes(node: SchemaObject, v: Uint8Array, push: Push): void {\n\t\tif (typeof node.minLength === \"number\" && v.length < node.minLength) {\n\t\t\tpush(\"minLength\", `expected at least ${node.minLength} bytes`);\n\t\t}\n\t\tif (typeof node.maxLength === \"number\" && v.length > node.maxLength) {\n\t\t\tpush(\"maxLength\", `expected at most ${node.maxLength} bytes`);\n\t\t}\n\t}\n\n\t// Numbers and bigints alike: bounds of either kind compare with values of either kind.\n\tprivate walkNumber(node: SchemaObject, v: Bound, push: Push): void {\n\t\tconst { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf } = node;\n\t\tif (isBound(minimum) && v < minimum) push(\"minimum\", `expected >= ${minimum}`);\n\t\tif (isBound(maximum) && v > maximum) push(\"maximum\", `expected <= ${maximum}`);\n\t\tif (isBound(exclusiveMinimum) && v <= exclusiveMinimum)\n\t\t\tpush(\"exclusiveMinimum\", `expected > ${exclusiveMinimum}`);\n\t\tif (isBound(exclusiveMaximum) && v >= exclusiveMaximum)\n\t\t\tpush(\"exclusiveMaximum\", `expected < ${exclusiveMaximum}`);\n\t\tif (isBound(multipleOf) && !isMultiple(v, multipleOf)) push(\"multipleOf\", `expected a multiple of ${multipleOf}`);\n\t}\n\n\tprivate walkObject(\n\t\tnode: SchemaObject,\n\t\tb: string,\n\t\tv: Record<string, unknown>,\n\t\tpath: string,\n\t\tout: ValidationError[],\n\t\tpush: Push,\n\t): void {\n\t\tconst properties = isSchemaObject(node.properties) ? node.properties : {};\n\t\tconst required = Array.isArray(node.required) ? node.required : [];\n\t\tfor (const k of required) {\n\t\t\tif (typeof k !== \"string\") continue;\n\t\t\t// Present and set to undefined: missing unless its schema takes undefined (see declaredObject).\n\t\t\tconst accepted = v[k] === undefined && Object.hasOwn(properties, k) && this.ok(properties[k], b, undefined);\n\t\t\tif (!Object.hasOwn(v, k) || (v[k] === undefined && !accepted)) push(\"required\", \"missing\", pointer(path, k));\n\t\t}\n\t\tfor (const k of Object.keys(properties)) {\n\t\t\tif (Object.hasOwn(v, k) && v[k] !== undefined) this.walk(properties[k], b, v[k], pointer(path, k), out);\n\t\t}\n\t\tconst patterns = isSchemaObject(node.patternProperties) ? Object.entries(node.patternProperties) : [];\n\t\tfor (const k of Object.keys(v)) {\n\t\t\tlet matched = Object.hasOwn(properties, k);\n\t\t\tfor (const [p, s] of patterns) {\n\t\t\t\tif (sharedRegex(p).test(k)) {\n\t\t\t\t\tmatched = true;\n\t\t\t\t\tthis.walk(s, b, v[k], pointer(path, k), out);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!matched && node.additionalProperties !== undefined) {\n\t\t\t\tif (node.additionalProperties === false) push(\"additionalProperties\", \"unknown field\", pointer(path, k));\n\t\t\t\telse this.walk(node.additionalProperties, b, v[k], pointer(path, k), out);\n\t\t\t}\n\t\t\tif (node.propertyNames !== undefined && !this.ok(node.propertyNames, b, k)) {\n\t\t\t\tpush(\"propertyNames\", \"invalid property name\", pointer(path, k));\n\t\t\t}\n\t\t}\n\t\tconst count = Object.keys(v).length;\n\t\tif (typeof node.minProperties === \"number\" && count < node.minProperties) {\n\t\t\tpush(\"minProperties\", `expected at least ${node.minProperties} properties`);\n\t\t}\n\t\tif (typeof node.maxProperties === \"number\" && count > node.maxProperties) {\n\t\t\tpush(\"maxProperties\", `expected at most ${node.maxProperties} properties`);\n\t\t}\n\t\tconst dependencies = {\n\t\t\t...(this.c.draft === \"7\" || !isSchemaObject(node.dependentRequired) ? {} : node.dependentRequired),\n\t\t\t...(isSchemaObject(node.dependencies) ? node.dependencies : {}),\n\t\t};\n\t\tfor (const [k, d] of Object.entries(dependencies)) {\n\t\t\tif (!Object.hasOwn(v, k)) continue;\n\t\t\tif (!Array.isArray(d)) this.walk(d, b, v, path, out);\n\t\t\telse\n\t\t\t\tfor (const r of d)\n\t\t\t\t\tif (!Object.hasOwn(v, r)) push(\"dependentRequired\", `required when ${k} is present`, pointer(path, r));\n\t\t}\n\t\tif (this.c.draft !== \"7\" && isSchemaObject(node.dependentSchemas)) {\n\t\t\tfor (const [k, s] of Object.entries(node.dependentSchemas))\n\t\t\t\tif (Object.hasOwn(v, k)) this.walk(s, b, v, path, out);\n\t\t}\n\t}\n\n\tprivate walkArray(\n\t\tnode: SchemaObject,\n\t\tb: string,\n\t\tv: unknown[],\n\t\tpath: string,\n\t\tout: ValidationError[],\n\t\tpush: Push,\n\t): void {\n\t\tlet prefix: readonly unknown[] = [];\n\t\tlet rest: unknown;\n\t\tif (Array.isArray(node.items)) {\n\t\t\tprefix = node.items;\n\t\t\trest = node.additionalItems;\n\t\t} else {\n\t\t\tif (this.c.draft !== \"7\" && Array.isArray(node.prefixItems)) prefix = node.prefixItems;\n\t\t\trest = node.items;\n\t\t}\n\t\tfor (let i = 0; i < v.length; i++) {\n\t\t\tconst s = i < prefix.length ? prefix[i] : rest;\n\t\t\tif (s !== undefined) this.walk(s, b, v[i], `${path}/${i}`, out);\n\t\t}\n\t\tif (typeof node.minItems === \"number\" && v.length < node.minItems) {\n\t\t\tpush(\"minItems\", `expected at least ${node.minItems} items`);\n\t\t}\n\t\tif (typeof node.maxItems === \"number\" && v.length > node.maxItems) {\n\t\t\tpush(\"maxItems\", `expected at most ${node.maxItems} items`);\n\t\t}\n\t\tif (node.uniqueItems === true && !uniqueCheck(v)) push(\"uniqueItems\", \"expected unique items\");\n\t\tif (node.contains !== undefined) {\n\t\t\tconst draft7 = this.c.draft === \"7\";\n\t\t\tconst min = draft7 || typeof node.minContains !== \"number\" ? 1 : node.minContains;\n\t\t\tconst max = draft7 || typeof node.maxContains !== \"number\" ? Number.POSITIVE_INFINITY : node.maxContains;\n\t\t\tif (!containsCheck(this.c.check(node.contains, b), min, max)(v)) {\n\t\t\t\tpush(\"contains\", containsMessage(min, max));\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate walkUnion(\n\t\tbranches: readonly unknown[],\n\t\tb: string,\n\t\tv: unknown,\n\t\tpath: string,\n\t\tout: ValidationError[],\n\t\texactlyOne: boolean,\n\t): void {\n\t\tconst matches = branches.filter((s) => this.ok(s, b, v)).length;\n\t\tif (matches === 1 || (!exactlyOne && matches > 0)) return;\n\t\tconst keyword = exactlyOne ? \"oneOf\" : \"anyOf\";\n\t\tif (matches > 1) {\n\t\t\tout.push({ path, keyword, message: \"matches more than one alternative\" });\n\t\t\treturn;\n\t\t}\n\t\t// A tagged union reports the branch its tag selects; otherwise the branch whose first error is deepest.\n\t\tconst tag = this.tagOf(branches, b);\n\t\tif (tag !== undefined && isObject(v)) {\n\t\t\tconst i = tag.values.indexOf(v[tag.key]);\n\t\t\tif (i < 0)\n\t\t\t\tout.push({\n\t\t\t\t\tpath: pointer(path, tag.key),\n\t\t\t\t\tkeyword,\n\t\t\t\t\tmessage: `expected one of ${listValues(tag.values)}`,\n\t\t\t\t});\n\t\t\telse this.walk(branches[i], b, v, path, out);\n\t\t\treturn;\n\t\t}\n\t\t// An object is blamed on the branch that declares most of its properties (the one it was most likely meant for),\n\t\t// then on the branch whose first error is deepest.\n\t\tlet best: { errors: ValidationError[]; declared: number } | undefined;\n\t\tfor (const s of branches) {\n\t\t\tconst errors: ValidationError[] = [];\n\t\t\tthis.walk(s, b, v, path, errors);\n\t\t\tif (errors.length === 0) continue;\n\t\t\tconst declared = isObject(v) ? this.declaredKeys(s, b, v) : 0;\n\t\t\tconst better =\n\t\t\t\tbest === undefined ||\n\t\t\t\tdeclared > best.declared ||\n\t\t\t\t(declared === best.declared && errors[0].path.length > best.errors[0].path.length);\n\t\t\tif (better) best = { errors, declared };\n\t\t}\n\t\tout.push(...(best?.errors ?? [{ path, keyword, message: \"matches no alternative\" }]));\n\t}\n\n\t/** How many of the keys of `v` the branch `s` (through a `$ref`) declares in `properties`. */\n\tprivate declaredKeys(s: unknown, b: string, v: Record<string, unknown>): number {\n\t\tconst node =\n\t\t\tisSchemaObject(s) && typeof s.$ref === \"string\" ? this.c.r.resolve(s.$ref, this.c.r.baseFor(s, b)).node : s;\n\t\tconst properties = isSchemaObject(node) && isSchemaObject(node.properties) ? node.properties : {};\n\t\treturn Object.keys(v).filter((k) => Object.hasOwn(properties, k)).length;\n\t}\n\n\tprivate tagOf(branches: readonly unknown[], b: string): { key: string; values: unknown[] } | undefined {\n\t\tconst resolved = branches.map((s) =>\n\t\t\tisSchemaObject(s) && typeof s.$ref === \"string\" ? this.c.r.resolve(s.$ref, this.c.r.baseFor(s, b)).node : s,\n\t\t);\n\t\tconst first = resolved[0];\n\t\tif (!isSchemaObject(first) || !isSchemaObject(first.properties)) return undefined;\n\t\tfor (const key of Object.keys(first.properties)) {\n\t\t\tconst values = resolved.map((s) => {\n\t\t\t\tconst tag = isSchemaObject(s) && isSchemaObject(s.properties) ? s.properties[key] : undefined;\n\t\t\t\treturn isSchemaObject(tag) ? tag.const : undefined;\n\t\t\t});\n\t\t\tconst primitive = values.every((x) => x !== undefined && (typeof x !== \"object\" || x === null));\n\t\t\tif (primitive && new Set(values).size === values.length) return { key, values };\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate walkUnevaluated(node: SchemaObject, b: string, v: unknown, path: string, out: ValidationError[]): void {\n\t\t// `b` already applies the node's `$id`; the copy must not apply it again.\n\t\tconst { unevaluatedProperties, unevaluatedItems, $id: _id, ...rest } = node;\n\t\tconst a = newAnnotations();\n\t\tthis.c.annotating(rest, b)(v, a);\n\t\tif (isObject(v) && unevaluatedProperties !== undefined && !a.allProps) {\n\t\t\tfor (const k of Object.keys(v)) {\n\t\t\t\tif (a.props?.has(k)) continue;\n\t\t\t\tif (unevaluatedProperties === false) {\n\t\t\t\t\tout.push({ path: pointer(path, k), keyword: \"unevaluatedProperties\", message: \"unknown field\" });\n\t\t\t\t} else this.walk(unevaluatedProperties, b, v[k], pointer(path, k), out);\n\t\t\t}\n\t\t}\n\t\tif (Array.isArray(v) && unevaluatedItems !== undefined && !a.allItems) {\n\t\t\tfor (let i = a.items; i < v.length; i++) {\n\t\t\t\tif (a.indexes?.has(i)) continue;\n\t\t\t\tif (unevaluatedItems === false) {\n\t\t\t\t\tout.push({ path: `${path}/${i}`, keyword: \"unevaluatedItems\", message: \"unexpected item\" });\n\t\t\t\t} else this.walk(unevaluatedItems, b, v[i], `${path}/${i}`, out);\n\t\t\t}\n\t\t}\n\t}\n}\n\ntype Push = (keyword: string, message: string, at?: string) => void;\n\n// Enum errors name the allowed values; a long list (an enum of thousands) is cut, so the message stays readable.\nconst LISTED_VALUES = 20;\n\n/** `values` as JSON, at most LISTED_VALUES of them, then how many more there are. */\nfunction listValues(values: readonly unknown[]): string {\n\tif (values.length <= LISTED_VALUES) return JSON.stringify(values);\n\tconst listed = JSON.stringify(values.slice(0, LISTED_VALUES));\n\treturn `${listed.slice(0, -1)}, ... and ${values.length - LISTED_VALUES} more]`;\n}\n\nfunction containsMessage(min: number, max: number): string {\n\tif (max === Number.POSITIVE_INFINITY) return `expected at least ${min} matching ${min === 1 ? \"item\" : \"items\"}`;\n\tif (min === 0) return `expected at most ${max} matching ${max === 1 ? \"item\" : \"items\"}`;\n\treturn `expected between ${min} and ${max} matching items`;\n}\n\nfunction isBound(value: unknown): value is Bound {\n\treturn typeof value === \"number\" || typeof value === \"bigint\";\n}\n\nfunction pointer(path: string, key: string | number): string {\n\treturn `${path}/${String(key).replace(/~/g, \"~0\").replace(/\\//g, \"~1\")}`;\n}\n\nfunction typeName(v: unknown): string {\n\tif (v === null) return \"null\";\n\tif (Array.isArray(v)) return \"array\";\n\tif (v instanceof Uint8Array) return \"bytes\";\n\tif (typeof v === \"bigint\") return \"bigint\";\n\tif (typeof v === \"number\" && Number.isInteger(v)) return \"integer\";\n\tif (typeof v === \"number\" && !Number.isFinite(v)) return String(v);\n\treturn typeof v;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { type Annotations, arr, bool, bytes, int, type LengthBounds, lit, map, type NumberBounds, nul, nullable, num, Optional, obj, oneOf, opt, type Properties, type Schema, type Static, type StaticObject, str, tuple, union, unknown, } from "./builders.ts";
|
|
1
|
+
export { type Annotations, arr, type BigintBounds, bigint, bool, bytes, int, type LengthBounds, lit, map, type NumberBounds, nul, nullable, num, Optional, obj, oneOf, opt, type Properties, recursive, type Schema, type Static, type StaticObject, str, tuple, union, unknown, unsafe, } from "./builders.ts";
|
|
2
|
+
export { deepEqual as equal } from "./checks.ts";
|
|
2
3
|
export type { Check, CompileOptions, FormatCheck, JsonSchema, ParseResult, ValidationError } from "./types.ts";
|
|
3
4
|
export { CoercingValidator, compile, Validator } from "./validator.ts";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,WAAW,EAChB,GAAG,EACH,IAAI,EACJ,KAAK,EACL,GAAG,EACH,KAAK,YAAY,EACjB,GAAG,EACH,GAAG,EACH,KAAK,YAAY,EACjB,GAAG,EACH,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,GAAG,EACH,KAAK,EACL,GAAG,EACH,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,GAAG,EACH,KAAK,EACL,KAAK,EACL,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,WAAW,EAChB,GAAG,EACH,KAAK,YAAY,EACjB,MAAM,EACN,IAAI,EACJ,KAAK,EACL,GAAG,EACH,KAAK,YAAY,EACjB,GAAG,EACH,GAAG,EACH,KAAK,YAAY,EACjB,GAAG,EACH,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,GAAG,EACH,KAAK,EACL,GAAG,EACH,KAAK,UAAU,EACf,SAAS,EACT,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,GAAG,EACH,KAAK,EACL,KAAK,EACL,OAAO,EACP,MAAM,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,IAAI,KAAK,EAAE,MAAM,aAAa,CAAC;AACjD,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// JSON Schema validation (drafts 2020-12 and 7) without eval: compile() builds a schema into plain closures once.
|
|
2
2
|
// The builders return plain JSON Schema objects typed with the values they accept.
|
|
3
|
-
export { arr, bool, bytes, int, lit, map, nul, nullable, num, Optional, obj, oneOf, opt, str, tuple, union, unknown, } from "./builders.js";
|
|
3
|
+
export { arr, bigint, bool, bytes, int, lit, map, nul, nullable, num, Optional, obj, oneOf, opt, recursive, str, tuple, union, unknown, unsafe, } from "./builders.js";
|
|
4
|
+
export { deepEqual as equal } from "./checks.js";
|
|
4
5
|
export { CoercingValidator, compile, Validator } from "./validator.js";
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,mFAAmF;AAEnF,OAAO,EAEN,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,mFAAmF;AAEnF,OAAO,EAEN,GAAG,EAEH,MAAM,EACN,IAAI,EACJ,KAAK,EACL,GAAG,EAEH,GAAG,EACH,GAAG,EAEH,GAAG,EACH,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,GAAG,EACH,KAAK,EACL,GAAG,EAEH,SAAS,EAIT,GAAG,EACH,KAAK,EACL,KAAK,EACL,OAAO,EACP,MAAM,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,IAAI,KAAK,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["// JSON Schema validation (drafts 2020-12 and 7) without eval: compile() builds a schema into plain closures once.\n// The builders return plain JSON Schema objects typed with the values they accept.\n\nexport {\n\ttype Annotations,\n\tarr,\n\ttype BigintBounds,\n\tbigint,\n\tbool,\n\tbytes,\n\tint,\n\ttype LengthBounds,\n\tlit,\n\tmap,\n\ttype NumberBounds,\n\tnul,\n\tnullable,\n\tnum,\n\tOptional,\n\tobj,\n\toneOf,\n\topt,\n\ttype Properties,\n\trecursive,\n\ttype Schema,\n\ttype Static,\n\ttype StaticObject,\n\tstr,\n\ttuple,\n\tunion,\n\tunknown,\n\tunsafe,\n} from \"./builders.ts\";\nexport { deepEqual as equal } from \"./checks.ts\";\nexport type { Check, CompileOptions, FormatCheck, JsonSchema, ParseResult, ValidationError } from \"./types.ts\";\nexport { CoercingValidator, compile, Validator } from \"./validator.ts\";\n"]}
|