AshBaml.CodeWriter (ash_baml v0.2.0)
View SourceHandles writing and formatting generated Elixir code files.
Summary
Functions
Ensures a .gitkeep or README exists in the types directory.
Converts a module name to a file path.
Writes a module definition to a file.
Functions
Ensures a .gitkeep or README exists in the types directory.
Returns
:okon success{:error, reason}on failure
Converts a module name to a file path.
Example: MyApp.BamlClient.Types.Foo -> "lib/my_app/baml_client/types/foo.ex"
Writes a module definition to a file.
Parameters
module_name- Full module name (e.g., MyApp.Types.Foo)module_code- String containing the module definitionbase_path- Base directory for output (e.g., "lib")
Returns
{:ok, file_path}on success{:error, reason}on failure