Skip to content

Stop overriding ObjectMapper naming strategy in Lambda recorder#53116

Open
tiwari91 wants to merge 1 commit intoquarkusio:mainfrom
tiwari91:fix-52985-lambda-objectmapper
Open

Stop overriding ObjectMapper naming strategy in Lambda recorder#53116
tiwari91 wants to merge 1 commit intoquarkusio:mainfrom
tiwari91:fix-52985-lambda-objectmapper

Conversation

@tiwari91
Copy link
Contributor

Fixes: #52985

AmazonLambdaMapperRecorder.initObjectMapper() unconditionally called .setPropertyNamingStrategy(PropertyNamingStrategies.LOWER_CAMEL_CASE) on the ObjectMapper used by the Lambda runtime. This silently overrode any application-configured naming strategy (e.g., SNAKE_CASE or KEBAB_CASE), breaking serialization consistency for user DTOs.

Changes

  • Removed the .setPropertyNamingStrategy(LOWER_CAMEL_CASE) call from initObjectMapper(), so the application's configured naming strategy is preserved.
  • Added @JsonNaming(PropertyNamingStrategies.LowerCamelCaseStrategy.class) to FunctionError, the only internal runtime class serialized by this mapper that lacks explicit @JsonProperty/@JsonGetter annotations. This ensures error reports to the Lambda runtime always use the expected errorType/errorMessage field names regardless of the application's naming strategy.
  • Added ObjectMapperNamingStrategyTest verifying that FunctionError always serializes as camelCase even with a SNAKE_CASE mapper, and that user DTOs respect their configured naming strategy.

Why other internal classes don't need changes

  • ClientContextImpl and ClientImpl already have explicit @JsonGetter/@JsonSetter annotations with hardcoded field names.
  • CognitoIdentity (AWS SDK interface) getter names produce camelCase by default, matching the AWS JSON format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AmazonLambdaMapperRecorder overrides ObjectMapper property naming strategy, breaking consistent serialization

1 participant