luckyframework / luckyframework/avram
Allow String keys to be set for error messages
- Dominant language
- Crystal
- Stars
- 183
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/luckyframework/avram/blob/a604962a50f630d58b85c88e1efd5e73fbdb09f8/src/avram/operation_errors.cr#L19
I have a case where I get errors back from an API JSON. I want to pass those along in the error messages, but I can't just `add_error(err["key"].as_s, err["val"].as_s)`, and there's no way to convert JSON to Symbol, or a String to a Symbol.
The big issue here is that it becomes a major breaking change to allow both Symbol and String. I'm not sure what the solution is here, but we should definitely make this more flexible.
Contributor guide
Research direction
Start at src/avram/operation_errors.cr#L19 and inspect how error keys are currently accepted and stored. Determine a compatible way to support String keys alongside existing Symbol callers, then verify that API JSON-derived keys and current error-message behavior both work without breaking existing usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- crystal
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100