# \#validation

**URL:** https://forum.elixirforum.com/tag/validation/204.md

[Latest](https://forum.elixirforum.com/latest.md) · [Categories](https://forum.elixirforum.com/categories.md) · [Tags](https://forum.elixirforum.com/tags.md)

---

## [Mold - a tiny, zero-dependency parsing library for external payloads](https://forum.elixirforum.com/t/mold-a-tiny-zero-dependency-parsing-library-for-external-payloads/74909)

<div class="topic-metadata">

**Author:** [@fuelen](https://forum.elixirforum.com/u/fuelen)\
**Replies:** 11\
**Last updated:** [August 28, 2026, 9:01pm UTC](https://forum.elixirforum.com/t/mold-a-tiny-zero-dependency-parsing-library-for-external-payloads/74909 "2026-08-28T21:01:59Z")

</div>

Mold parses JSON APIs, webhooks, HTTP params and other external input into clean Elixir terms - coerces types, renames keys, checks structure, and returns {:ok, result} or {:error, errors} with traces. Cheatsheet | Docu…

---

## [Estructura - set of extensions for Elixir structures](https://forum.elixirforum.com/t/estructura-set-of-extensions-for-elixir-structures/45445)

<div class="topic-metadata">

**Author:** [@mudasobwa](https://forum.elixirforum.com/u/mudasobwa)\
**Replies:** 2\
**Last updated:** [July 26, 2026, 4:49pm UTC](https://forum.elixirforum.com/t/estructura-set-of-extensions-for-elixir-structures/45445 "2026-07-26T16:49:16Z")

</div>

I’m glad to introduce Estructura, the library that equips structs with Access, Enumerable, and Collectable implementations, as well as per-field coercion and validation, and generation of StreamData generator. This is t…

---

## [Bylaw Ecto Query - validate ecto queries before running them](https://forum.elixirforum.com/t/bylaw-ecto-query-validate-ecto-queries-before-running-them/75300)

<div class="topic-metadata">

**Author:** [@ryanzidago](https://forum.elixirforum.com/u/ryanzidago)\
**Replies:** 1\
**Last updated:** [May 12, 2026, 10:40pm UTC](https://forum.elixirforum.com/t/bylaw-ecto-query-validate-ecto-queries-before-running-them/75300 "2026-05-12T22:40:08Z")

</div>

Hi all, I’ve released bylaw\_ecto\_query, a small OSS library for validating prepared Ecto.Query structs before they run. Why I wrote it Imagine you ship an API endpoint that does not order the results determinisitcally.…

---

## [PhoenixSpectral - FastAPI-style type-driven APIs for Phoenix](https://forum.elixirforum.com/t/phoenixspectral-fastapi-style-type-driven-apis-for-phoenix/75314)

<div class="topic-metadata">

**Author:** [@andreashasse](https://forum.elixirforum.com/u/andreashasse)\
**Replies:** 0\
**Last updated:** [May 12, 2026, 12:38pm UTC](https://forum.elixirforum.com/t/phoenixspectral-fastapi-style-type-driven-apis-for-phoenix/75314 "2026-05-12T12:38:54Z")

</div>

Hi all, I’ve been working on PhoenixSpectral, a library that makes Phoenix controller @spec annotations drive both OpenAPI generation and runtime request/response validation — no separate schema definitions. The main d…

---

## [Spectral - Type-driven JSON encoding/decoding, validation, and OpenAPI generation](https://forum.elixirforum.com/t/spectral-type-driven-json-encoding-decoding-validation-and-openapi-generation/74902)

<div class="topic-metadata">

**Author:** [@andreashasse](https://forum.elixirforum.com/u/andreashasse)\
**Replies:** 11\
**Last updated:** [May 2, 2026, 7:09am UTC](https://forum.elixirforum.com/t/spectral-type-driven-json-encoding-decoding-validation-and-openapi-generation/74902 "2026-05-02T07:09:16Z")

</div>

I’m happy to announce Spectral, a library that lets your Elixir structs and @type specs become the single source of truth for validation, encoding/decoding (primarily JSON), and OpenAPI schema generation. If you’re famil…

---

## [The language of the boundary](https://forum.elixirforum.com/t/the-language-of-the-boundary/74984)

<div class="topic-metadata">

**Author:** [@lud](https://forum.elixirforum.com/u/lud)\
**Replies:** 3\
**Last updated:** [April 13, 2026, 8:07am UTC](https://forum.elixirforum.com/t/the-language-of-the-boundary/74984 "2026-04-13T08:07:02Z")

</div>

Hello, I kinda miss the blog era and seeing all your posts makes me feel like I want to participate too. So there is a fresh blog post about Input validation, JSON Schema, and a library I wrote to work with that. I cr…

---

## [JSV - JSON Schema Validation library for Elixir, with support for 2020-12](https://forum.elixirforum.com/t/jsv-json-schema-validation-library-for-elixir-with-support-for-2020-12/68502)

<div class="topic-metadata">

**Author:** [@lud](https://forum.elixirforum.com/u/lud)\
**Replies:** 19\
**Last updated:** [April 2, 2026, 3:37pm UTC](https://forum.elixirforum.com/t/jsv-json-schema-validation-library-for-elixir-with-support-for-2020-12/68502 "2026-04-02T15:37:38Z")

</div>

Hello! I would like to present to you my work of the last couple weeks, an up-to-date JSON Schema validation library. TL;DR: Repo link at the end of the post History I started to work on this when I needed to ensure t…

---

## [Uk\_modulus - UK bank account validation (sort code & account number)](https://forum.elixirforum.com/t/uk-modulus-uk-bank-account-validation-sort-code-account-number/73894)

<div class="topic-metadata">

**Author:** [@alexfilatov](https://forum.elixirforum.com/u/alexfilatov)\
**Replies:** 0\
**Last updated:** [January 6, 2026, 12:12pm UTC](https://forum.elixirforum.com/t/uk-modulus-uk-bank-account-validation-sort-code-account-number/73894 "2026-01-06T12:12:18Z")

</div>

Hi all! I’d like to share uk\_modulus, a small open-source Elixir library for validating UK bank details. Overview uk\_modulus implements the official UK modulus checking algorithm to validate: Sort codes Account n…

---

## [Person name formatting / normalisation - feedback request](https://forum.elixirforum.com/t/person-name-formatting-normalisation-feedback-request/73061)

<div class="topic-metadata">

**Author:** [@kip](https://forum.elixirforum.com/u/kip)\
**Replies:** 12\
**Last updated:** [October 24, 2025, 9:12am UTC](https://forum.elixirforum.com/t/person-name-formatting-normalisation-feedback-request/73061 "2025-10-24T09:12:59Z")

</div>

TLDR; Seeking feedback on what, if any, normalisations and validations should be provided when accepting input that represents a person’s name. Context When you accept input for the name of a person, what validation or …

---

## [Elixact - schema definition and validation (think Pydantic in Elixir)](https://forum.elixirforum.com/t/elixact-schema-definition-and-validation-think-pydantic-in-elixir/68059)

<div class="topic-metadata">

**Author:** [@libo](https://forum.elixirforum.com/u/libo)\
**Replies:** 20\
**Last updated:** [July 5, 2025, 5:31am UTC](https://forum.elixirforum.com/t/elixact-schema-definition-and-validation-think-pydantic-in-elixir/68059 "2025-07-05T05:31:57Z")

</div>

Hey, I have used a bunch of schema libraries in Elixir and didn’t find the one satisfies all my needs. At some point, I kinda miss Python for having Pydantic. So recently I started to make one for myself. Elixact Elixa…

---

## [Best Approach for Validating Thousands of Inputs in an Elixir SDK Project](https://forum.elixirforum.com/t/best-approach-for-validating-thousands-of-inputs-in-an-elixir-sdk-project/69006)

<div class="topic-metadata">

**Author:** [@franzin](https://forum.elixirforum.com/u/franzin)\
**Replies:** 4\
**Last updated:** [January 26, 2025, 1:05am UTC](https://forum.elixirforum.com/t/best-approach-for-validating-thousands-of-inputs-in-an-elixir-sdk-project/69006 "2025-01-26T01:05:31Z")

</div>

Hello everyone! I hope you’re all doing well. I’m new to the world of Elixir, and recently I decided to create an SDK (I’ll share more details soon) as a way to practice. So far, I haven’t encountered many issues devel…

---

## [Validate\_inclusion with dynamic enum](https://forum.elixirforum.com/t/validate-inclusion-with-dynamic-enum/68486)

<div class="topic-metadata">

**Author:** [@RomainT](https://forum.elixirforum.com/u/RomainT)\
**Replies:** 4\
**Last updated:** [January 3, 2025, 3:21pm UTC](https://forum.elixirforum.com/t/validate-inclusion-with-dynamic-enum/68486 "2025-01-03T15:21:17Z")

</div>

Hello, I want to validates a value among possible values with validate\_inclusion but I’m stuck. My use case is an avatar generation system, layer by layer. An avatar is defined by a pack (Dragon Ball, Among Us…) and ma…

---

## [to\_atom\_in - Small utility to convert string to atom in a set](https://forum.elixirforum.com/t/to-atom-in-small-utility-to-convert-string-to-atom-in-a-set/67970)

<div class="topic-metadata">

**Author:** [@JohnJocoo](https://forum.elixirforum.com/u/JohnJocoo)\
**Replies:** 0\
**Last updated:** [December 8, 2024, 9:45pm UTC](https://forum.elixirforum.com/t/to-atom-in-small-utility-to-convert-string-to-atom-in-a-set/67970 "2024-12-08T21:45:26Z")

</div>

to\_atom\_in is a small utility to safely convert string to atom from a set. It is similar to String.to\_existing\_atom/1, but it also verifies that the resulting atom is one of the provided. require TAI TAI.to\_atom\_in("wo…

---

## [💦 Drops - Simplifying Data Validation in Elixir](https://forum.elixirforum.com/t/drops-simplifying-data-validation-in-elixir/59232)

<div class="topic-metadata">

**Author:** [@solnic](https://forum.elixirforum.com/u/solnic)\
**Replies:** 18\
**Last updated:** [November 22, 2024, 5:30pm UTC](https://forum.elixirforum.com/t/drops-simplifying-data-validation-in-elixir/59232 "2024-11-22T17:30:14Z")

</div>

Hello! Today I released the first version of Elixir Drops :slight\_smile: The announcement can be found on my blog but I’m also just pasting it here: A few years ago my Ruby friends asked me if it would be possible to p…

---

## [Recommendations for custom live view upload validation](https://forum.elixirforum.com/t/recommendations-for-custom-live-view-upload-validation/65577)

<div class="topic-metadata">

**Author:** [@smon](https://forum.elixirforum.com/u/smon)\
**Replies:** 3\
**Last updated:** [November 1, 2024, 11:14am UTC](https://forum.elixirforum.com/t/recommendations-for-custom-live-view-upload-validation/65577 "2024-11-01T11:14:26Z")

</div>

I am experimenting with live view uploads for the first time, and I was wondering what is the recommended way of doing customized upload validations. My simple example: I have an interface to upload files to a certain d…

---

## [TypeCheck - Fast and flexible runtime type-checking for your Elixir projects](https://forum.elixirforum.com/t/typecheck-fast-and-flexible-runtime-type-checking-for-your-elixir-projects/32886)

<div class="topic-metadata">

**Author:** [@Qqwy](https://forum.elixirforum.com/u/Qqwy)\
**Replies:** 100\
**Last updated:** [October 21, 2024, 4:57pm UTC](https://forum.elixirforum.com/t/typecheck-fast-and-flexible-runtime-type-checking-for-your-elixir-projects/32886 "2024-10-21T16:57:31Z")

</div>

TypeCheck: Fast and flexible runtime type-checking for your Elixir projects. Core ideas Type- and function specifications are constructed using (essentially) the same syntax as Elixir’s built-in typespecs. When …

---

## [Validate (to uppercase) and reset (when manually modified) not working as expected](https://forum.elixirforum.com/t/validate-to-uppercase-and-reset-when-manually-modified-not-working-as-expected/64780)

<div class="topic-metadata">

**Author:** [@owenfi](https://forum.elixirforum.com/u/owenfi)\
**Replies:** 5\
**Last updated:** [July 6, 2024, 4:20pm UTC](https://forum.elixirforum.com/t/validate-to-uppercase-and-reset-when-manually-modified-not-working-as-expected/64780 "2024-07-06T16:20:49Z")

</div>

To begin: I’m fairly new at web-frontend and trying to learn by cloning a popular word puzzle game. I have an input field where a guess can be entered, in a manually crafted form in a liveview. It’s possible to enter te…

---

## [How to do a custom validation of an attribute?](https://forum.elixirforum.com/t/how-to-do-a-custom-validation-of-an-attribute/58573)

<div class="topic-metadata">

**Author:** [@wintermeyer](https://forum.elixirforum.com/u/wintermeyer)\
**Replies:** 4\
**Last updated:** [April 8, 2024, 4:49pm UTC](https://forum.elixirforum.com/t/how-to-do-a-custom-validation-of-an-attribute/58573 "2024-04-08T16:49:47Z")

</div>

How can I do a custom validation in the following resource to make sure that the attribute use\_by\_date is today or later but not in the past? defmodule App.Shop.Product do use Ash.Resource, data\_layer: Ash.DataLayer.E…

---

## [How to make dynamic validations, & ref attributes from inside validation?](https://forum.elixirforum.com/t/how-to-make-dynamic-validations-ref-attributes-from-inside-validation/60220)

<div class="topic-metadata">

**Author:** [@zac](https://forum.elixirforum.com/u/zac)\
**Replies:** 3\
**Last updated:** [December 7, 2023, 1:45pm UTC](https://forum.elixirforum.com/t/how-to-make-dynamic-validations-ref-attributes-from-inside-validation/60220 "2023-12-07T13:45:23Z")

</div>

I’m trying to set up a couple of validations – unclear what the best approach is: attribute :allowed\_types, {:array, :atom} do allow\_nil? false default \[:value\_add, :non\_value\_add\] end attribute…

---

## [Elixir style vs. "Parse don't validate" (from Haskell)](https://forum.elixirforum.com/t/elixir-style-vs-parse-dont-validate-from-haskell/59512)

<div class="topic-metadata">

**Author:** [@dogweather](https://forum.elixirforum.com/u/dogweather)\
**Replies:** 5\
**Last updated:** [November 8, 2023, 2:44pm UTC](https://forum.elixirforum.com/t/elixir-style-vs-parse-dont-validate-from-haskell/59512 "2023-11-08T14:44:24Z")

</div>

EDIT: Parse, don't validate (2019) | Hacker News I finished this working code which takes in an HTML page and outputs legal citations it finds. I like the code, and I think it’s pretty much Elixir style. E.g., it uses t…

---

## [Is there a way for me to customize the default password length requirement while using the Password strategy of \`ash\_authentication\`?](https://forum.elixirforum.com/t/is-there-a-way-for-me-to-customize-the-default-password-length-requirement-while-using-the-password-strategy-of-ash-authentication/59329)

<div class="topic-metadata">

**Author:** [@zorn](https://forum.elixirforum.com/u/zorn)\
**Replies:** 11\
**Last updated:** [October 31, 2023, 9:06pm UTC](https://forum.elixirforum.com/t/is-there-a-way-for-me-to-customize-the-default-password-length-requirement-while-using-the-password-strategy-of-ash-authentication/59329 "2023-10-31T21:06:12Z")

</div>

I’m using a pretty vanilla implementation and seeing: “length must be greater than or equal to 8” I’d like that to be 20. Ideally, I would like to see something like password\_length\_requirement in the DSL. Is that s…

---

## [Using external HTTP API for data storage](https://forum.elixirforum.com/t/using-external-http-api-for-data-storage/58797)

<div class="topic-metadata">

**Author:** [@artem](https://forum.elixirforum.com/u/artem)\
**Replies:** 3\
**Last updated:** [October 8, 2023, 11:32pm UTC](https://forum.elixirforum.com/t/using-external-http-api-for-data-storage/58797 "2023-10-08T23:32:28Z")

</div>

Hi all Context: external system with inconsistent, but feature-full API We use an external SaaS system for hiring people. There are candidates, jobs, recruiters and so on. We like the data inside and our recruiters lik…

---

## [How to validate that a belongs\_to exists?](https://forum.elixirforum.com/t/how-to-validate-that-a-belongs-to-exists/58596)

<div class="topic-metadata">

**Author:** [@wintermeyer](https://forum.elixirforum.com/u/wintermeyer)\
**Replies:** 2\
**Last updated:** [September 30, 2023, 12:54pm UTC](https://forum.elixirforum.com/t/how-to-validate-that-a-belongs-to-exists/58596 "2023-09-30T12:54:13Z")

</div>

I have a Product which belongs\_to a Category. How can I validate that the field category\_id is not nil and how can I validate that there is a Category with that id? defmodule App.Shop.Product do use Ash.Resource, data…

---

## [Ecto\_command - a toolkit for mapping, validating, and executing commands](https://forum.elixirforum.com/t/ecto-command-a-toolkit-for-mapping-validating-and-executing-commands/57086)

<div class="topic-metadata">

**Author:** [@silvadanilo](https://forum.elixirforum.com/u/silvadanilo)\
**Replies:** 3\
**Last updated:** [July 17, 2023, 1:05pm UTC](https://forum.elixirforum.com/t/ecto-command-a-toolkit-for-mapping-validating-and-executing-commands/57086 "2023-07-17T13:05:59Z")

</div>

Hello guys, I often find myself working on projects where I accept commands from external sources (usually via HTTP APIs, but they could also come through the shell or other means). The input data needs to be validated…

---

## [Goal - A parameter validation library based on Ecto](https://forum.elixirforum.com/t/goal-a-parameter-validation-library-based-on-ecto/50735)

<div class="topic-metadata">

**Author:** [@martinthenth](https://forum.elixirforum.com/u/martinthenth)\
**Replies:** 10\
**Last updated:** [March 6, 2023, 6:58pm UTC](https://forum.elixirforum.com/t/goal-a-parameter-validation-library-based-on-ecto/50735 "2023-03-06T18:58:17Z")

</div>

Hi fellow Elixirists! :wave: About 8 months ago, I wrote a blog post on validating Phoenix controller parameters using Ecto Changesets in combination with Ecto Embedded Schemas (Using Ecto changesets for API request par…

---

## [Writing validation logic only once: how to get ALL passed and failed form validations to client in realtime](https://forum.elixirforum.com/t/writing-validation-logic-only-once-how-to-get-all-passed-and-failed-form-validations-to-client-in-realtime/49841)

<div class="topic-metadata">

**Author:** [@coen.bakker](https://forum.elixirforum.com/u/coen.bakker)\
**Replies:** 8\
**Last updated:** [August 31, 2022, 4:59am UTC](https://forum.elixirforum.com/t/writing-validation-logic-only-once-how-to-get-all-passed-and-failed-form-validations-to-client-in-realtime/49841 "2022-08-31T04:59:13Z")

</div>

I can’t quite figure out whether this is or isn’t possible with Phoenix: WHAT I’M MAKING A user registration form in which the user sees, underneath each input field and at all time, the list of field validations that …

---

## [Exclusive OR in Ecto: validating that only one of two fields is given](https://forum.elixirforum.com/t/exclusive-or-in-ecto-validating-that-only-one-of-two-fields-is-given/49373)

<div class="topic-metadata">

**Author:** [@coen.bakker](https://forum.elixirforum.com/u/coen.bakker)\
**Replies:** 14\
**Last updated:** [August 10, 2022, 1:03am UTC](https://forum.elixirforum.com/t/exclusive-or-in-ecto-validating-that-only-one-of-two-fields-is-given/49373 "2022-08-10T01:03:29Z")

</div>

I have a table for a collection of tasks. Only one of the fields :expiration\_time and :expiration\_all\_day? may have a value (i.e. not be null/nil). Also, at least one should be provided. Was making a start with implemen…

---

## [How to validate both form changes as well as already persisted data?](https://forum.elixirforum.com/t/how-to-validate-both-form-changes-as-well-as-already-persisted-data/48269)

<div class="topic-metadata">

**Author:** [@gar](https://forum.elixirforum.com/u/gar)\
**Replies:** 4\
**Last updated:** [June 11, 2022, 3:01pm UTC](https://forum.elixirforum.com/t/how-to-validate-both-form-changes-as-well-as-already-persisted-data/48269 "2022-06-11T15:01:35Z")

</div>

One of our Phoenix apps has a complicated Company model (which includes attributes and associations for things like addresses, registered owners, credit checks, etc.). Our users use a single form to input all this infor…

---

## [How would you accumulate errors?](https://forum.elixirforum.com/t/how-would-you-accumulate-errors/48205)

<div class="topic-metadata">

**Author:** [@mattfara50](https://forum.elixirforum.com/u/mattfara50)\
**Replies:** 7\
**Last updated:** [June 6, 2022, 1:22am UTC](https://forum.elixirforum.com/t/how-would-you-accumulate-errors/48205 "2022-06-06T01:22:04Z")

</div>

In “Elixir in Action”, there is an example about using pattern matching with the “with” special form: with {:ok, login} \<- extract\_login(user), {:ok, email} \<- extract\_mail(user), {:ok, pw} \<- …

---

## [Ecto - Conditional validate\_required](https://forum.elixirforum.com/t/ecto-conditional-validate-required/47109)

<div class="topic-metadata">

**Author:** [@CallumVass](https://forum.elixirforum.com/u/CallumVass)\
**Replies:** 2\
**Last updated:** [April 8, 2022, 1:36pm UTC](https://forum.elixirforum.com/t/ecto-conditional-validate-required/47109 "2022-04-08T13:36:23Z")

</div>

Hi, I have a question\_type field which determines what part of a struct is required. If it is :text then the :text field is required, if it is :option then the :option\_id field is required. However, doing what I’ve done…

[Next page](https://forum.elixirforum.com/tag/validation/204.md?match_all_tags=true&page=1&tags%5B%5D=validation)
