Skip to content

SudoSOS Back-end API / internal/middleware / AsyncValidatorRegistry

Class: AsyncValidatorRegistry ​

Constructors ​

Constructor ​

ts
new AsyncValidatorRegistry(): AsyncValidatorRegistry;

Returns ​

AsyncValidatorRegistry

Methods ​

get() ​

ts
get(modelName): RegistryEntry;

Retrieve the registry entry for the given model name, or undefined if none.

Parameters ​

ParameterTypeDescription
modelNamestringThe Swagger model name to look up.

Returns ​

RegistryEntry


register() ​

ts
register<T>(
   modelName, 
   factory, 
   buildTarget?): void;

Register an async validation spec factory for a given Swagger model name.

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterTypeDescription
modelNamestringThe Swagger model name (must match the modelName in BodyValidator).
factorySpecificationFactory<T>A function returning a fresh specification per request.
buildTarget?BuildTarget<T>Optional function that builds the validation target from the request. When omitted the middleware validates req.body directly.

Returns ​

void