Nitro · Request
NITRO0007Use getValidatedRouterParams for validated route params
When a Nitro handler validates the whole route params object, read and validate it through the H3 utility.
vite-doctor/nitrorequestwarnSuggestion
Why it happens
Raw request input and validation can drift apart when they are separate operations. Nitro and h3 provide validated helpers that keep parsing and validation coupled at the request boundary.
Fix
Use getValidatedRouterParams(event, validator) instead of getRouterParams(event) followed by separate validation.
Example
Keep reading and validation together
Before
export default defineEventHandler(async (event) => {
const input = await getRouterParams(event)
const value = validator.parse(input)
return value
})
After
export default defineEventHandler(async (event) => {
const value = await getValidatedRouterParams(event, validator)
return value
})
Verify the fix
Run only this rule after editing so the report stays focused on the diagnostic you are closing:
pnpm vite-doctor . --framework nitro --rules nitro/request/prefer-validated-router-params