Documents / @faasjs/node-utils / ParseSchemaValueOptions
Type Alias: ParseSchemaValueOptions<TSchema, TFallback>
ParseSchemaValueOptions<
TSchema,TFallback> =object
Options for parsing an unknown value with an optional Zod schema.
This is useful for runtime boundaries where a schema may be optional, such as API params, job payloads, or plugin config.
Type Parameters
TSchema
TSchema extends ZodType | undefined = undefined
Zod schema used when present.
TFallback
TFallback = Record<string, never>
Value and output type used when the schema is omitted.
Properties
createError?
optionalcreateError?: (message) =>Error
Optional factory for wrapping the formatted validation message.
Parameters
message
string
Returns
Error
defaultValue?
optionaldefaultValue?:TFallback
Value returned without a schema and parsed when the raw value is nullish.
Defaults to an empty object when omitted.
errorMessage
errorMessage:
string
First line for formatted validation failures.
schema?
optionalschema?:TSchema
Optional Zod schema used to parse the value.
value
value:
unknown
Raw value to parse.