vic / params

Easy parameters validation/casting with Ecto.Schema, akin to Rails' strong parameters.
http://hex.pm/packages/params
Apache License 2.0
361 stars 46 forks source link

Add reusable embeds schemas with defparams #30

Closed nirev closed 4 years ago

nirev commented 4 years ago

Implements reusable embeds using defparams, as asked in #15

Examples:

defparams puppy %{
    breed!:  :string,
    near_location!: {:embeds_one, LocationParams}
  }

  defparams dragon %{
    breed!:  :string,
    near_locations!: {:embeds_many, LocationParams}
  }

Let me know if you needs anything else, @vic :)

Gracias

vic commented 4 years ago

Looks nice, @nirev! Do you think it's worth it adding some example of embeds in README ?

If not, we could just merge this PR as it's now.
Thanks !

nirev commented 4 years ago

I'll add a couple :)

vic commented 4 years ago

@nirev I'll merge this. but feel free to send another PR with docs.

Thank you :)