Dextrin.Schema.Layout (Dextrin v0.3.0)

Copy Markdown View Source

The names a .dxns file's entries have, from where the file lies under its root (DXN.md §4.6) -- one rule for every reader of a tree: the docs generator, Dextrin.Schema.Tree and the file resolver.

  • A file named like one entry holds that entry: acme/shop/ Customer-v2.dxns, acme/shop/Order/v1.dxns and acme.shop.Product.dxns hold acme.shop/Customer, acme.shop/Order and acme.shop/Product, and the version their name says. Every other entry in such a file is internal to it: acme.shop.Order/Line.
  • A file holding no entry named like it is a namespace file: acme.common.dxns holds acme.common/Money and the rest.
  • A name with no namespace is its own file: HealthCheck.dxns holding HealthCheck.

Summary

Types

t()

What a file's path says about the entries it holds.

Functions

The layout of the file at relative (to its root), holding the entries keys.

Types

t()

@type t() :: %{
  names: %{required(String.t()) => String.t()},
  holder: String.t() | nil,
  version: pos_integer() | nil,
  internal: [String.t()]
}

What a file's path says about the entries it holds.

Functions

of(relative, keys)

@spec of(Path.t(), [String.t()]) :: t()

The layout of the file at relative (to its root), holding the entries keys.

iex> Dextrin.Schema.Layout.of("acme/shop/Order-v2.dxns", ["Order", "Line"])
%{names: %{"Order" => "acme.shop/Order", "Line" => "acme.shop.Order/Line"},
  holder: "Order", version: 2, internal: ["Line"]}

iex> Dextrin.Schema.Layout.of("acme.common.dxns", ["Money"]).names
%{"Money" => "acme.common/Money"}