You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(serde): return Result from ToJson schema/type/metadata serializers (#785)
## What
Change the schema/type/metadata `ToJson` serializers from returning bare
`nlohmann::json` to `Result<nlohmann::json>`:
- `json_serde`: `ToJson(SchemaField | Type | Schema | TableMetadata |
TableUpdate)`
- REST: `ToJson(CreateTableRequest | CommitTableRequest |
LoadTableResult | CommitTableResponse)`
Errors propagate via `ICEBERG_ASSIGN_OR_RAISE`; callers bottom out at
the existing `Result`-returning boundaries (`ToJsonString`,
`rest_catalog`, `TableMetadataUtil::Write`).
## Why
Preparation for v3 column default values (#730 / #746). Single-value
(`Literal`) serialization is fallible, and column defaults invoke it
from schema serialization, so these serializers need to propagate the
error instead of throwing. Splitting it out keeps the feature PR focused
on the feature.
## Notes
- **No behavior change** — every conversion still succeeds today; only
the return type changes.
- The shared `ToJsonList` template stays bare (it also serializes
infallible types such as partition specs and snapshots); `TableMetadata`
serializes its schema list with an explicit loop.
- The REST `ICEBERG_DECLARE_JSON_SERDE` macro is unchanged; the four
schema/metadata-bearing models are declared explicitly so only their
`ToJson` return type differs.
## Testing
No behavior change; existing tests are adapted to the new return type.
Full build and `ctest` pass locally.
0 commit comments