Diffo.Provider.DomainFragment (Diffo v0.8.0)

Copy Markdown View Source

Domain fragment for Ash domains that extend the Diffo Provider.

Include this fragment in any domain whose resources need to participate in provider polymorphism — i.e., where belongs_to :instance, Diffo.Provider.Instance or belongs_to :party, Diffo.Provider.Party relationships must resolve via manage_relationship.

Adding this fragment causes AshNeo4j to write :Provider as an additional label on every node in the domain at CREATE time. Because AshNeo4j MATCH patterns include all node labels, Ash.get(Diffo.Provider.Instance, uuid) (which matches on [:Provider, :Instance]) will then find concrete instance nodes (e.g. ShelfInstance) that carry both :Instance (from BaseInstance) and :Provider (from this fragment).

Usage

defmodule MyApp.SRM do
  use Ash.Domain, fragments: [Diffo.Provider.DomainFragment]
  ...
end

Forgetting this is a silent footgun (no :Provider label → projection and ref resolution quietly fail), so Diffo.Provider.Extension.Verifiers.VerifyProviderDomain enforces it at compile time: a provider resource whose domain emits no :Provider label fails to compile with a message pointing here.

Summary

Functions

extensions()

opts()

persisted()

spark_dsl_config()

validate_sections()