[Proposal] Enable Lombok.toBuilder annotation flag in ResourceModel template
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 45/100
Rechercherichtung
Beginnen Sie mit python/rpdk/java/templates/init/guided_aws/ResourceModel.java, das im Issue verlinkt ist, und untersuchen Sie, wie die Annotationen für generierte ResourceModel zusammengestellt werden. Klären Sie, ob toBuilder standardmäßig aktiviert oder als Schema-Flag verfügbar gemacht werden sollte, und überprüfen Sie anschließend, dass generierte Java-Modelle den angeforderten Builder-Copy-Workflow unterstützen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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();
//...
}
}
- Vorherrschende Sprache
- Java
- Sterne
- 30
- Forks
- 48
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus aws-cloudformation/cloudformation-cli-java-plugin
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
aws-cloudformation/cloudformation-cli-java-plugin#415 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 42/100
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 20/100
-
injectCredentialsAndInvokeV2 method in proxy class doesn't support API's like PutObject from S3. Offen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
Alle Issues in aws-cloudformation/cloudformation-cli-java-plugin
Ähnliche Issues
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Offenarea/plugin
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
kestra-io/plugin-kestra#190 ·
-
litertlm-android AAR ships no consumer ProGuard rules → "mid == null" SIGABRT in minified apps Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
apache/rocketmq-dashboard#5064 ·