[Proposal] Enable Lombok.toBuilder annotation flag in ResourceModel template
まだ誰も着手していません。
評価
調査の方向性
issue にリンクされている python/rpdk/java/templates/init/guided_aws/ResourceModel.java から始め、生成される ResourceModel のアノテーションがどのように組み立てられているかを調査してください。toBuilder をデフォルトで有効にすべきか、スキーマフラグとして公開すべきかを判断し、その後、生成された Java モデルが要求された builder-copy ワークフローをサポートしていることを検証してください。
索引モデルが issue の本文から書いたものです。
説明
Dear team,
I wonder if you folks would have any concerns about enabling toBuilder attribute for Lombok @Builder by default or with an additional schema flag?
At the moment, ResourceModel template generates non-parametrized @Builder: https://github.com/aws-cloudformation/cloudformation-cli-java-plugin/blob/master/python/rpdk/java/templates/init/guided_aws/ResourceModel.java#L20
One of the reasons I would like to see this flag enabled is a significant simplification of overriding massive resource model definitions in testing, especially in testing an UpdateHandler.
Here is an example:
public class AbstractTestBase {
protected static final ResourceModel MODEL_BEFORE;
protected static final ResourceModel MODEL_AFTER;
static {
MODEL_BEFORE = ResourceModel.builder()
.foo("foo-before")
.bar("bar-before")
.baz("baz-before")
.build();
MODEL_AFTER = ResourceModel.builder()
.foo("foo-before")
.bar("bar-before")
.baz("totally-different-baz")
.build();
}
}
Assume I'm using these models in UpdateHandler test suite. If the update flow has a broad branching based on model attribute invariants, one has to initiate separate model instances for each branch case. It's completely fine for a 5-10 attribute models, but the burden of carrying things around grows once one has to deal with a 30-50 attribute model.
Having toBuilder = true enabled in ResourceModel definition would let one define models like
public class AbstractTestBase {
protected static final ResourceModel MODEL_BEFORE;
protected static final ResourceModel MODEL_AFTER;
static {
MODEL_BEFORE = ResourceModel.builder()
.foo("foo-before")
.bar("bar-before")
.baz("baz-before")
.build();
MODEL_AFTER = MODEL_BEFORE.toBuilder()
.baz("totally-different-baz")
.build();
}
}
In fact, being able to override a static model locally within the current test case scope is even better, it could look like:
public class UpdateHandlerTest extends AbstractTestBase {
//...
public void handleRequest_SimpleSuccess() {
final ResourceModel modelWithUpdatedBaz = MODEL_BEFORE.toBuilder()
.baz("totally-different-baz")
.build();
//...
}
}
- 主要言語
- Java
- スター
- 30
- フォーク
- 48
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aws-cloudformation/cloudformation-cli-java-plugin のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
aws-cloudformation/cloudformation-cli-java-plugin#415 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
-
injectCredentialsAndInvokeV2 method in proxy class doesn't support API's like PutObject from S3. オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
aws-cloudformation/cloudformation-cli-java-plugin の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
elastic/gradle-plugins#157 ·
-
enhancement Tools
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
apache/rocketmq-dashboard#5008 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
DETECT_PARAMETER_NAMES=false silently disables @ConstructorProperties-based Creator detection too オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
FasterXML/jackson-databind#6229 ·