AshBaml.TypeGenerator (ash_baml v0.2.0)

View Source

Generates Ash type module definitions from BAML type metadata.

This module takes parsed BAML type information and produces Elixir code for Ash.TypedStruct and Ash.Type.Enum modules.

Summary

Functions

Generates an Ash.Type.Enum module definition from a BAML enum.

Generates an Ash.TypedStruct module definition from a BAML class.

Functions

generate_enum(enum_name, variants, target_module, opts \\ [])

Generates an Ash.Type.Enum module definition from a BAML enum.

Parameters

  • enum_name - String name of the BAML enum
  • variants - List of variant strings
  • target_module - Module name for the generated type
  • opts - Options including :source_file

Returns

  • String containing the complete module definition

generate_typed_struct(class_name, class_def, target_module, opts \\ [])

Generates an Ash.TypedStruct module definition from a BAML class.

Parameters

  • class_name - String name of the BAML class
  • class_def - Map with "fields" and "dynamic" keys
  • target_module - Module name for the generated type
  • opts - Options including :source_file

Returns

  • String containing the complete module definition