Elixir and parameter validation on APIs

Open
#118 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
elixir
Domain
api, backend

Research direction

No repository files, tests, or entry points are identified in the issue. Start by reviewing the linked discussions and the goal project, then define the API validation approach and its acceptance criteria before locating implementation work.

Written by the indexing model from the issue text.

Description

discuss elixir technical

JSON schema validation is usually a must when implementing an API.

When the API is simple, you can probably get away with simple validations but when you have multiple possible query or URI parameters, keeping its validation clean and concise helps with readability.

There is some discussion on how to do this with Elixir/Phoenix:

Using Ecto.Changesets is usually the standard. Although I personally use Changesets for validation on a database level, it might be not the same situation for validation on an API-level, where we might want another set of constraints to be met.

Schemaless changesets can (and should!) be actually used for this. But I feel like this produces a considerable amount of boilerplate code.

With this in mind, I've taken a gander and found goal, which seems to make this process painless and make code much more comprehensible, as errors are returned on an atom-basis.

Just food for thought 🧠

Dominant language
JavaScript
Stars
291
Forks
25
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dwyl/technology-stack

All issues in dwyl/technology-stack

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.