find_schema_meta<TKey extends keyof SchemaMeta>(schema: AnySchema, key: TKey, options?: FindSchemaMetaOptions): Exclude<SchemaMeta[TKey], undefined>[] Every value of metadata key other than undefined on any schema
reachable from schema, for a key that must not be missed wherever it is
attached, as a mark on a shared schema reused deep inside another. The
caller decides what several values mean, as which of them is the strongest.
- It goes through every layer, as get_schema_meta does, and also every
schema and action of a pipe, not only its first, every option of a
union, a memo_union, and a variant, and with
structuralthe schemas of a value's parts. - A layer that has the key as
undefinedhas cleared it for the layers under it, as get_schema_meta reads it, and not for what those hold: the options, the later steps of a pipe, and the parts are read as ever. A schema reached again past no such layer is read there. - Each schema object is read once for its value, and walked at most
twice, under a layer that cleared the key and under none, a lazy's
function called at each, so a recursive schema ends,
lazy(() => optional(L))asLincluded. A cycle that builds a new lazy each time round, asconst f = () => optional(lazy(f)), never meets a schema it has read and ends in a stack overflow, though a parse of a finite value can end on it. - The values come depth first, a schema before what it holds, which comes
in the order of its
def: a pipe's steps, a union's options, an object's entries, then therest. A value is there once for each schema object it is attached to, so the same value can come more than once. - flavor and brand return the schema they were given, and message carries its metadata over to the one it returns, so metadata on the schema given to any of them is found.
- Nothing but a lazy's function is called, and a kind defined outside the library is read and not looked into.
import {find_schema_meta} from '@fuzdev/fuz_schema/introspect.ts'; parameters
key
:TKeya key of SchemaMeta, description or one added by declaration merging