pub struct RelationshipDef {
pub name: String,
pub description: String,
pub when_to_use: Option<String>,
pub default_weight: f32,
pub per_edge_description: PerEdgeDescription,
pub acyclic: bool,
pub derivation: bool,
pub source_types: Vec<String>,
pub target_types: Vec<String>,
pub cardinality_per_source: Option<Cardinality>,
pub manual_authoring: ManualAuthoring,
}Fields§
§name: String§description: String§when_to_use: Option<String>§default_weight: f32§per_edge_description: PerEdgeDescriptionPer-edge description posture for edges of this rel-type:
forbidden (default) rejects any trailing description text;
optional accepts edges with or without a description;
required rejects edges without a description. The schema
author opts a catch-all rel-type (e.g. OTHER) into
required to force per-edge documentation; most rel-types
keep the default forbidden posture so the rel-type’s name
is the edge’s documentation.
acyclic: boolWhen true, the engine rejects writes that would close a cycle in the
subgraph restricted to edges of this relationship type. Defaults to
false so existing user schemas stay opt-in. Semantically meaningless
on the _default sentinel (never a real edge’s rel_type).
derivation: boolWhen true, edges of this rel-type declare that the SOURCE
derives from the TARGET (agent-trust plan 12). Exactly three
effects, warn-tier forever: (1) explicitly writing such an
edge records the target’s current content hash as the edge’s
baseline in the engine-owned derivations sidecar (never in the
markdown, never in _hash); (2) the include-gated
stale_derivations health axis reports every such edge whose
target’s current hash differs from its baseline — and edges
with no baseline as unbaselined, distinctly; (3) a
duplicate-add memstead_relate on such an edge refreshes the
baseline as its one effect — the agent’s explicit “reviewed,
still holds” — and the response says so. Never a write-block.
source_types: Vec<String>Schema-declared types whose entities may be the source of this
edge. Empty (default) means shape-free — any source type admitted.
The loader validates every entry against the schema’s declared
types list; unknown names raise SchemaLoadError::UndeclaredType.
At write time, memstead_relate rejects shape violations with
INVALID_REL_SHAPE.
target_types: Vec<String>Same as source_types but for the target side. Empty = shape-free.
cardinality_per_source: Option<Cardinality>Per-source cardinality hint, parsed and stored on the relationship definition. Declarative only — the engine does not currently enforce it or warn when a relate pushes the source’s outgoing count for this rel_type outside the declared range.
Manual-authoring posture for this rel-type. allow (default)
admits explicit memstead_relate calls. warn lands the relation
with a RELATION_MANUAL_AUTHORING_NOT_RECOMMENDED warning.
forbidden refuses explicit-author calls with the typed
RELATION_MANUAL_AUTHORING_FORBIDDEN code. The body-link →
relation alias machinery (memstead_update / memstead_create’s
wiki-link parser) is NOT gated — schema-emitted relations like
REFERENCES synthesise unchanged.
Trait Implementations§
Source§impl Clone for RelationshipDef
impl Clone for RelationshipDef
Source§fn clone(&self) -> RelationshipDef
fn clone(&self) -> RelationshipDef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RelationshipDef
impl Debug for RelationshipDef
Source§impl<'de> Deserialize<'de> for RelationshipDef
impl<'de> Deserialize<'de> for RelationshipDef
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 RelationshipDef
impl JsonSchema for RelationshipDef
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