luckyframework / luckyframework/avram

How to handle when the starting field value is present and an invalid param is sent

Open
#83 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

clarify api discussion
Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Let's say you have an `age : Int32` field.

You have a record with `age` as `32`. You then fill out an HTML form and set age to `thirty two`. Avram will correctly say that this is invalid. The problem is that because it is invalid `age.value` will be the old value `32`. I wonder what we should do? Is this correct behavior? We can't set it to `"thirty two"` because it is the wrong type. Maybe it should be `nil`? Or maybe this is just a weird edge case where there is no "correct" way to handle it

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.

Research direction

Start with the Int32 age field and the HTML form submission described in the issue, then trace how an invalid parameter affects the existing value. No file or test is named; the work is done when the project has an agreed behavior for age.value after invalid input and that behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.