typebox-validators icon indicating copy to clipboard operation
typebox-validators copied to clipboard

[FEATURE] allow changing the key which looks for the error message

Open itsyoboieltr opened this issue 2 years ago • 3 comments

Hey, I would like to use this library with Elysia, but Elysia uses the "error" property for custom error messages, instead of "errorMessage". It would be nice if I could tell the library to look for the message in the "error" property instead.

itsyoboieltr avatar Nov 25 '23 20:11 itsyoboieltr

What about having this library use errorMessage when present, otherwise using error if present? That way both would be supported without additional configuration?

jtlapp avatar Nov 26 '23 23:11 jtlapp

What about having this library use errorMessage when present, otherwise using error if present? That way both would be supported without additional configuration?

That is a completely valid approach! Sounds like something that would work out of the (type)box for most users :D @jtlapp

itsyoboieltr avatar Nov 28 '23 00:11 itsyoboieltr

Sorry, I wasn't able to get to it today. Feel free to provide a PR. Just be sure to include tests.

jtlapp avatar Nov 28 '23 02:11 jtlapp