Context
lib.rs defines three macros:
field! (lines 46-133) — generates serde_json::Value maps via schemars. Only used in tests/test_field_macro.rs.
sign! (lines 135-171) — inline signature + Predict creation. Zero callers currently.
hashmap! (lines 178-187) — convenience HashMap literal. Used in tests/examples.
These are ergonomic features for the untyped path. field! and sign! use schemars::schema_for!() to generate JSON schemas, which is the pre-V1 approach. The typed path uses #[derive(Signature)] + SignatureSchema::of::<S>().
What's needed
field! macro
- Should emit typed
FieldSchema values instead of serde_json::Value maps
- Or consider if
#[derive(Signature)] makes this macro redundant
sign! macro
- Should work with the typed
Signature derive and produce a Predict<__InlineSignature> that's fully wired (accessor registration, etc.)
- Currently generates a derive but doesn't call
register_predict_accessor or build()
hashmap! macro
- Low priority.
HashMap::from([...]) is standard Rust. Keep or kill, doesn't matter much.
schemars dependency
__macro_support re-exports schemars solely for field!
- Once field! is modernized, schemars can be dropped from Cargo.toml (also requires specials.rs migration, see related issue)
Related
Context
lib.rsdefines three macros:field!(lines 46-133) — generatesserde_json::Valuemaps via schemars. Only used intests/test_field_macro.rs.sign!(lines 135-171) — inline signature + Predict creation. Zero callers currently.hashmap!(lines 178-187) — convenience HashMap literal. Used in tests/examples.These are ergonomic features for the untyped path.
field!andsign!useschemars::schema_for!()to generate JSON schemas, which is the pre-V1 approach. The typed path uses#[derive(Signature)]+SignatureSchema::of::<S>().What's needed
field! macro
FieldSchemavalues instead ofserde_json::Valuemaps#[derive(Signature)]makes this macro redundantsign! macro
Signaturederive and produce aPredict<__InlineSignature>that's fully wired (accessor registration, etc.)register_predict_accessororbuild()hashmap! macro
HashMap::from([...])is standard Rust. Keep or kill, doesn't matter much.schemars dependency
__macro_supportre-exports schemars solely forfield!Related