5 releases
| 0.3.2 | May 21, 2026 |
|---|---|
| 0.3.1 | May 8, 2026 |
| 0.3.0 | May 8, 2026 |
| 0.2.1 | Apr 20, 2026 |
| 0.2.0 | Apr 20, 2026 |
#6 in #macro-state
Used in 5 crates
(4 directly)
79KB
2K
SLoC
Proc macros for the Cognis framework.
Macros
tool—#[cognis::tool]attribute that generates acognis_core::tools::BaseToolimplementation from anasync fn(or from animplblock containing one). Usesschemarsunder the hood for parameter schema generation.GraphState— derive macro for graph state schemas with per-field reducers (see attributes#[reducer(append|last_value|add|merge)]).
JSON Schema generation
For #[derive(JsonSchema)] on your own structs/enums, use the re-export
at cognis_core::JsonSchema (which is schemars::JsonSchema). The legacy
hand-rolled JsonSchema / ToolSchema derives in this crate were removed
in favor of the upstream schemars crate, which supports recursive types,
$ref/definitions, doc-comment → description, and richer attribute
syntax.
use cognis_core::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(JsonSchema, Serialize, Deserialize)]
struct SearchFilter {
/// Minimum relevance score
min_score: f64,
/// Categories to include
categories: Vec<String>,
}
let schema = serde_json::to_value(schemars::schema_for!(SearchFilter)).unwrap();
Dependencies
~1.8–3.5MB
~60K SLoC