AshBaml.BamlParser (ash_baml v0.2.0)
View SourceParses BAML schemas and extracts type information for code generation.
This module wraps the baml_elixir parsing functionality to provide a clean interface for extracting classes, enums, and functions.
Summary
Functions
Extracts class definitions from parsed BAML schema.
Extracts enum definitions from parsed BAML schema.
Gets the BAML source path from a client module's configuration.
Extracts all type definitions from BAML files in the given path.
Functions
Extracts class definitions from parsed BAML schema.
Returns a map where keys are class names and values contain field definitions.
Extracts enum definitions from parsed BAML schema.
Returns a map where keys are enum names and values are lists of variants.
Gets the BAML source path from a client module's configuration.
Parameters
client_module- Module that uses BamlElixir.Client
Returns
{:ok, path}if configuration found{:error, reason}if not found
Implementation Notes
The __baml_src_path__/0 callback is automatically generated by both:
use BamlElixir.Clientmacro (for explicit client modules)DefineClientModulestransformer (for config-driven clients)
At compile time, if the module is not yet loaded, this will attempt to extract the path from the module's source file as a fallback.
Extracts all type definitions from BAML files in the given path.
Parameters
baml_src_path- Path to directory containing .baml files
Returns
{:ok, %{classes: map, enums: map, functions: map}}on success{:error, reason}on failure