kellpossible / kellpossible/form-validation

Serializable errors

Open
#6 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Implement the Serialize trait on ValidationError and ValidationErrors, converting the flat vector of errors in the latter into a HashMap.

I needed serializability so that validation errors can easily be passed to the Tera template context to be displayed on web pages, grouped by the error keys.

Working fork here:
https://github.com/pzingg/form-validation/tree/serialize

Example application using the fork to insert ValidationErrors in Tear context here:
https://github.com/pzingg/rust-starterapp/tree/rust-2021

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the definitions of ValidationError and ValidationErrors, then review the linked serialize branch for the intended behavior. Implement serialization for both types, converting ValidationErrors' flat error vector into a HashMap grouped by error keys, and verify the result can be inserted into a Tera template context.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.