feat: customizable validation errors#1146
Conversation
|
Oh, is it normal that we have a |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Deploying h3dev with
|
| Latest commit: |
9f96225
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://69c3837d.h3dev.pages.dev |
| Branch Preview URL: | https://feat-custom-validation-error.h3dev.pages.dev |
|
@pi0 any update on this? |
|
Hi dear @sandros94. It is in my todo list, in meantime do you have time to help on fixing merge conflicts and adressing #1146 (comment) 🙏🏼 |
Yes absolutely! And sorry, I completely forgot about that review 😅 |
|
I'm terribly sorry, I didn't realize that in 1e4d720 I did not update the docs 🙈 For now I would leave it as only Let me know if there is anything else I should take care of |
|
@sandros94 updated implementation to be more compact API. Love your opinion on latest changes. |
Thank you, and yes it required a bit of cleanup |
|
Warning Rate limit exceeded@pi0 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 33 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
resolves #982
I've added an additional argument to each
readValidatedBody,getValidatedQueryandgetValidatedRouteParamswhich can be either an error object or a function that returns one. If a standard-schema is being used, then theissuesarray is available as an argument for the function variant.This allows for the following custom error, which will ouput a markdown list of all the errors recorded:
I've also updated the
defineValidatedHandler, which brings three more properties:bodyErrors,headersErrorsandqueryErrors. All allowing for either error object or function that returns oneAdded two types, but I'm not super satisfied with
ValidateIssuesnaming (I'm open for suggestions):I've also made sure that if a
new HTTPErroris thrown during validation, its content will be directly passed as is, quite useful for non-standard-schema validations.