keygen-sh / typed_params

An alternative to Rails strong_parameters. Define structured and strongly-typed parameter schemas for your Rails controllers.
MIT License
123 stars 0 forks source link

Consider using dry-types over defining your own #2

Closed radar closed 1 year ago

radar commented 1 year ago

dry-types may be a more suitable API here, and you could build up more complicated parameter structures using it. It’s also more battle-tested than your library. What do you think about using it here?

I wrote a post about using dry-types here: https://ryanbigg.com/2022/11/a-replacement-for-strong-parameters

ezekg commented 1 year ago

No offense to the maintainers, and it’s entirely subjective, but I’m not a fan of dry-types (or any of the dry-* gems) simply because it doesn’t feel like “Ruby” to me. Maybe it’s the verbose DSL, or the obj.() call syntax they push, but it’s never been attractive to me personally. It's a great suite of gems, but they're not for me.

I also don’t see any value in replacing any of the internals of typed_params with dry-types (or anything for that matter) when everything works as-intended already. Seems like wasted effort?

As far as being battle-tested — typed_params has been used in production for 7 years, serving billions and billions of requests (admittedly, it’s had a rewrite in that timeline). It has also undergone multiple security audits. It may be a new open source project, but it’s not new. But I do agree that dry-types has had more users and overall use.

Is there a specific use-case you have that typed_params doesn’t handle well that dry-types would be a better fit for?

Would be keen to understand where exactly this recommendation is stemming from.