You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by di...@apache.org on 2025/06/30 20:20:32 UTC

(polaris) branch main updated: Do not serialize null properties in the management model (#1955)

This is an automated email from the ASF dual-hosted git repository.

dimas pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new 595e689ef Do not serialize null properties in the management model (#1955)
595e689ef is described below

commit 595e689ef0a500c175dbb1d572d38f412e9edc13
Author: Dmitri Bourlatchkov <dm...@gmail.com>
AuthorDate: Mon Jun 30 16:20:28 2025 -0400

    Do not serialize null properties in the management model (#1955)
    
    * Ignore null values in JSON output
    
    * This may have an impact on existing client, but it is not
      likely to be substantial because normally absent properties
      should be treated the same as having `null` values.
    
    * This change enables adding new optional fields to the
      Management API while maintaining backward compatibility in
      the future: New properties will not be exposed to clients
      unless a value for them in explicitly set.
---
 api/management-model/build.gradle.kts                               | 4 ++++
 .../apache/polaris/core/admin/model/CatalogSerializationTest.java   | 6 ------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/api/management-model/build.gradle.kts b/api/management-model/build.gradle.kts
index ec78abe5d..c6c808f81 100644
--- a/api/management-model/build.gradle.kts
+++ b/api/management-model/build.gradle.kts
@@ -56,6 +56,10 @@ openApiGenerate {
   additionalProperties.put("apiNamePrefix", "Polaris")
   additionalProperties.put("apiNameSuffix", "Api")
   additionalProperties.put("metricsPrefix", "polaris")
+  additionalProperties.put(
+    "additionalModelTypeAnnotations",
+    "@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)",
+  )
   serverVariables = mapOf("basePath" to "api/v1")
 }
 
diff --git a/api/management-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java b/api/management-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java
index 4648567bf..3620da417 100644
--- a/api/management-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java
+++ b/api/management-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java
@@ -66,14 +66,8 @@ public class CatalogSerializationTest {
             "{\"type\":\"INTERNAL\","
                 + "\"name\":\"test-catalog\","
                 + "\"properties\":{\"default-base-location\":\"s3://test/\"},"
-                + "\"createTimestamp\":null,"
-                + "\"lastUpdateTimestamp\":null,"
-                + "\"entityVersion\":null,"
                 + "\"storageConfigInfo\":{"
                 + "\"roleArn\":\"arn:aws:iam::123456789012:role/test-role\","
-                + "\"externalId\":null,"
-                + "\"userArn\":null,"
-                + "\"region\":null,"
                 + "\"storageType\":\"S3\","
                 + "\"allowedLocations\":[]"
                 + "}}");