Skip to content

Finalize keywords

Finalize keywords run last, after validation.

Core. Fills undefined only. Runs after validation, so it does not satisfy constraints:

/v: { source: /missing, default: fallback }

with an empty input writes "fallback".

Core. Coerces the value: string, number, boolean, or json.

/n: { source: /n, as: string }
{ "n": 7 }

writes "7". Coercion with as happens before validation keywords see the value, so as: number with type: number validates the coerced value. On an absent value, as writes nothing.

Experimental. Wraps the value as a case-insensitive regular expression source:

/re: { source: /s, regexp_i: true }
{ "s": "abc" }

writes "/abc/i".