Skip to content

Commit 2a5bbeb

Browse files
committed
Removed validationError and _validationError unusued functions.
1 parent 85aad91 commit 2a5bbeb

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

src/middlewares/util.ts

+2-26
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import ono from 'ono';
21
import * as Ajv from 'ajv';
32
import { Request } from 'express';
43
import { ValidationError } from '../framework/types';
@@ -32,29 +31,6 @@ export class ContentType {
3231
}
3332
}
3433

35-
const _validationError = (
36-
status: number,
37-
path: string,
38-
message: string,
39-
): ValidationError => ({
40-
status,
41-
errors: [
42-
{
43-
path,
44-
message,
45-
},
46-
],
47-
});
48-
49-
export function validationError(
50-
status: number,
51-
path: string,
52-
message: string,
53-
): ValidationError {
54-
const err = _validationError(status, path, message);
55-
return ono(err, message);
56-
}
57-
5834
/**
5935
* (side-effecting) modifies the errors object
6036
* TODO - do this some other way
@@ -63,7 +39,7 @@ export function validationError(
6339
export function augmentAjvErrors(
6440
errors: Ajv.ErrorObject[] = [],
6541
): Ajv.ErrorObject[] {
66-
errors.forEach(e => {
42+
errors.forEach((e) => {
6743
if (e.keyword === 'enum') {
6844
const params: any = e.params;
6945
const allowedEnumValues = params?.allowedValues;
@@ -80,7 +56,7 @@ export function ajvErrorsToValidatorError(
8056
): ValidationError {
8157
return {
8258
status,
83-
errors: errors.map(e => {
59+
errors: errors.map((e) => {
8460
const params: any = e.params;
8561
const required =
8662
params?.missingProperty && e.dataPath + '.' + params.missingProperty;

0 commit comments

Comments
 (0)