fix(lambda): register EventSourceMapping nested types for native-image reflection (#1826)

EventSourceMapping.DestinationConfig and its nested OnFailure are reachable
from Lambda's persisted event-source-mapping storage but carried no
@RegisterForReflection (the annotation on the enclosing class does not cover
nested static classes). In native-image mode this breaks deserialization of a
mapping's failure destination on restart.

Annotate both nested classes with @RegisterForReflection, matching the existing
convention (IotPolicy.PolicyVersion, LambdaUrlConfig.Cors). Also add
@JsonIgnoreProperties(ignoreUnknown = true) — as the enclosing class already
has — so the nested wire shapes tolerate future AWS field additions rather than
failing deserialization. PersistedModelReflectionTest, the classpath-scan guard
that flagged this, now passes.

Refs #1629, #1781
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-07-11 00:26:35 -05:00
1 parent 9b63b31530
commit ad47b39800
1 file changed
+4
@@ -104,6 +104,8 @@ public class EventSourceMapping {
this.destinationConfig = destinationConfig;
}
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
public static class DestinationConfig {
private OnFailure onFailure;
@@ -119,6 +121,8 @@ public class EventSourceMapping {
}
}
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
public static class OnFailure {
private String destination;