apache / apache/fesod

[Enhancement] Support @DictFormat annotation for code-label (dictionary) conversion

Open
#988 5 comments 0 reactions 0 assignees View on GitHub
discussion welcome enhancement
Dominant language
Java
Stars
6.2k
Forks
532
Avg merge
1d 3h
Merged PRs (30d)
42

Description

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/fesod/issues) and found nothing similar.

### Motivation

A field stores a code (`1`), the sheet should show a label (`Success`). Today that requires a hand-written `Converter` class per dictionary - there's no built-in way to declare a code↔label mapping on a field.

### Solution

An annotation-based dictionary converter, `@DictFormat`, with an inline `"code=label"` form and an enum-backed form for dictionaries that already exist in the domain model.

Full design (API shape, field-type scope, validation rules, and two open questions) is written up here:
https://github.com/apache/fesod/issues/198#issuecomment-3151234567
To avoid duplication, I will not repeat the same here.

I am open to changes. If this gets approved and someone answers the 2 questions mentioned there, then I can start gradually implementing that.

### Alternatives

_No response_

### Anything else?

Related: #198 (original request, Jan 2025)

### Are you willing to submit a PR?

- [x] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Start with the full design in issue #198, especially its linked comment, and review the proposed @DictFormat API, inline code=label form, enum-backed form, field-type scope, validation rules, and two open questions. Confirm the design decisions before implementation; done means the approved annotation-based dictionary conversion is implemented and covered for the agreed scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.