@@ -38,15 +38,12 @@ namespace iceberg::rest {
3838template <typename Model>
3939Result<Model> FromJson (const nlohmann::json& json);
4040
41- // Declares the two FromJson entry points for a model.
42- #define ICEBERG_DECLARE_FROM_JSON (Model ) \
41+ #define ICEBERG_DECLARE_JSON_SERDE (Model ) \
4342 ICEBERG_REST_EXPORT Result<Model> Model##FromJson(const nlohmann::json& json); \
4443 \
4544 template <> \
46- ICEBERG_REST_EXPORT Result<Model> FromJson (const nlohmann::json& json);
47-
48- #define ICEBERG_DECLARE_JSON_SERDE (Model ) \
49- ICEBERG_DECLARE_FROM_JSON (Model) \
45+ ICEBERG_REST_EXPORT Result<Model> FromJson (const nlohmann::json& json); \
46+ \
5047 ICEBERG_REST_EXPORT nlohmann::json ToJson (const Model& model);
5148
5249// / \note Don't forget to add `ICEBERG_DEFINE_FROM_JSON` to the end of
@@ -64,19 +61,33 @@ ICEBERG_DECLARE_JSON_SERDE(RegisterTableRequest)
6461ICEBERG_DECLARE_JSON_SERDE (RenameTableRequest)
6562ICEBERG_DECLARE_JSON_SERDE (OAuthTokenResponse)
6663
67- // These models embed a Schema/TableMetadata whose default-value serialization can
68- // fail, so their ToJson returns Result; FromJson is declared like the others.
69- ICEBERG_DECLARE_FROM_JSON (LoadTableResult)
64+ #undef ICEBERG_DECLARE_JSON_SERDE
65+
66+ // These models embed a Schema/TableMetadata whose default-value serialization can fail,
67+ // so their ToJson returns Result. FromJson is declared like the macro-based models above.
68+ ICEBERG_REST_EXPORT Result<LoadTableResult> LoadTableResultFromJson (
69+ const nlohmann::json& json);
70+ template <>
71+ ICEBERG_REST_EXPORT Result<LoadTableResult> FromJson (const nlohmann::json& json);
7072ICEBERG_REST_EXPORT Result<nlohmann::json> ToJson (const LoadTableResult& model);
71- ICEBERG_DECLARE_FROM_JSON (CreateTableRequest)
73+
74+ ICEBERG_REST_EXPORT Result<CreateTableRequest> CreateTableRequestFromJson (
75+ const nlohmann::json& json);
76+ template <>
77+ ICEBERG_REST_EXPORT Result<CreateTableRequest> FromJson (const nlohmann::json& json);
7278ICEBERG_REST_EXPORT Result<nlohmann::json> ToJson (const CreateTableRequest& model);
73- ICEBERG_DECLARE_FROM_JSON (CommitTableRequest)
79+
80+ ICEBERG_REST_EXPORT Result<CommitTableRequest> CommitTableRequestFromJson (
81+ const nlohmann::json& json);
82+ template <>
83+ ICEBERG_REST_EXPORT Result<CommitTableRequest> FromJson (const nlohmann::json& json);
7484ICEBERG_REST_EXPORT Result<nlohmann::json> ToJson (const CommitTableRequest& model);
75- ICEBERG_DECLARE_FROM_JSON (CommitTableResponse)
76- ICEBERG_REST_EXPORT Result<nlohmann::json> ToJson (const CommitTableResponse& model);
7785
78- #undef ICEBERG_DECLARE_FROM_JSON
79- #undef ICEBERG_DECLARE_JSON_SERDE
86+ ICEBERG_REST_EXPORT Result<CommitTableResponse> CommitTableResponseFromJson (
87+ const nlohmann::json& json);
88+ template <>
89+ ICEBERG_REST_EXPORT Result<CommitTableResponse> FromJson (const nlohmann::json& json);
90+ ICEBERG_REST_EXPORT Result<nlohmann::json> ToJson (const CommitTableResponse& model);
8091
8192ICEBERG_REST_EXPORT Result<PlanTableScanResponse> PlanTableScanResponseFromJson (
8293 const nlohmann::json& json,
0 commit comments