bagasprstyadi
I’m looking for a module or something that can be used for validating a graphql query/mutation on Elixir. I’ve researched for it and stumble across a cool middleware called yup-middleware: GitHub - JCMais/graphql-yup-middleware: Add validation to your mutations arguments using yup! · GitHub but it is not for elixir
Is there a same module to in elixir that can be used to validate? I know I can use Absinthe.Middleware but I was just wondering if there is such a module that is easier to use.
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
abitdodgy
Can’t you use Ecto changesets? A quick search yielded Kronky. But I’m not sure if this is what you are looking for.
Virviil
GraphQL seems to be a strong typed query language, so absinthe will validate all the parameters for you.
So, when you say “validate” what does that mean? Validate upon business logic? This probably should be done in Ecto Changesets or resolvers.
sorentwo
GraphQL types can be leveraged for data validation to a large degree, provided you make use of the tools it provides (i.e. enums). You can get additional validation through custom types like
emailorurl, but you’ll need to write the parsing and dumping yourself, and in a way that emits helpful errors.There are plenty of places where GraphQL/Absinthe can’t help you though. For example, if you want to enforce a string is a certain size, or that a particular field is filled in but another isn’t, or a provided ID actually exists in the database. You’ll need to fall back to validating with Ecto and your application’s business rules.
bagasprstyadi
If using changeset what I concern is that, there will be a lot of business logic before entering the schema right? What if I want to validate like a lot of formating for example name, email, url. I think Kronky is some module that helps you to return error message back to graphql
bagasprstyadi
Yes Graphql already provided with basic validate parameters as in :string, or :integer. But what I need is something a bit more like String is must be length of with format x. Like that
joaquinalcerro
Bagasprstyadi,
Check-out this talk where the presenter uses Ecto Changeset to create a validation layer.
https://youtu.be/k_xDi7zAcNM
Hope this helps.
Best regards,
Joaquin Alcerro
Virviil
It may be not so obvious, but you don’t need string to be with minimum length. You need password to be minimum length.
And this leads us two 2 different solutons:
You can create GraphQL type Password, it’s easily achieved with Absinthe library itself.
You can pass password as string, but validate it on your business logic. This can be done with your Ecto structures.
bagasprstyadi
Wow thank you, I will check it!
bagasprstyadi
“You can create GraphQL type Password”
This is interesting, so I can create custom type right, and then the graphql will validate it? Awesome, Im gonna look into that