Elixir Blog Posts

FYI:

https://kubasub.com/params-modules-for-phoenix

by @kubasub

The article describes an approach of using Ecto embedded schemas and changesets to validate HTTP request parameters and subsequently transform the data into a shape more suited for consumption by the domain logic.

This isolates more complex web-related sanitation/validation/transformation for use by the controller while keeping it out of the Phoenix contexts (possibly in preparation for segragating the domain logic into a separate OTP application).

Params modules take a step back from what the vic/params package provides in favour of:

  • being a pattern instead of a dependency
  • explicitly using familiar Ecto schemas instead of a new DSL
  • and the flexibility to transform instead of only validating the params structure.

Sometimes it can make more sense to simply adopt an approach rather than adding another dependency.

I became aware of this during yesterday’s Toronto Elixir meetup.

The other presentations were about:

3 Likes