Using Ecto without a database

I plan to use Ecto only to validate input data, such as a data structure passed in through a JSON api call, before doing some processing then route the result to somewhere else. There is no SQL database involved. Does it sound reasonable, or is there a smaller library that can accomplish the same thing?

4 Likes

I am using Ecto changesets in my project that only uses a Mnesia database.

The only downside is that I need to require a lot that is not needed to get it to work.

Not aware if any other lib exists.

3 Likes

I find it reasonable choice.

4 Likes

I have not used it myself, but maybe Vex — Vex v0.9.0 could be something interesting to look at

4 Likes

I do that all the time and it always worked really well.

There are a few gotchas however e.g. if you put value in the changeset that is the same as the default value (usually nil but not always) then the changeset won’t count it as a change so you might need to use force_change.

That being said, Ecto is amazingly well documented. You will know exactly what you’re getting into, and 99% of the time it will be good and predictable.

11 Likes

I gave a talk with this same title, so I’m in favor

7 Likes