A lightweight Elixir library for parameter validation and casting using Ecto.Schema, similar to Rails strong parameters.
Params is an Elixir library designed to simplify parameter validation and casting in applications, particularly those built with the Phoenix framework. It provides a lightweight wrapper around Ecto.Schema, allowing developers to define parameter structures with minimal boilerplate. The library helps ensure that incoming data (e.g., from API requests) adheres to expected formats and types, reducing errors and improving code clarity.
Elixir developers building web applications with Phoenix or any project requiring structured parameter handling. It's especially useful for API developers who need to validate and cast request parameters efficiently.
Params reduces the verbosity of using Ecto.Schema for parameter validation by offering a concise DSL and sensible defaults, while still allowing full access to Ecto.Changeset for custom validations. It's a focused alternative to writing repetitive schema and changeset code, inspired by Rails' strong parameters but leveraging Elixir's type system and Ecto's flexibility.
Easy parameters validation/casting with Ecto.Schema, akin to Rails' strong parameters.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The `defparams` macro drastically reduces boilerplate compared to manual Ecto schema definitions, as shown in the kitten search example cutting multiple lines of code.
Leverages Ecto.Changeset for validation and casting, ensuring type safety and compatibility with existing Elixir knowledge without reinventing the wheel.
Handles embedded schemas and nested maps effortlessly, enabling validation of complex JSON structures like location data without extra boilerplate.
Provides intuitive syntax with `!` for required fields and default values, simplifying parameter handling logic and ensuring consistency.
The project is actively seeking a maintainer, which risks stagnation, delayed updates, or unresolved issues in the future.
Tightly coupled with Ecto, making it unsuitable for projects avoiding Ecto or preferring lightweight, framework-agnostic validation libraries.
As a minimal wrapper, it may not support all Ecto changeset functionalities, forcing developers to fall back to manual implementations for edge cases.
params is an open-source alternative to the following products:
A server-side rendering component library for Phoenix