pub struct PluginSchema {
pub namespace: String,
pub version: String,
pub description: String,
pub long_description: Option<String>,
pub self_hash: String,
pub children_hash: Option<String>,
pub hash: String,
pub methods: Vec<MethodSchema>,
pub children: Option<Vec<ChildSummary>>,
pub request: Option<Value>,
pub deprecation: Option<DeprecationInfo>,
}Expand description
A plugin’s schema with methods and child summaries.
Children are represented as summaries (namespace, description, hash) rather
than full recursive schemas. This enables lazy traversal - clients can fetch
child schemas individually via {namespace}.schema.
- Leaf plugins have
children = None - Hub plugins have
children = Some([ChildSummary, ...])
Fields§
§namespace: StringThe plugin’s namespace (e.g., “echo”, “plexus”)
version: StringThe plugin’s version (e.g., “1.0.0”)
description: StringShort description of the plugin (max 15 words)
long_description: Option<String>Detailed description of the plugin (optional)
self_hash: StringHash of ONLY this plugin’s methods (ignores children) Changes when method signatures, names, or descriptions change
children_hash: Option<String>Hash of ONLY child plugin hashes (None for leaf plugins) Changes when any child’s hash changes (recursively)
hash: StringComposite hash = hash(self_hash + children_hash) Use this if you want a single hash for the entire subtree Backward compatible with previous single-hash system
methods: Vec<MethodSchema>Methods exposed by this plugin
children: Option<Vec<ChildSummary>>Derive from MethodRole on MethodSchema. Field will be removed in 0.7.
Child plugin summaries (None = leaf plugin, Some = hub plugin)
§Deprecated (IR-4)
This side-table is deterministically derived from the method list’s
MethodRole tags (one ChildSummary per non-Rpc method). It stays
on the wire for back-compat during the 0.5 transition window and is
slated for removal in 0.6.
Consumers reading child metadata should switch to iterating
methods and filtering by role != MethodRole::Rpc. The name field
on each MethodSchema is the child’s namespace.
request: Option<Value>JSON Schema for the HTTP request type this activation extracts from incoming connections.
Present when the activation declares request = MyRequest in #[plexus::activation(...)].
The schema includes x-plexus-source extension fields on each property describing
where each field is sourced from (cookie, header, query param, peer address, etc.).
Clients can use this to understand what request data the activation expects and to generate appropriate authentication/context documentation.
deprecation: Option<DeprecationInfo>If set, this whole activation is deprecated.
Added in IR-5. Defaults to None via #[serde(default)] so pre-IR
schemas deserialize cleanly.
Populated by the #[deprecated(...)] attribute on the impl Activation for Foo block (IR-5).
Implementations§
Source§impl PluginSchema
impl PluginSchema
Sourcepub fn derive_legacy_fields(
methods: &[MethodSchema],
) -> (Vec<ChildSummary>, bool)
pub fn derive_legacy_fields( methods: &[MethodSchema], ) -> (Vec<ChildSummary>, bool)
Derive the deprecated (children, is_hub) side-table fields from a
role-tagged method list.
Added in IR-4 as the centralized shim that backfills the
pre-IR children: Option<Vec<ChildSummary>> and is_hub: bool
representations from the authoritative MethodRole on each
MethodSchema.
§Semantics
One ChildSummary is produced per non-Rpc method, preserving the
source order. The shim writes:
| Field | Value |
|---|---|
namespace | The method’s name. |
description | The method’s description. |
hash | Empty string — the shim does not compute child hashes. Callers that want per-child hashes must populate them out-of-band. |
The returned bool matches PluginSchema::is_hub_by_role — true
iff at least one method carries a child role.
§Example
use plexus_core::plexus::schema::{MethodRole, MethodSchema, PluginSchema};
let methods = vec![
MethodSchema::new("ping", "rpc", "h1"),
MethodSchema::new("kid", "static child", "h2")
.with_role(MethodRole::StaticChild),
];
let (children, is_hub) = PluginSchema::derive_legacy_fields(&methods);
assert_eq!(children.len(), 1);
assert_eq!(children[0].namespace, "kid");
assert!(is_hub);Sourcepub fn leaf(
namespace: impl Into<String>,
version: impl Into<String>,
description: impl Into<String>,
methods: Vec<MethodSchema>,
) -> Self
pub fn leaf( namespace: impl Into<String>, version: impl Into<String>, description: impl Into<String>, methods: Vec<MethodSchema>, ) -> Self
Create a new leaf plugin schema (no children)
Sourcepub fn leaf_with_long_description(
namespace: impl Into<String>,
version: impl Into<String>,
description: impl Into<String>,
long_description: impl Into<String>,
methods: Vec<MethodSchema>,
) -> Self
pub fn leaf_with_long_description( namespace: impl Into<String>, version: impl Into<String>, description: impl Into<String>, long_description: impl Into<String>, methods: Vec<MethodSchema>, ) -> Self
Create a new leaf plugin schema with long description
Sourcepub fn hub(
namespace: impl Into<String>,
version: impl Into<String>,
description: impl Into<String>,
methods: Vec<MethodSchema>,
children: Vec<ChildSummary>,
) -> Self
pub fn hub( namespace: impl Into<String>, version: impl Into<String>, description: impl Into<String>, methods: Vec<MethodSchema>, children: Vec<ChildSummary>, ) -> Self
Create a new hub plugin schema (with child summaries)
Sourcepub fn hub_with_long_description(
namespace: impl Into<String>,
version: impl Into<String>,
description: impl Into<String>,
long_description: impl Into<String>,
methods: Vec<MethodSchema>,
children: Vec<ChildSummary>,
) -> Self
pub fn hub_with_long_description( namespace: impl Into<String>, version: impl Into<String>, description: impl Into<String>, long_description: impl Into<String>, methods: Vec<MethodSchema>, children: Vec<ChildSummary>, ) -> Self
Create a new hub plugin schema with long description
Sourcepub fn is_hub(&self) -> bool
👎Deprecated since 0.5: Use PluginSchema::is_hub_by_role() which reads MethodRole from methods. This method will be removed in 0.7.
pub fn is_hub(&self) -> bool
Use PluginSchema::is_hub_by_role() which reads MethodRole from methods. This method will be removed in 0.7.
Check if this is a hub.
Returns true iff the plugin exposes child activations. As of IR-2,
this is derived from either source of truth:
- Any method tagged with a child
MethodRole(StaticChildorDynamicChild { .. }). This is the post-IR-3 authoritative signal. - The legacy
children: Option<Vec<ChildSummary>>field isSome. Preserved for back-compat during the IR transition window — today’s macros populatechildrenbut not yetrole.
§Deprecated (IR-4)
The legacy transition-window fallback on children.is_some() is
redundant now that MethodRole tags are authoritative. Callers
should migrate to PluginSchema::is_hub_by_role, which reads
only role-tagged methods. This method will be removed in 0.7.
Sourcepub fn is_hub_by_role(&self) -> bool
pub fn is_hub_by_role(&self) -> bool
Returns true iff any method carries a child MethodRole.
This is the derived query specified by IR-2: it reads only
self.methods, ignoring the legacy children side channel. Use this
when you want the post-IR-3 authoritative answer without the transition
fallback that is_hub() provides.
Sourcepub fn with_deprecation(self, info: DeprecationInfo) -> Self
pub fn with_deprecation(self, info: DeprecationInfo) -> Self
Mark this plugin as deprecated.
Added in IR-5. Populates the deprecation field with the provided
DeprecationInfo. Populated by the #[deprecated(...)] attribute on
an impl Activation for Foo block via plexus-macros.
Trait Implementations§
Source§impl Clone for PluginSchema
impl Clone for PluginSchema
Source§fn clone(&self) -> PluginSchema
fn clone(&self) -> PluginSchema
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PluginSchema
impl Debug for PluginSchema
Source§impl<'de> Deserialize<'de> for PluginSchema
impl<'de> Deserialize<'de> for PluginSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for PluginSchema
impl JsonSchema for PluginSchema
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more