plexus_core/plexus/method_enum.rs
1//! Method enum schema trait for activations
2//!
3//! Provides a trait that method enums can implement to support schema generation
4//! with const discriminators for the method field.
5
6use schemars::JsonSchema;
7use serde_json::Value;
8
9/// Trait for method enums that can generate schema with const discriminators
10pub trait MethodEnumSchema: JsonSchema {
11 /// Get all method names as static strings
12 fn method_names() -> &'static [&'static str];
13
14 /// Generate schema with const values for method discriminators
15 ///
16 /// This takes the base schemars schema and transforms it so that
17 /// each variant's "method" field has a `const` value instead of
18 /// just `type: string`.
19 fn schema_with_consts() -> Value;
20}