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): SpecificationFactory<any, Joinable>;

Retrieve the spec factory registered for the given model name, or undefined if none.

Parameters ​

ParameterTypeDescription
modelNamestringThe Swagger model name to look up.

Returns ​

SpecificationFactory<any, Joinable>


register() ​

ts
register(modelName, factory): void;

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

Parameters ​

ParameterTypeDescription
modelNamestringThe Swagger model name (must match the modelName in BodyValidator).
factorySpecificationFactoryA function returning a fresh specification per request.

Returns ​

void