amalgam-codegen
Code generation library for amalgam, producing Nickel configurations and Go structs from intermediate representation.
Overview
amalgam-codegen takes the unified type system from amalgam-core and generates idiomatic code for target languages.
Supported Targets
- Nickel: Type-safe configuration language with contracts
- Go: Structs with JSON tags and validation
- CUE (planned): Configuration language
- WASM (planned): WebAssembly modules
Usage
use ;
use Schema;
// Generate Nickel configuration
let schema = from_openapi?;
let nickel_code = new
.with_imports
.generate?;
// Generate Go structs
let go_code = new
.with_json_tags
.generate?;
Features
- Idempotent code generation
- Preserves documentation and comments
- Automatic import resolution
- Format-aware output (proper indentation)