idiolect-records 0.6.0

Rust record types mirroring the dev.idiolect.* Lexicon family.
Documentation
// @generated by idiolect-codegen. do not edit.
// source: dev.idiolect.vocab

//! A community-published vocabulary for ThUse — either an action hierarchy or a purpose hierarchy, depending on what the community is publishing. Structures the subsumption lattice so `action_subsumed_by` and `purpose_subsumed_by` have a shared semantics. Communities fork, extend, and re-publish under their own record id. The `world` field pins the intended subsumption discipline so consumers reason about undeclared ids consistently.

#![allow(
    missing_docs,
    clippy::doc_markdown,
    clippy::struct_excessive_bools,
    clippy::derive_partial_eq_without_eq
)]
use serde::{Deserialize, Serialize};

/// A vocabulary: a set of actions in a subsumption hierarchy, a chosen `world` discipline, and the identity of the publishing DID. Vocabularies are declarative charters over action space; observers/orchestrators resolve `action` identifiers against the referenced vocabulary record.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Vocab {
    /// Every action declared in the vocabulary, with its direct parents (declared subsumers). Edges transitively form the subsumption hierarchy.
    pub actions: Vec<ActionEntry>,
    /// Narrative description of the vocabulary's intended scope and conventions. Not consumed by machine matchers.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Human-readable vocabulary name, e.g. 'pedagogical-use-v1'.
    pub name: String,
    pub occurred_at: idiolect_records::Datetime,
    /// Prior vocabulary this one replaces. Consumers that pinned to `supersedes` may continue to resolve against it.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supersedes: Option<idiolect_records::AtUri>,
    /// Identifier of the vocabulary's top action. For 'closed-with-default', every action is transitively subsumed by `top`.
    pub top: String,
    /// Subsumption world discipline. 'closed-with-default' — every undeclared action is subsumed by `top` and nothing else. 'open' — undeclared actions are incomparable to every declared action; consumers must fall back to string equality. 'hierarchy-closed' — only the declared edges exist; undeclared actions do not subsume anything.
    pub world: VocabWorld,
}

impl crate::Record for Vocab {
    const NSID: &'static str = "dev.idiolect.vocab";
}

/// One action in the vocabulary's hierarchy: an identifier, its direct parents (actions that subsume it), and optionally the attitudinal composition class it's an instance of.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ActionEntry {
    /// Identifier of the attitudinal composition this action is an instance of (e.g. 'dev.idiolect.asserted_use', 'dev.idiolect.intended_use'). Consumers dispatch on both the action's position in the hierarchy and its attitudinal shape. Omit to inherit the vocabulary's default stance; consumers treat the class as asserted_use when absent.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub class: Option<String>,
    /// Optional human-readable description. Consumers do not match on this field; it is annotation for readers.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Stable action identifier (e.g. 'train_model', 'annotate').
    pub id: String,
    /// Direct subsumers. The action is transitively subsumed by every ancestor in the hierarchy. Empty for `top`.
    pub parents: Vec<String>,
}

/// VocabWorld.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum VocabWorld {
    ClosedWithDefault,
    Open,
    HierarchyClosed,
}