Skip to content

Commit 4e8590d

Browse files
committed
chore: Updated dependencies.
1 parent fb10e2f commit 4e8590d

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@
4141
"dependencies": {
4242
"ajv": "^8.12.0",
4343
"fastify-plugin": "^4.5.1",
44-
"http-errors-enhanced": "^1.1.2"
44+
"http-errors-enhanced": "^2.0.0"
4545
},
4646
"devDependencies": {
47-
"@cowtech/eslint-config": "^8.10.0",
48-
"@swc/cli": "^0.1.62",
49-
"@swc/core": "^1.3.94",
50-
"@types/node": "^20.8.7",
51-
"@types/tap": "^15.0.10",
47+
"@cowtech/eslint-config": "^9.0.0",
48+
"@swc/cli": "^0.1.63",
49+
"@swc/core": "^1.3.101",
50+
"@types/node": "^20.10.5",
51+
"@types/tap": "^15.0.11",
5252
"ajv-formats": "^2.1.1",
5353
"c8": "^8.0.1",
5454
"chokidar": "^3.5.3",
5555
"concurrently": "^8.2.2",
56-
"fastify": "^4.24.3",
57-
"prettier": "^3.0.3",
58-
"tap": "^18.5.2",
59-
"ts-node": "^10.9.1",
60-
"typescript": "^5.2.2"
56+
"fastify": "^4.25.1",
57+
"prettier": "^3.1.1",
58+
"tap": "^18.6.1",
59+
"ts-node": "^10.9.2",
60+
"typescript": "^5.3.3"
6161
},
6262
"engines": {
6363
"node": ">= 18.18.0"

src/handlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function handleValidationError(error: FastifyError, request: FastifyReque
3939
return new Klass('One or more validations failed trying to process your request.', {
4040
failedValidations: convertValidationErrors(
4141
section,
42-
Reflect.get(request, section),
42+
Reflect.get(request, section) as Record<string, unknown>,
4343
error.validation! as ValidationResult[]
4444
)
4545
})

src/validation.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ export const validationMessagesFormatters: Record<string, ValidationFormatter> =
8383
return max === 0 ? 'must be a empty array' : `must be an array with at most ${max} items`
8484
},
8585
enum: values =>
86-
`must be one of the following values: ${niceJoin(
87-
values.map((f: string) => `"${f}"`),
88-
' or '
89-
)}`,
86+
`must be one of the following values: ${niceJoin(values.map((f: string) => `"${f}"`) as string[], ' or ')}`,
9087
pattern: pattern => `must match pattern "${pattern.replaceAll('(?:', '(')}"`,
9188
invalidResponseCode: code => `This endpoint cannot respond with HTTP status ${code}.`,
9289
invalidResponse: code =>
@@ -113,7 +110,7 @@ export function convertValidationErrors(
113110
let reason: string
114111

115112
// Normalize the key
116-
let key = e.dataPath ?? e.instancePath /* c8 ignore next */ ?? ''
113+
let key: string = e.dataPath ?? e.instancePath /* c8 ignore next */ ?? ''
117114

118115
if (/^[./]/.test(key)) {
119116
key = key.slice(1)
@@ -260,7 +257,11 @@ export function addResponseValidation(this: FastifyInstance, route: RouteOptions
260257
if (!valid) {
261258
done(
262259
new InternalServerError(validationMessagesFormatters.invalidResponse(statusCode), {
263-
failedValidations: convertValidationErrors('response', payload, validator.errors as ValidationResult[])
260+
failedValidations: convertValidationErrors(
261+
'response',
262+
payload as Record<string, unknown>,
263+
validator.errors as ValidationResult[]
264+
)
264265
})
265266
)
266267
return
@@ -283,7 +284,7 @@ export function compileResponseValidationSchema(this: FastifyInstance, configura
283284

284285
for (const [instance, validators, schemas] of this[kHttpErrorsEnhancedResponseValidations]) {
285286
// @ts-expect-error Fix types
286-
const compiler = new AjvConstructor({
287+
const compiler: Ajv = new AjvConstructor({
287288
// The fastify defaults, with the exception of removeAdditional and coerceTypes, which have been reversed
288289
removeAdditional: false,
289290
useDefaults: true,

0 commit comments

Comments
 (0)