#codegen #nickel #golang

build amalgam-codegen

Code generators for Nickel and Go for amalgam

8 releases (4 breaking)

0.6.4 Sep 1, 2025
0.6.2 Sep 1, 2025
0.4.1 Aug 29, 2025
0.3.0 Aug 28, 2025
0.1.0 Aug 28, 2025

#479 in Build Utils

Download history 9/week @ 2025-09-15 17/week @ 2025-09-22 14/week @ 2025-09-29 9/week @ 2025-10-06 20/week @ 2025-10-13 16/week @ 2025-10-20 1/week @ 2025-10-27

272 downloads per month
Used in 3 crates

Apache-2.0

94KB
2K SLoC

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 amalgam_codegen::{NickelGenerator, GoGenerator};
use amalgam_core::Schema;

// Generate Nickel configuration
let schema = Schema::from_openapi("api.yaml")?;
let nickel_code = NickelGenerator::new()
    .with_imports(true)
    .generate(&schema)?;

// Generate Go structs
let go_code = GoGenerator::new()
    .with_json_tags(true)
    .generate(&schema)?;

Features

  • Idempotent code generation
  • Preserves documentation and comments
  • Automatic import resolution
  • Format-aware output (proper indentation)

Dependencies

~8–11MB
~129K SLoC