AshDiagram.Data.Extension behaviour (AshDiagram v0.1.2)

View Source

Provides functions to extend AshDiagram generated diagrams.

Can be implemented in spark extensions to resources and domains to add custom data to the diagrams.

Summary

Callbacks

Extends the diagram with additional data. The function should return the extended diagram.

Checks if the extension creator supports the given creator.

Types

creator()

@type creator() ::
  AshDiagram.Data.EntityRelationship
  | AshDiagram.Data.Class
  | AshDiagram.Data.Policy
  | AshDiagram.Data.Architecture

Callbacks

extend_diagram(creator, diagram)

@callback extend_diagram(
  creator :: creator(),
  diagram :: AshDiagram.t(implementation)
) :: AshDiagram.t(implementation)
when implementation: AshDiagram.implementation()

Extends the diagram with additional data. The function should return the extended diagram.

supports?(creator)

@callback supports?(creator :: creator()) :: boolean()
@callback supports?(creator :: module()) :: false

Checks if the extension creator supports the given creator.

Returns true if the creator is supported, false otherwise.

The function can add additional creators over time, false must be returned for all creators that are not supported.