Interface AnySchema

Hierarchy

Index

Methods

Methods

public allow(value: any, values?: Array<any>): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Whitelists a value

Parameters

  • value: any
  • values?: Array<any> optional

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public allow(values: Array<any>): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Parameters

  • values: Array<any>

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public concat(schema: T in 'joi'.AnySchema<T extends AnySchema<Schema>>): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Returns a new type that is the result of adding the rules of one type to another.

Parameters

  • schema: T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public default(value: any): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Sets a default value if the original value is undefined.

Parameters

  • value: any

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public description(desc: string): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Annotates the key

Parameters

  • desc: string

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public example(value: any): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Annotates the key with an example value, must be valid.

Parameters

  • value: any

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public forbidden(): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Marks a key as forbidden which will not allow any value except undefined. Used to explicitly forbid keys.

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public invalid(value: any, values?: Array<any>): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Blacklists a value

Parameters

  • value: any
  • values?: Array<any> optional

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public invalid(values: Array<any>): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Parameters

  • values: Array<any>

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public meta(meta: Object): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Attaches metadata to the key.

Parameters

  • meta: Object

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public notes(notes: string): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Annotates the key

Parameters

  • notes: string

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public notes(notes: Array<string>): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Parameters

  • notes: Array<string>

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public optional(): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Marks a key as optional which will allow undefined as values. Used to annotate the schema for readability as all keys are optional by default.

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public options(options: ValidationOptions): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Overrides the global validate() options for the current key and any sub-key.

Parameters

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public required(): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Marks a key as required which will not allow undefined as value. All keys are optional by default.

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public strict(): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Sets the options.convert options to false which prevent type casting for the current key and any child keys.

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public tags(notes: string): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Annotates the key

Parameters

  • notes: string

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public tags(notes: Array<string>): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Parameters

  • notes: Array<string>

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public unit(name: string): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Annotates the key with an unit name.

Parameters

  • name: string

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public valid(value: any, values?: Array<any>): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Adds the provided values into the allowed whitelist and marks them as the only valid values allowed.

Parameters

  • value: any
  • values?: Array<any> optional

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public valid(values: Array<any>): T in 'joi'.AnySchema<T extends AnySchema<Schema>>

Parameters

  • values: Array<any>

Returns

T in 'joi'.AnySchema<T extends AnySchema<Schema>>

public when(ref: string, options: WhenOptions): AlternativesSchema

Converts the type into an alternatives type where the conditions are merged into the type definition where:

Parameters

Returns

AlternativesSchema

public when(ref: Reference, options: WhenOptions): AlternativesSchema

Parameters

Returns

AlternativesSchema