Shared helpers for the flatbuf.gen, flatbuf.gen.check, and
compile.flatbuf Mix tasks.
Resolves a list of .fbs paths into a flat list of
{module_atom, source_string, output_path} artifacts so each task
can do its own thing (write to disk, compare to disk, manifest).
Summary
Functions
The niceties the code generator knows about.
Translate a module atom to its on-disk path under out_dir, mirroring
Elixir's standard Macro.underscore-per-segment layout.
Convert a dotted module-name string ("My.App") or already-atom into
a module atom. Idempotent.
Parse a comma-separated nicety list ("behaviour,jason") into a list
of atoms. nil returns [] so this can be used directly on
OptionParser output.
Resolve each schema path, generate artifacts for the entire set, and return a list keyed by absolute output path.
Validate a list of nicety atoms (the niceties: config form used by
compile.flatbuf). Returns the list unchanged, or raises
ArgumentError naming the unknown entries and the valid set.
Types
Functions
@spec known_niceties() :: [atom()]
The niceties the code generator knows about.
Translate a module atom to its on-disk path under out_dir, mirroring
Elixir's standard Macro.underscore-per-segment layout.
Convert a dotted module-name string ("My.App") or already-atom into
a module atom. Idempotent.
Parse a comma-separated nicety list ("behaviour,jason") into a list
of atoms. nil returns [] so this can be used directly on
OptionParser output.
Raises ArgumentError for names outside known_niceties/0, so a
typo (--niceties behavior) fails loudly instead of silently doing
nothing.
@spec plan([Path.t()], plan_options()) :: {:ok, [artifact()]} | {:error, term()}
Resolve each schema path, generate artifacts for the entire set, and return a list keyed by absolute output path.
Duplicate module names across schemas are collapsed (the first
schema to emit a module wins). Returns {:ok, [artifact]} or the
first resolver error.
Validate a list of nicety atoms (the niceties: config form used by
compile.flatbuf). Returns the list unchanged, or raises
ArgumentError naming the unknown entries and the valid set.