fix(rest-catalog): omit null optional fields in CreateTableRequest JSON#2136
fix(rest-catalog): omit null optional fields in CreateTableRequest JSON#2136jonbjo wants to merge 1 commit intoapache:mainfrom
Conversation
CTTY
left a comment
There was a problem hiding this comment.
This is a good catch, thanks for the fix! Do you mind adding an unit test to test serde as well?
We don't need to fix them in this PR, but it seems like we also have other Option left null by default during serialization
Add round-trip serialization tests that verify optional fields are omitted (not serialized as null) when absent, as requested in apache#2136. - CreateTableRequest: full and minimal round-trip serde test - UnboundPartitionSpec: assert serialized output matches expected JSON
|
I added some tests here. That branch is based off of jonbjo:fix/skip-serialize-null-fields, so technically I guess that other PR "Closes the issue" as well. Not sure what is the best way to do a "Fork of a fork". Any suggestions are welcome! |
Add round-trip serialization tests that verify optional fields are omitted (not serialized as null) when absent, as requested in apache#2136. - CreateTableRequest: full and minimal round-trip serde test - UnboundPartitionSpec: assert serialized output matches expected JSON
Add round-trip serialization tests that verify optional fields are omitted (not serialized as null) when absent, as requested in apache#2136. - CreateTableRequest: full and minimal round-trip serde test - UnboundPartitionSpec: assert serialized output matches expected JSON
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions. |
Which issue does this PR close?
What changes are included in this PR?
Adds #[serde(skip_serializing_if = "Option::is_none")] to optional fields in REST catalog request types to prevent serializing explicit null values.
Are these changes tested?
Existing serialization tests continue to pass. This change affects JSON wire format only (omitting null vs. including it), which maintains compatibility with catalogs that accept either format while fixing compatibility with stricter implementations like Apache Polaris.