eclipse-vertx / eclipse-vertx/vertx-codegen
Introduce custom formatter for json property names
- 主要言語
- Java
- スター
- 111
- フォーク
- 88
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
#### Describe the feature
Introduce custom formatter for json property names
#### Use cases
I have a POJO which is annotated with @DataObject (vertx-codegen) to convert it into JSON and back. This POJO has an attribute called "endpointConfigs", but in the JSON I want to call it "endpoints". I saw that @DataObject has a property called "jsonPropertyNameFormatter", which I think is exactly what I need.
#### Contribution
I would try to implement this feature. @vietj gave me already some entry points in discord, which I will add to this description then we have everything on one page.
Place to choose the formatter [1].
##### Discord messages
- ideally we should be able to support loading this class from a classloader
- I think the most difficult issue is using the correct classloader for this
- Introducing a new classloader and configure the classpath in codegen config is the wrong direction, because it adds more complexcity.
- if you look at loadJsonMappers we do use getClass().getClassLoader() so perhaps it should simply work with this
- you need two projects one jar with the Case one project that use it from compilation classpath (I hope I can solve it more elegant with just in time compilation)
[1] https://github.com/vert-x3/vertx-codegen/blob/730d4f707ef4eb8d6dca489614b9a5e9e0e3c182/src/main/java/io/vertx/codegen/generators/dataobjecthelper/DataObjectHelperGen.java#L349
コントリビューションガイド
調査の方向性
src/main/java/io/vertx/codegen/generators/dataobjecthelper/DataObjectHelperGen.java の、参照されている formatter 選択箇所の周辺から始め、既存の loadJsonMappers の classloader 処理を調べます。コンパイル classpath から formatter をロードする方法を定義し、issue に記載された 2 プロジェクトのシナリオを検証します。@DataObject が JSON 変換の両方向で endpointConfigs を endpoints にマッピングできれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100