rahulsmahadev opened a new pull request, #2610:
URL: https://github.com/apache/iceberg-rust/pull/2610

   ## Summary
   
   `RestCatalog::create_table` serializes `CreateTableRequest` with explicit 
`null` values for unset optional fields (e.g. `"partition-spec": null`, 
`"write-order": null`). Strict REST catalog implementations such as Apache 
Polaris reject these requests with HTTP 400 Bad Request. This change adds 
`#[serde(skip_serializing_if = "Option::is_none")]` to the optional fields on 
the create-table wire path so unset fields are omitted from the JSON body.
   
   Fixes #2135
   
   ## Changes
   
   - `crates/catalog/rest/src/types.rs` — `CreateTableRequest`: skip 
serializing `location`, `partition_spec`, `write_order`, `stage_create` when 
`None` (`properties` was already skipped when empty).
   - `crates/iceberg/src/spec/partition.rs` — `UnboundPartitionSpec`: skip 
serializing `spec_id` when `None`; `UnboundPartitionField`: skip serializing 
`field_id` when `None`. These types are embedded in the create-table request 
body.
   
   Deserialization is unchanged: `skip_serializing_if` only affects 
serialization, and serde still accepts both missing fields and explicit `null` 
for these `Option` fields (covered by new tests).
   
   ## Test plan
   
   - `test_create_table_request_minimal_serialization` — a request with only 
required fields set serializes without the optional keys.
   - `test_create_table_request_full_serialization` — a fully-populated request 
still serializes all optional keys.
   - `test_create_table_request_deserialize_explicit_nulls` — payloads with 
explicit `null`s still deserialize (backward compatibility).
   - `test_unbound_partition_spec_serialization_skips_none_fields` — unset 
`spec-id`/`field-id` are omitted, set values serialized, explicit `null`s still 
deserialize.
   
   Note: I was unable to compile or run tests locally in my environment (no 
crates.io access); relying on CI to verify.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to