Skip to content

[Bug] Paimon REST API Jackson Deserialization Failure #6822

@fwonce

Description

@fwonce

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version

Component: paimon-api (version 1.3.1)

Compute Engine

Not relevant to compute engines.

Minimal reproduce step

Issue: When implementing a REST Catalog server on my own behalf, definitely I used the Request classes in paimon-api at first. But Jackson cannot deserialize some of them like CreateDatabaseRequest and AlterDatabaseRequest due to shaded @JsonCreator annotations not being recognized.

Root Cause

The @JsonCreator and @JsonProperty annotations in Paimon's REST API request classes (e.g., org.apache.paimon.rest.requests.CreateDatabaseRequest) are shaded into the paimon-api.jar. When Jackson tries to deserialize JSON payloads, it cannot recognize these shaded annotations, resulting in:

InvalidDefinitionException: Cannot construct instance of `org.apache.paimon.rest.requests.CreateDatabaseRequest` 
(no Creators, like default constructor, exist): cannot deserialize from Object value 
(no delegate- or property-based Creator)

What doesn't meet your expectations?

Endpoints that accept these Paimon request DTOs fail with HTTP 500. Prevents external systems from calling REST APIs.

Anything else?

Workaround

Create wrapper DTOs with un-shaded Jackson annotations:

@Data
public static class CreateDatabaseRequest {
  @JsonProperty("name")
  private String name;
  
  @JsonProperty("options")
  private Map<String, String> options;
  
  @JsonCreator
  public CreateDatabaseRequest(
      @JsonProperty("name") String name,
      @JsonProperty("options") Map<String, String> options) {
    this.name = name;
    this.options = options;
  }
}

Recommendation

Paimon should use Jackson annotations rather than the shaded ones, and use provided scope in pom.xml I guess. Or just provide non-arg constructors for these classes directly, if there is no significant advantages for using these syntax candies of Jackson.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions