Skip to content

Looks like jackson's annotations are ignored #2453

Closed
@botbfr

Description

@botbfr

Hi,

Describe the issue

I have overriden RequestHandler<I, O> with my lambda. All the jackson's annotations in my pojo (PreSignUpEvent) are ignored (Tested with JsonProperty so far). => The attributes that does not require an annotation are correctly deserialized (Because the attribute's name is the same than the object attribute's name) but not the ones with 2 different names (that's why I need to use JsonProperty annotation)

I'm using jackson v2 annotations.

I tried with RequestStreamHandler, calling in my lambda 'new ObjectMapper().readValue(InputStream, MyPojo.class)' and it worked. The annotations are taken into account.

My pojo and the lambda (just for the example here, I tried with the field 'version' -> versionn):

public class PreSignUpEvent {

    @JsonProperty("version")
    private int versionn;

    private String region;


    public PreSignUpEvent() {
    }

    public int getVersionn() {
        return versionn;
    }

    public void setVersionn(int versionn) {
        this.versionn = versionn;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }
@Named("validateUsername")
public class ValidateUsername implements RequestHandler<PreSignUpEvent, PreSignUpEvent> {

    @Override
    public PreSignUpEvent handleRequest(PreSignUpEvent input, Context context) {
 {
        LambdaLogger logger = context.getLogger();
        logger.log("input is "+input);
        return input;
}

logs:

{"region":"eu-west-1"} and version is ignored.

Do you have any idea ? Is it link to a reflection issue ?

Steps to Reproduce

  • Override RequestHandler<I, O> lambda,
  • Create a pojo that needs annotations to be deserialized

Your Environment

  • AWS Java SDK version used: 1.11.894
  • JDK version used: 1.8.0_162
  • Operating System and version: mac os

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions