Skip to content

fix(rest-catalog): omit null optional fields in CreateTableRequest JSON#2335

Open
jonbjo wants to merge 2 commits intoapache:mainfrom
jonbjo:fix/skip-serialize-null-fields
Open

fix(rest-catalog): omit null optional fields in CreateTableRequest JSON#2335
jonbjo wants to merge 2 commits intoapache:mainfrom
jonbjo:fix/skip-serialize-null-fields

Conversation

@jonbjo
Copy link
Copy Markdown

@jonbjo jonbjo commented Apr 15, 2026

Summary

This PR fixes the serialization of optional fields in CreateTableRequest and related types to ensure they are omitted (rather than serialized as null) when None.

This addresses issue where REST catalog implementations may reject requests with explicit null values for optional fields.

Changes

  • Added #[serde(skip_serializing_if = "Option::is_none")] to optional fields in:
    • CreateTableRequest: location, partition_spec, write_order, stage_create
    • UnboundPartitionField: field_id
    • UnboundPartitionSpec: spec_id
  • Added comprehensive unit test test_create_table_request_serde to verify serialization behavior

Test Plan

Added unit test that verifies:

  • Full serialization with all optional fields present
  • Minimal serialization with only required fields (optional fields omitted, not null)

Related

Closes #2135

Jonas Björk added 2 commits April 15, 2026 20:17
Add test to verify that optional fields are properly omitted (not
serialized as null) when None, addressing reviewer feedback.

Test cases cover both full serialization with all optional fields
present and minimal serialization with only required fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REST catalog CreateTableRequest sends explicit null values, causing 400 errors with Polaris

1 participant