grok-build-upstream-mirror/crates/codegen/xai-grok-tools-api/build.rs

34 lines
1.3 KiB
Rust
Raw Normal View History

fn main() {
xai_proto_build::configure()
.type_attribute(
".", // match every message & enum
"#[derive(serde::Serialize, serde::Deserialize)]",
)
// ToolConfigEntry is embedded in external JSON contracts (Computer Hub
// `session.bind` metadata and agent-config JSON) where sparse payloads
// must deserialize. Defaults are applied per optional field (not
// type-level) so the required `id` field still fails deserialization
// when missing instead of silently becoming "". See tests/wire_shape.rs.
.field_attribute(
".xai.grok.tools.v1.ToolConfigEntry.params_json",
"#[serde(default)]",
)
.field_attribute(
".xai.grok.tools.v1.ToolConfigEntry.name_override",
"#[serde(default)]",
)
.field_attribute(
".xai.grok.tools.v1.ToolConfigEntry.params_name_overrides",
"#[serde(default)]",
)
.field_attribute(
".xai.grok.tools.v1.ToolConfigEntry.behavior_version",
"#[serde(default)]",
)
.field_attribute(
".xai.grok.tools.v1.ToolConfigEntry.description_override",
"#[serde(default)]",
)
.compile_protos(&["proto/grok-tools.proto"], &["proto/"])
.unwrap();
}