What lib would you recommend for data validation for JSON API?

Starting a new project what lib would you recommend for data validation for JSON payloads. (payloads involved enough that something like JSON Schema would be appropriate). Or should I bite the bullet and go with GraphQL?

1 Like

If graphql is an option, I think it is worth trying out.
the book ships soon, but some of the guides on hexdocs are still not complete, eg dataloader.

Otherwise I like to use phoenix_swagger which will validate JSON payloads using ex_json_schema.

I’ve also been working on open_api_spex which is similar to phoenix swagger but targets swagger (open api) 3.0, and includes some parameter validations. Maybe one day the full extended subset of JSON-Schema that swagger defines :smiley:

2 Likes

Thank you for advice[quote=“mbuhot, post:2, topic:11558”]
I’ve also been working on open_api_spex
[/quote]

^^ looks very promising are you using it in prod.?

Not yet. There’s still some tooling integrations that don’t support swagger 3.0 yet, like Azure API Management.

1 Like