Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ErrorFormattingOptions

Hierarchy

  • ErrorFormattingOptions

Index

Properties

Optional escapeHtml

0.0.46 provide
escapeHtml: boolean

when true, error message templates will escape special characters to HTML entities, for security purposes.

default

false

Optional label

0.0.46 provide
label: false | "path" | "key"

defines the value used to set the label context variable.

Optional language

0.0.46 provide
language: string

The preferred language code for error messages. The value is matched against keys at the root of the messages object, and then the error code as a child key of that. Can be a reference to the value, global context, or local context which is the root value passed to the validation function.

Note that references to the value are usually not what you want as they move around the value structure relative to where the error happens. Instead, either use the global context, or the absolute value (e.g. Joi.ref('/variable'))

Optional render

0.0.46 provide
render: boolean

when false, skips rendering error templates. Useful when error messages are generated elsewhere to save processing time.

default

true

Optional stack

0.0.46 provide
stack: boolean

when true, the main error will possess a stack trace, otherwise it will be disabled. Defaults to false for performances reasons. Has no effect on platforms other than V8/node.js as it uses the Stack trace API.

default

false

Optional wrap

0.0.46 provide
wrap: { array?: string | false; label?: string | false }

overrides the way values are wrapped (e.g. [] arround arrays, "" around labels). Each key can be set to a string with one (same character before and after the value) or two characters (first character before and second character after), or false to disable wrapping.

Type declaration

  • Optional array?: string | false

    the characters used around array avlues. Defaults to '[]'

    default

    '[]'

  • Optional label?: string | false

    the characters used around {#label} references. Defaults to '"'.

    default

    '"'