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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to