1fanwang opened a new pull request, #9369:
URL: https://github.com/apache/paimon/pull/9369

   ### Purpose
   
   A REST catalog server that binds Paimon's request classes with a standard 
Jackson mapper gets `InvalidDefinitionException: no Creators, like default 
constructor, exist`.
   
   The constructors are annotated only with Paimon's relocated Jackson types. 
Standard JDK constructor metadata now exposes the existing immutable creators 
for all 11 request classes whose fields use ordinary Java types. Requests with 
nested Paimon or polymorphic types still use Paimon's mapper.
   
   Fixes https://github.com/apache/paimon/issues/6822
   
   ### Tests
   
   <details>
   <summary>Raw before/after output</summary>
   
   On master at c4308ca17:
   
   ```console
   $ mvn -pl paimon-api -DskipTests package -q
   $ CP="paimon-api/target/paimon-api-2.1-SNAPSHOT.jar:$(find 
"$HOME/.m2/repository/com/fasterxml/jackson" -path '*/2.14.2/*.jar' -print | tr 
'\n' ':')"
   $ jshell --class-path "$CP"
   jshell> import com.fasterxml.jackson.databind.ObjectMapper;
   jshell> import org.apache.paimon.rest.requests.CreateDatabaseRequest;
   jshell> new 
ObjectMapper().readValue("{\"name\":\"warehouse\",\"options\":{}}", 
CreateDatabaseRequest.class)
   Exception com.fasterxml.jackson.databind.exc.InvalidDefinitionException:
   Cannot construct instance of CreateDatabaseRequest
   (no Creators, like default constructor, exist)
   
   This branch:
   
   $ git switch fix-6822-rest-jackson-dtos
   $ mvn -pl paimon-api -DskipTests package -q
   $ jshell --class-path "$CP"
   jshell> import com.fasterxml.jackson.databind.ObjectMapper;
   jshell> import org.apache.paimon.rest.requests.CreateDatabaseRequest;
   jshell> new 
ObjectMapper().readValue("{\"name\":\"warehouse\",\"options\":{}}", 
CreateDatabaseRequest.class).getName()
   $3 ==> "warehouse"
   
   $ mvn -pl paimon-api clean verify
   Unit tests: 147 passed
   Integration tests: 24 passed
   BUILD SUCCESS
   ```
   
   The regression suite exercises ordinary Jackson deserialization and Paimon's 
shaded mapper for every supported request. It also verifies creator names, the 
simple-versus-complex request inventory, and strict versus lenient 
unknown-property handling.
   
   </details>
   


-- 
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