Flatbuf.Schema.Resolver (flatbuf v0.1.0)

Copy Markdown View Source

CST → %Flatbuf.Schema{} normalization.

  • Resolves include "..." paths recursively (cycle-safe).
  • Threads namespace declarations through all subsequent decls.
  • Assigns vtable slots to table fields in declaration order.
  • Computes struct layouts (offsets, total size, alignment).
  • Computes enum values (implicit increment, explicit overrides).
  • Validates type references against the loaded type table.

Summary

Functions

Resolve a .fbs file from disk, following include statements recursively.

Resolve a single schema source string with no includes.

Functions

resolve_path(path, opts \\ [])

@spec resolve_path(
  Path.t(),
  keyword()
) :: {:ok, Flatbuf.Schema.t()} | {:error, term()}

Resolve a .fbs file from disk, following include statements recursively.

Options:

  • :include_paths — list of additional directories to search for included files. Mirrors flatc's -I PATH flag. The directory of the including file is always tried first; the search paths are tried in order if that fails.

resolve_source(source)

@spec resolve_source(binary()) :: {:ok, Flatbuf.Schema.t()} | {:error, term()}

Resolve a single schema source string with no includes.

Used by tests and code that constructs schemas in memory.