Hacker News new | ask | show | jobs
by drakmail 1078 days ago
Great gem! Can I define a several optional parameters where one of parameters is required? For example, I have auth endpoint, which is used to authenticate user and user can authenticate by email and password or phone number and password, so email and password is optional, but exactly one of them should be sent. I'm quick looked at the documentation and didn't find any examples of such cases
1 comments

It's possible via a custom validation. I just added a test for that to showcase how: https://github.com/keygen-sh/typed_params/commit/e56fe479f26...