Sign in

    #Architecture values

    Architecture values retain authored identities and explicit connections. Constructors copy collections. Parent ownership, ports, independent arrowheads, parallel connection identities and ordered alignments remain separate values.

    ///|
    test "architecture constructors" {
    let services = [
    @architecture.Service::new("api"),
    @architecture.Service::new("db"),
    ]
    let edge = @architecture.Connection::new(
    "request",
    @architecture.Endpoint::new("api", Right),
    @architecture.Endpoint::new("db", Left),
    target_head=true,
    )
    let architecture = @architecture.Architecture::new("example", services[:], [
    edge,
    ])
    assert_eq(@architecture.validate(architecture).length(), 0)
    }

    validate has explicit node, connection, depth and work limits. It reports missing/duplicate identities, invalid parents, ownership cycles, invalid endpoints, unowned group attachments and invalid alignment members. Validation does not invent nodes or repair ownership. No syntax, renderer or host API is required to construct or validate a model.

    Alignment

    pub struct Alignment {
    axis : Axis
    members : ReadOnlyArray[String]
    } derive(Eq,
    Debug
    )

    Alignment::equal

    fn Alignment::equal(Alignment, Alignment) -> Bool

    Alignment::new

    fn Alignment::new(axis : Axis, members : ArrayView[String]) -> Alignment

    Alignment::not_equal

    fn Alignment::not_equal(x : Alignment, y : Alignment) -> Bool

    Architecture

    pub struct Architecture {
    id : String
    groups : ReadOnlyArray[Group]
    services : ReadOnlyArray[Service]
    junctions : ReadOnlyArray[Junction]
    connections : ReadOnlyArray[Connection]
    alignments : ReadOnlyArray[Alignment]
    title : String?
    accessibility_title : String?
    accessibility_description : String?
    } derive(Eq,
    Debug
    )

    Architecture::equal

    Architecture::new

    fn Architecture::new(id : String, services : ArrayView[Service], connections : ArrayView[Connection], groups? : ArrayView[Group], junctions? : ArrayView[Junction], alignments? : ArrayView[Alignment], title? : String, accessibility_title? : String, accessibility_description? : String) -> Architecture

    Architecture::not_equal

    fn Architecture::not_equal(x : Architecture, y : Architecture) -> Bool

    Axis

    pub(all) enum Axis {
    Row
    Column
    } derive(Eq,
    Debug
    )

    Axis::equal

    fn Axis::equal(Axis, Axis) -> Bool

    Axis::not_equal

    fn Axis::not_equal(x : Axis, y : Axis) -> Bool

    Axis::to_repr

    Connection

    pub struct Connection {
    id : String
    source : Endpoint
    target : Endpoint
    label : String?
    source_head : Bool
    target_head : Bool
    } derive(Eq,
    Debug
    )

    Connection::equal

    fn Connection::equal(Connection, Connection) -> Bool

    Connection::new

    fn Connection::new(id : String, source : Endpoint, target : Endpoint, label? : String, source_head? : Bool, target_head? : Bool) -> Connection

    Connection::not_equal

    fn Connection::not_equal(x : Connection, y : Connection) -> Bool

    Endpoint

    pub struct Endpoint {
    id : String
    side : Side
    group : Bool
    } derive(Eq,
    Debug
    )

    Endpoint::equal

    fn Endpoint::equal(Endpoint, Endpoint) -> Bool

    Endpoint::new

    fn Endpoint::new(id : String, side : Side, group? : Bool) -> Endpoint

    Endpoint::not_equal

    fn Endpoint::not_equal(x : Endpoint, y : Endpoint) -> Bool

    Endpoint::to_repr

    Group

    pub struct Group {
    id : String
    label : String
    parent : String?
    icon :
    Reference
    ?
    } derive(Eq,
    Debug
    )

    Group::equal

    fn Group::equal(Group, Group) -> Bool

    Group::new

    fn Group::new(id : String, label? : String, parent? : String, icon? :
    Reference
    ) -> Group

    Group::not_equal

    fn Group::not_equal(x : Group, y : Group) -> Bool

    Group::to_repr

    Junction

    pub struct Junction {
    id : String
    parent : String?
    } derive(Eq,
    Debug
    )

    Junction::equal

    fn Junction::equal(Junction, Junction) -> Bool

    Junction::new

    fn Junction::new(id : String, parent? : String) -> Junction

    Junction::not_equal

    fn Junction::not_equal(x : Junction, y : Junction) -> Bool

    Junction::to_repr

    Service

    pub struct Service {
    id : String
    label : String
    parent : String?
    icon :
    Reference
    ?
    icon_text : String?
    } derive(Eq,
    Debug
    )

    Service::equal

    fn Service::equal(Service, Service) -> Bool

    Service::new

    fn Service::new(id : String, label? : String, parent? : String, icon? :
    Reference
    , icon_text? : String) -> Service

    Service::not_equal

    fn Service::not_equal(x : Service, y : Service) -> Bool

    Service::to_repr

    Side

    pub(all) enum Side {
    Left
    Right
    Top
    Bottom
    } derive(Eq,
    Debug
    )

    Side::equal

    fn Side::equal(Side, Side) -> Bool

    Side::not_equal

    fn Side::not_equal(x : Side, y : Side) -> Bool

    Side::to_repr

    Side::to_string

    fn Side::to_string(self : Side) -> String

    validate

    fn validate(model : Architecture, nodes_limit? : Int, edges_limit? : Int, depth_limit? : Int, work_limit? : Int) -> ReadOnlyArray[
    Diagnostic
    ]

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io