Generating Iceberg REST Catalog Client
This guide explains how to regenerate the Rust client code for the Iceberg REST Catalog from the OpenAPI specification.
Prerequisites
To regenerate the REST client from the OpenAPI specification, you need to install the OpenAPI Generator CLI:
brew install openapi-generator
For other installation methods, see the OpenAPI Generator CLI Installation Guide.
Configuration
Generator configuration is defined in crates/sail-catalog-iceberg/spec/openapi-generator-config.yaml
.
Generating the REST Client
The REST client is auto-generated from the Iceberg REST Catalog OpenAPI spec.
To regenerate the client code, run the generation script from the repository root:
./crates/sail-catalog-iceberg/spec/generate-client.sh
Or from the spec directory:
cd crates/sail-catalog-iceberg/spec
./generate-client.sh
The script will:
- Generate Rust client code from the OpenAPI spec using
--schema-mappings
to use custom types fromsrc/types/
- Extract
apis/
andmodels/
directories tosrc/
- Format the generated code with
cargo fmt
The generated code will be placed in src/apis/
and src/models/
.
Schema Mappings
The generator uses custom type mappings to avoid problematic generated code:
Type
,StructType
,ListType
,MapType
,StructField
→crate::types::{Type,StructType,ListType,MapType, NestedFieldRef}
Post-Generation Manual Steps
After running the generation script, you must manually fix the following:
In
src/apis/o_auth2_api_api.rs
:- Replace
models::models::TokenType
withmodels::TokenType
- Replace
In
src/models/schema.rs
:- Replace
models::StructField
withNestedFieldRef
- Replace