How do you #ruby people handle #jsonapi payloads? Validation, reading attributes, relationships, etc?

@jandudulski

I recommend take a look at https://dry-rb.org/gems/dry-validation/1.10

I has dry-schema where you can define nested json with expected types (and it will do coerce) and you can also add custom rules.

(I know this reply comes 4 days later :) but I just discovered now this question)

dry-rb - dry-validation v1.10 - Introduction

The standalone validation library for Ruby

@lucian actually this is how I handle it now, plus it plays nice with pattern matching, but it's still quite verbose so looking for improvement
@jandudulski yeah a mix of dry and pattern matching would be the only improvement I would suggest :) so if you are already doing that I think that is the best so far production ready.
@jandudulski On a second thought - I think @joeldrapper literal gem https://github.com/joeldrapper/literal might help if you want to build your own structure to handle jsonapi payloads
GitHub - joeldrapper/literal: A literal Ruby gem. 💎

A literal Ruby gem. 💎. Contribute to joeldrapper/literal development by creating an account on GitHub.

GitHub