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 ​
| Parameter | Type | Description |
|---|---|---|
modelName | string | The Swagger model name to look up. |
Returns ​
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 ​
| Parameter | Type | Description |
|---|---|---|
modelName | string | The Swagger model name (must match the modelName in BodyValidator). |
factory | SpecificationFactory<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