https://github.com/satom99/paramus
Parameter validation for Phoenix
https://github.com/satom99/paramus
elixir parameter phoenix validation
Last synced: about 2 months ago
JSON representation
Parameter validation for Phoenix
- Host: GitHub
- URL: https://github.com/satom99/paramus
- Owner: satom99
- License: apache-2.0
- Created: 2019-02-14T21:02:19.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-03T13:33:08.000Z (about 7 years ago)
- Last Synced: 2025-08-10T19:01:48.887Z (8 months ago)
- Topics: elixir, parameter, phoenix, validation
- Language: Elixir
- Homepage: https://elixirforum.com/t/20167
- Size: 6.84 KB
- Stars: 5
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Paramus
[](https://github.com/satom99/paramus/blob/master/LICENSE)
[](https://hex.pm/packages/paramus)
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JKKHNZF6RAKDA&item_name=paramus¤cy_code=USD)
Parameter validation for [Phoenix](https://github.com/phoenixframework/phoenix).
### Example
```elixir
defmodule Example.Routes.Fruit do
use Phoenix.Controller
use Paramus
@required [
name: :string,
quantity: :integer
]
@optional [
cut?: {:boolean, false}
]
def consume(conn, %{name: name, quantity: quantity, cut?: cut?}) do
# ···
end
def validate(changeset, :consume) do
changeset
|> validate_length(:name, min: 3)
|> validate_number(:quantity, less_than: 5)
end
end
```