Interface: ReferenceOptions
The options of a reference created by DTO.Ref() or DTO.In(): how its key is read and how the value it resolves to is adjusted.
Extends
HierarchySeparatorOptions
Properties
adjust?
optionaladjust?: (value) =>any
A function adjusting the resolved value, like (value) => value + 5. The adjusted value is not validated: it must be what the rule using the reference expects. Cannot be combined with map.
Parameters
value
any
Returns
any
ancestor?
optionalancestor?:number
The starting point of the reference: 0 for the value itself, 1 for its parent (the object holding it), 2 for the grandparent… Cannot be combined with a key starting with separators ('...a').
Default
the number of leading separators of the key, else 1in?
optionalin?:boolean
Whether the reference resolves to an array of values the value must be one of (what DTO.In() creates), in valid() and invalid().
Default
falseiterables?
optionaliterables?:boolean
Whether the path reaches into the Map and Set objects.
Default
falsemap?
optionalmap?: [any,any][]
Pairs [[from, to], …] mapping the resolved value to another one; a value not in the map is used as is. Cannot be combined with adjust.
prefix?
optionalprefix?:object
The characters marking the kind of a reference at the start of its key.
global?
optionalglobal?:string
The prefix of the references to the context validation option.
Default
'$'local?
optionallocal?:string
The prefix of the references to the context of an error message or a rule.
Default
'#'root?
optionalroot?:string
The prefix of the references to the root value being validated.
Default
'/'render?
optionalrender?:boolean
Whether the error messages show the resolved value instead of the name of the reference.
Default
falseseparator?
optionalseparator?:string|false
The separator of the keys in a path, or false to read the whole path as a single key.
Default
'.'Inherited from
HierarchySeparatorOptions.separator