You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "fwonce (via GitHub)" <gi...@apache.org> on 2025/12/16 07:53:53 UTC

[I] [Bug] Paimon REST API Jackson Deserialization Failure [paimon]

fwonce opened a new issue, #6822:
URL: https://github.com/apache/paimon/issues/6822

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/paimon/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 use the Request classes in paimon-api at first. But Jackson cannot deserialize soem 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:
   
   ```java
   @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 exclude Jackson annotations from shading in `paimon-api` module's shade configuration. At lease, provide non-arg constructors for these classes. 
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] Paimon REST API Jackson Deserialization Failure [paimon]

Posted by "nryanov (via GitHub)" <gi...@apache.org>.
nryanov commented on issue #6822:
URL: https://github.com/apache/paimon/issues/6822#issuecomment-4477530269

   Hi!
   
   Encountered the same issue. Current solution in my case was to create a bridge between objectMapper from web-framework and shaded objectMapper in paimon. After that register all DTOs manually like that:
   ```
           var module = new SimpleModule("paimon-rest");
           PaimonRestJacksonBridge.register(module, *Request.class);
           PaimonRestJacksonBridge.register(module, *Response.class);
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] Paimon REST API Jackson Deserialization Failure [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi closed issue #6822: [Bug] Paimon REST API Jackson Deserialization Failure
URL: https://github.com/apache/paimon/issues/6822


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org