fibers icon indicating copy to clipboard operation
fibers copied to clipboard

Inject custom validator

Open mahdiou opened this issue 2 years ago • 2 comments

Would it be possible to inject my own validator ? I have defined a few custom validators but with the current version, I am stuck doing a second validation.

https://github.com/long2ice/fibers/blob/572576f8a06f8d66fae4f8728e47aa25aa13d4af/router/router.go#L34

Thanks !

mahdiou avatar Jan 20 '23 03:01 mahdiou

Just need some enhancement

long2ice avatar Jan 20 '23 05:01 long2ice

After exploring a bit more, I see that validate:"oneof=val1 val2" validates enums. Is there a way to display them as enum in the generated api doc ?

the generated json should be something like this:

{
   "type": "string",
   "enum": ["val1", "val2"]
}

mahdiou avatar Jan 27 '23 06:01 mahdiou