MCPcopy Create free account
hub / github.com/axe-api/axe-api / validate

Method validate

packages/axe-api/src/Validators/Validatorjs.ts:16–35  ·  view source on GitHub ↗
(req: AxeRequest, model: IModelService, formData: any)

Source from the content-addressed store, hash-verified

14 });
15 }
16 async validate(req: AxeRequest, model: IModelService, formData: any) {
17 // Setting the language
18 Validator.useLang(req.currentLanguage.language);
19
20 // Getting the validation rules
21 const requestMethod: HttpMethods = req.method as unknown as HttpMethods;
22 const validationRules = model.instance.getValidationRules(requestMethod);
23
24 // Validating the data if there is any
25 if (validationRules) {
26 const validation = new Validator(formData, validationRules);
27
28 // Return the validation errors
29 if (validation.fails()) {
30 return validation.errors;
31 }
32 }
33
34 return null;
35 }
36}
37
38export default Validatorjs;

Callers 5

analyzeVersionsMethod · 0.45
PreparePhase.tsFile · 0.45

Calls 1

getValidationRulesMethod · 0.80

Tested by

no test coverage detected